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
@@ -1,196 +1,2 @@
1
- import f from "../base.js";
2
- import { $one as d, transition as r, $$ as a, on as b, off as x, shouldEventNext as k } from "ph-utils/dom";
3
- import { parseAttrValue as n, unitNumberStr as g, kebabToCamel as u } from "../utils/index.js";
4
- const y = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var(--l-modal-zindex, 100)}.l-modal-wrapper{position:fixed;top:0;left:0;width:100%;height:100%;z-index:calc(var(--l-modal-zindex, 100) + 1)}.l-modal{--l-modal-translate: translate3d(0, 80px, 0);background-color:#fff;border-radius:5px;width:var(--l-modal-width, 27%);margin:auto;box-shadow:0 0 8px #0000001a;position:relative;opacity:1;transform:var(--l-modal-translate) scaleZ(1);transition:opacity .3s,transform .3s}.l-modal-header{display:block;padding:10px;font-size:16px;border-bottom:1px solid var(--l-modal-line-color, rgba(0, 0, 0, .06));font-weight:600;display:flex;align-items:center;gap:5px}.l-modal-footer{padding:10px;border-top:1px solid var(--l-modal-line-color, rgba(0, 0, 0, .06));display:flex;justify-content:flex-end;gap:10px}.l-modal-container{padding:var(--l-modal-container-padding, 15px 10px);font-size:14px}.l-btn-modal-close{--l-form-control-height: auto;position:absolute}.l-modal-close1{right:5px;top:8px}.l-modal-close1::part(default){width:auto;height:auto;padding:5px;border:none;font-size:16px}.l-modal-close2{right:-10px;top:-10px}.l-modal-close2::part(default){width:20px;height:20px;padding:0;background-color:#fff}.mask-transition-enter-from,.mask-transition-leave-to{opacity:0}.modal-transition-enter-from,.modal-transition-leave-to{transform:translateZ(0) scale3d(0,0,0)}.l-modal--mobile{border-radius:10px}.l-modal--mobile .l-modal-header{text-align:center;border-bottom-color:transparent;padding:20px 10px 5px;display:flex;justify-content:center}.l-modal--mobile .l-modal-container{--l-modal-container-padding: 5px 15px 20px;text-align:center}.l-modal--mobile .l-modal-footer{display:flex;justify-content:stretch;align-items:stretch;padding:0;text-align:center;height:50px;gap:0}.l-modal--mobile .l-modal-footer-btn{flex-grow:1;height:100%}.l-modal--mobile .l-modal-footer-btn+.l-modal-footer-btn{border-left:1px solid var(--l-modal-line-color, rgba(0, 0, 0, .06))}.l-modal--middle{--l-modal-translate: translate3d(0, -50%, 0);top:50%}.l-modal--bottom{--l-modal-translate: translate3d(0, -100%, 0);top:100%;width:100%;border-bottom-left-radius:0;border-bottom-right-radius:0}@media screen and (max-width:768px){:host{--l-modal-width: 80%}}", v = ".l-mask{position:fixed;z-index:var(--l-mask-zindex, 100);inset:0;background-color:#0009;transition:opacity .3s;opacity:1}";
5
- class z extends f {
6
- static baseName = "modal";
7
- _bodyOverflow = "";
8
- constructor() {
9
- super(), this.version = 2, this._state = {
10
- destroyOnClose: !1,
11
- maskClosable: !0,
12
- mask: !0,
13
- cancel: !0,
14
- cancelText: "取消",
15
- okText: "确定",
16
- confirmLoading: !1,
17
- close: 1,
18
- verticalAlign: "top",
19
- mobile: !1,
20
- show: !1,
21
- header: !0,
22
- footer: !0
23
- };
24
- }
25
- static get observedAttributes() {
26
- return [
27
- "show",
28
- "width",
29
- "confirm-loading",
30
- "destroy-on-close",
31
- "mask-closable",
32
- "mask",
33
- "cancel",
34
- "cancel-text",
35
- "ok-text",
36
- "close",
37
- "vertical-align",
38
- "mobile",
39
- "z-index",
40
- "header",
41
- "footer",
42
- "header-title"
43
- ];
44
- }
45
- attributeChanged(t, o, e) {
46
- switch (t) {
47
- case "show":
48
- case "confirm-loading":
49
- case "destroy-on-close":
50
- case "mask-closable":
51
- case "mask":
52
- case "cancel":
53
- case "mobile":
54
- case "header":
55
- case "footer":
56
- this._state[u(t)] = n(e, !1, t);
57
- break;
58
- case "cancel-text":
59
- this._state.cancelText = n(e, "取消");
60
- break;
61
- case "ok-text":
62
- this._state.okText = n(e, "确定");
63
- break;
64
- case "close":
65
- this._state.close = n(e, 1);
66
- break;
67
- case "width":
68
- this._state[t] = g(e);
69
- break;
70
- case "vertical-align":
71
- this._state.verticalAlign = n(e, "top");
72
- break;
73
- case "z-index":
74
- this._state.zIndex = e;
75
- break;
76
- case "header-title":
77
- this._state.headerTitle = e;
78
- break;
79
- }
80
- }
81
- updateDOM(t) {
82
- if (t.has("show") && (this._state.show ? this.#t() : this.#a()), t.has("width") && this._setWidth(), t.has("confirm-loading")) {
83
- const o = d('l-button[modal-action="ok"]', this.root);
84
- o && o.setAttribute("loading", this._state.confirmLoading.toString());
85
- }
86
- t.has("z-index") && this._setZIndex();
87
- }
88
- afterInit() {
89
- this._setWidth(), this._setZIndex(), this._state.show && this.#t();
90
- }
91
- render_v2() {
92
- return {
93
- style: [v, y]
94
- };
95
- }
96
- _setZIndex() {
97
- this._state.zIndex ? this.style.setProperty("--l-modal-zindex", this._state.zIndex) : this.style.removeProperty("--l-modal-zindex");
98
- }
99
- _setWidth() {
100
- this._state.width ? this.style.setProperty("--l-modal-width", this._state.width) : this.style.removeProperty("--l-modal-width");
101
- }
102
- #t() {
103
- this._bodyOverflow = getComputedStyle(document.body).overflow, this.classList.add("open"), document.body.style.overflow = "hidden";
104
- let t = d(".l-modal-wrapper", this.root);
105
- if (t) {
106
- const o = d(".l-mask", this.root);
107
- o && r(o, "mask-transition");
108
- const e = d(".l-modal", this.root);
109
- r(e, "modal-transition");
110
- } else {
111
- const o = document.createDocumentFragment();
112
- let e = null;
113
- this._state.mask && (e = a("div", { class: "l-mask l-modal-mask", part: "mask" }), o.appendChild(e)), t = a("div", { class: "l-modal-wrapper", part: "wrapper" });
114
- const l = a("div", {
115
- class: [
116
- "l-modal",
117
- `l-modal--${this._state.mobile ? "mobile" : "pc"}`,
118
- `l-modal--${this._state.verticalAlign}`
119
- ],
120
- part: "default"
121
- });
122
- if (l.setAttribute("modal-action", "modal"), this._state.close !== 0) {
123
- const s = a("l-button", {
124
- shape: "circle",
125
- type: "normal",
126
- class: `l-btn-modal-close l-modal-close${this._state.close}`,
127
- "modal-action": "close"
128
- }), i = a("l-close-icon");
129
- s.appendChild(i), l.appendChild(s);
130
- }
131
- if (this._state.header) {
132
- const s = a("header", { class: "l-modal-header", part: "header" }), i = a("slot", {
133
- name: "header"
134
- });
135
- i.textContent = this._state.headerTitle || "", s.appendChild(i), l.appendChild(s);
136
- }
137
- const h = a("div", {
138
- class: "l-modal-container",
139
- part: "container"
140
- }), p = a("slot");
141
- if (h.appendChild(p), l.appendChild(h), this._state.footer) {
142
- const s = a("footer", {
143
- class: "l-modal-footer",
144
- part: "footer"
145
- }), i = a("slot", { name: "footer" });
146
- if (this._state.cancel) {
147
- const m = a("l-button", {
148
- class: "l-modal-footer-btn",
149
- text: this._state.mobile
150
- });
151
- m.textContent = this._state.cancelText, m.setAttribute("modal-action", "cancel"), i.appendChild(m);
152
- }
153
- const c = a("l-button", {
154
- type: "primary",
155
- class: "l-modal-footer-btn",
156
- loading: this._state.confirmLoading,
157
- text: this._state.mobile
158
- });
159
- c.textContent = this._state.okText, c.setAttribute("modal-action", "ok"), i.appendChild(c), s.appendChild(i), l.appendChild(s);
160
- }
161
- t.appendChild(l), t.setAttribute("role", "dialog"), t.setAttribute("modal-action", "mask"), b(t, "click", this.#o), o.appendChild(t), this.appendToRoot(o), r(l, "modal-transition"), e && r(e, "mask-transition");
162
- }
163
- }
164
- #a() {
165
- document.body.style.setProperty("overflow", this._bodyOverflow);
166
- const t = d(".l-modal", this.root);
167
- r(t, "modal-transition", "leave", () => {
168
- this._state.destroyOnClose && this.#e(), this.classList.remove("open"), this.dispatchEvent(new CustomEvent("close"));
169
- });
170
- const o = d(".l-mask", this.root);
171
- o && r(o, "mask-transition", "leave");
172
- }
173
- disconnectedCallback() {
174
- this.#e(), super.disconnectedCallback();
175
- }
176
- #e() {
177
- const t = d(".l-modal-wrapper", this.root);
178
- t && (x(t, "click", this.#o), this.root.removeChild(t));
179
- const o = d(".l-mask", this.root);
180
- o && this.root.removeChild(o);
181
- }
182
- #o = (t) => {
183
- const [o, e] = k(t, "modal-action", this.root);
184
- if (o) {
185
- let l = "";
186
- this._state.maskClosable && e === "mask" || e === "cancel" || e === "close" ? l = "cancel" : e === "ok" && (l = "ok"), l && this.dispatchEvent(
187
- new CustomEvent(l, {
188
- detail: { action: e }
189
- })
190
- );
191
- }
192
- };
193
- }
194
- export {
195
- z as default
196
- };
1
+ import { t as e } from "../modal-DWyWrN-D.js";
2
+ export { e as default };
@@ -1,91 +1,92 @@
1
- import c from "./index.js";
2
- import i from "../button/index.js";
3
- import u from "../icon/close.js";
4
- import d from "../icon/info.js";
5
- import { regist as p } from "../utils/index.js";
6
- import { $$ as h, on as m, $one as b } from "ph-utils/dom";
7
- import $ from "../form/form_item.js";
8
- import C from "../input/index.js";
9
- function f(t, e, o, l = "alert") {
10
- return new Promise((a) => {
11
- const n = [];
12
- if (o.icon) {
13
- let s = o.icon();
14
- s.setAttribute("slot", "header"), n.push(s.outerHTML);
15
- }
16
- n.push(`<span slot="header">${t}</span>`), l === "prompt" ? (n.push(`<l-form-item label="${e}" label-position="top" inner-block>`), n.push(`<l-input placeholder="${o.placeholder || ""}"></l-input>`), n.push("</l-form-item>")) : n.push(`<span>${e}</span>`);
17
- let r = h("l-modal", {
18
- cancel: `${o.showCancel}`,
19
- innerHTML: n.join(""),
20
- show: !0,
21
- class: `l-modal-box l-modal-box--${l}`,
22
- close: `${o.close}`,
23
- "mask-closable": `${o.maskClosable}`
24
- });
25
- m(
26
- r,
27
- "close",
28
- () => {
29
- r.remove(), r = void 0;
30
- },
31
- { once: !0 }
32
- ), m(
33
- r,
34
- "ok",
35
- () => {
36
- let s = !0;
37
- l === "prompt" && (s = b(".l-modal-box l-input").value), r.removeAttribute("show"), a(s);
38
- },
39
- { once: !0 }
40
- ), m(
41
- r,
42
- "cancel",
43
- () => {
44
- r.removeAttribute("show"), a(!1);
45
- },
46
- { once: !0 }
47
- ), document.body.appendChild(r);
48
- });
1
+ import { regist as e } from "../utils/index.js";
2
+ import t from "../icon/info.js";
3
+ import { t as n } from "../modal-DWyWrN-D.js";
4
+ import r from "../icon/close.js";
5
+ import { t as i } from "../form_item-Bv-YafZK.js";
6
+ import { t as a } from "../button-CC5PmAb1.js";
7
+ import o from "../input/index.js";
8
+ import { $$ as s, $one as c, on as l } from "ph-utils/dom";
9
+ //#region src/components/modal/modal_box.ts
10
+ function u(e, t, n, r = "alert") {
11
+ return new Promise((i) => {
12
+ let a = [];
13
+ if (n.icon) {
14
+ let e = n.icon();
15
+ e.setAttribute("slot", "header"), a.push(e.outerHTML);
16
+ }
17
+ a.push(`<span slot="header">${e}</span>`), r === "prompt" ? (a.push(`<l-form-item label="${t}" label-position="top" inner-block>`), a.push(`<l-input placeholder="${n.placeholder || ""}"></l-input>`), a.push("</l-form-item>")) : a.push(`<span>${t}</span>`);
18
+ let o = s("l-modal", {
19
+ cancel: `${n.showCancel}`,
20
+ innerHTML: a.join(""),
21
+ show: !0,
22
+ class: `l-modal-box l-modal-box--${r}`,
23
+ close: `${n.close}`,
24
+ "mask-closable": `${n.maskClosable}`
25
+ });
26
+ l(o, "close", () => {
27
+ o.remove(), o = void 0;
28
+ }, { once: !0 }), l(o, "ok", () => {
29
+ let e = !0;
30
+ r === "prompt" && (e = c(".l-modal-box l-input").value), o.removeAttribute("show"), i(e);
31
+ }, { once: !0 }), l(o, "cancel", () => {
32
+ o.removeAttribute("show"), i(!1);
33
+ }, { once: !0 }), document.body.appendChild(o);
34
+ });
49
35
  }
50
- function w(t, e, o) {
51
- return p([i, c, u]), new Promise((l) => {
52
- const a = {
53
- showCancel: !1,
54
- close: 0,
55
- maskClosable: !1,
56
- icon: void 0,
57
- ...o
58
- };
59
- return f(e || "提示", t, a, "alert");
60
- });
36
+ function d(t, i, o) {
37
+ return e([
38
+ a,
39
+ n,
40
+ r
41
+ ]), new Promise((e) => {
42
+ let n = {
43
+ showCancel: !1,
44
+ close: 0,
45
+ maskClosable: !1,
46
+ icon: void 0,
47
+ ...o
48
+ };
49
+ return u(i || "提示", t, n, "alert");
50
+ });
61
51
  }
62
- function k(t, e, o) {
63
- p([i, c, u, d]);
64
- const l = {
65
- showCancel: !0,
66
- close: 0,
67
- maskClosable: !0,
68
- icon: () => h("l-info-icon", { style: "color:#1890ff;" }),
69
- ...o
70
- };
71
- return f(e || "提示", t, l, "confirm");
52
+ function f(i, o, c) {
53
+ e([
54
+ a,
55
+ n,
56
+ r,
57
+ t
58
+ ]);
59
+ let l = {
60
+ showCancel: !0,
61
+ close: 0,
62
+ maskClosable: !0,
63
+ icon: () => s("l-info-icon", { style: "color:#1890ff;" }),
64
+ ...c
65
+ };
66
+ return u(o || "提示", i, l, "confirm");
72
67
  }
73
- function v(t, e, o) {
74
- p([i, c, u, d, $, C]);
75
- const l = {
76
- showCancel: !0,
77
- close: 0,
78
- maskClosable: !0,
79
- placeholder: "",
80
- ...o
81
- };
82
- return f(e || "提示", t, l, "prompt");
68
+ function p(s, c, l) {
69
+ e([
70
+ a,
71
+ n,
72
+ r,
73
+ t,
74
+ i,
75
+ o
76
+ ]);
77
+ let d = {
78
+ showCancel: !0,
79
+ close: 0,
80
+ maskClosable: !0,
81
+ placeholder: "",
82
+ ...l
83
+ };
84
+ return u(c || "提示", s, d, "prompt");
83
85
  }
84
- const j = {
85
- alert: w,
86
- confirm: k,
87
- prompt: v
88
- };
89
- export {
90
- j as default
86
+ var m = {
87
+ alert: d,
88
+ confirm: f,
89
+ prompt: p
91
90
  };
91
+ //#endregion
92
+ export { m as default };
@@ -0,0 +1,192 @@
1
+ import e from "./base.js";
2
+ import { kebabToCamel as t, parseAttrValue as n, unitNumberStr as r } from "./utils/index.js";
3
+ import { $$ as i, $one as a, off as o, on as s, shouldEventNext as c, transition as l } from "ph-utils/dom";
4
+ //#region src/components/modal/index.less?inline
5
+ var u = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var(--l-modal-zindex,100)}.l-modal-wrapper{width:100%;height:100%;z-index:calc(var(--l-modal-zindex,100) + 1);position:fixed;top:0;left:0}.l-modal{--l-modal-translate:translate3d(0, 80px, 0);border-radius:var(--l-modal-border-radius,5px);width:var(--l-modal-width,27%);opacity:1;transform:var(--l-modal-translate) scale3d(1, 1, 1);background-color:#fff;margin:auto;transition:opacity .3s,transform .3s;position:relative;box-shadow:0 0 8px #0000001a}.l-modal-header{padding:var(--l-modal-header-padding,10px);border-bottom:1px solid var(--l-modal-line-color,#0000000f);align-items:center;gap:5px;font-size:16px;font-weight:600;display:flex}.l-modal-footer{padding:var(--l-modal-footer-padding,10px);border-top:1px solid var(--l-modal-line-color,#0000000f);justify-content:flex-end;gap:10px;display:flex}.l-modal-container{padding:var(--l-modal-container-padding,15px 10px);font-size:14px}.l-btn-modal-close{--l-form-control-height:auto;position:absolute}.l-modal-close1{top:8px;right:5px}.l-modal-close1::part(default){border:none;width:auto;height:auto;padding:5px;font-size:16px}.l-modal-close2{top:-10px;right:-10px}.l-modal-close2::part(default){background-color:#fff;width:20px;height:20px;padding:0}.mask-transition-enter-from,.mask-transition-leave-to{opacity:0}.modal-transition-enter-from,.modal-transition-leave-to{transform:translate(0,0)scale3d(0,0,0)}.l-modal--mobile{border-radius:10px}.l-modal--mobile .l-modal-header{text-align:center;border-bottom-color:#0000;justify-content:center;padding:20px 10px 5px;display:flex}.l-modal--mobile .l-modal-container{--l-modal-container-padding:5px 15px 20px;text-align:center}.l-modal--mobile .l-modal-footer{text-align:center;justify-content:stretch;align-items:stretch;gap:0;height:50px;padding:0;display:flex}.l-modal--mobile .l-modal-footer-btn{flex-grow:1;height:100%}.l-modal--mobile .l-modal-footer-btn+.l-modal-footer-btn{border-left:1px solid var(--l-modal-line-color,#0000000f)}.l-modal--middle{--l-modal-translate:translate3d(0, -50%, 0);top:50%}.l-modal--bottom{--l-modal-translate:translate3d(0, -100%, 0);border-bottom-right-radius:0;border-bottom-left-radius:0;width:100%;top:100%}@media screen and (width<=768px){:host{--l-modal-width:80%}}", d = ".l-mask{z-index:var(--l-mask-zindex,100);opacity:1;background-color:#0009;transition:opacity .3s;position:fixed;inset:0}", f = class extends e {
6
+ static baseName = "modal";
7
+ _bodyOverflow = "";
8
+ constructor() {
9
+ super(), this.version = 2, this._state = {
10
+ destroyOnClose: !1,
11
+ maskClosable: !0,
12
+ mask: !0,
13
+ cancel: !0,
14
+ cancelText: "取消",
15
+ okText: "确定",
16
+ confirmLoading: !1,
17
+ close: 1,
18
+ verticalAlign: "top",
19
+ mobile: !1,
20
+ show: !1,
21
+ header: !0,
22
+ footer: !0
23
+ };
24
+ }
25
+ static get observedAttributes() {
26
+ return [
27
+ "show",
28
+ "width",
29
+ "confirm-loading",
30
+ "destroy-on-close",
31
+ "mask-closable",
32
+ "mask",
33
+ "cancel",
34
+ "cancel-text",
35
+ "ok-text",
36
+ "close",
37
+ "vertical-align",
38
+ "mobile",
39
+ "z-index",
40
+ "header",
41
+ "footer",
42
+ "header-title"
43
+ ];
44
+ }
45
+ attributeChanged(e, i, a) {
46
+ switch (e) {
47
+ case "show":
48
+ case "confirm-loading":
49
+ case "destroy-on-close":
50
+ case "mask-closable":
51
+ case "mask":
52
+ case "cancel":
53
+ case "mobile":
54
+ case "header":
55
+ case "footer":
56
+ this._state[t(e)] = n(a, !1, e);
57
+ break;
58
+ case "cancel-text":
59
+ this._state.cancelText = n(a, "取消");
60
+ break;
61
+ case "ok-text":
62
+ this._state.okText = n(a, "确定");
63
+ break;
64
+ case "close":
65
+ this._state.close = n(a, 1);
66
+ break;
67
+ case "width":
68
+ this._state[e] = r(a);
69
+ break;
70
+ case "vertical-align":
71
+ this._state.verticalAlign = n(a, "top");
72
+ break;
73
+ case "z-index":
74
+ this._state.zIndex = a;
75
+ break;
76
+ case "header-title":
77
+ this._state.headerTitle = a;
78
+ break;
79
+ }
80
+ }
81
+ updateDOM(e) {
82
+ if (e.has("show") && (this._state.show ? this.#e() : this.#t()), e.has("width") && this._setWidth(), e.has("confirm-loading")) {
83
+ let e = a("l-button[modal-action=\"ok\"]", this.root);
84
+ e && e.setAttribute("loading", this._state.confirmLoading.toString());
85
+ }
86
+ e.has("z-index") && this._setZIndex();
87
+ }
88
+ afterInit() {
89
+ this._setWidth(), this._setZIndex(), this._state.show && this.#e();
90
+ }
91
+ render_v2() {
92
+ return { style: [d, u] };
93
+ }
94
+ _setZIndex() {
95
+ this._state.zIndex ? this.style.setProperty("--l-modal-zindex", this._state.zIndex) : this.style.removeProperty("--l-modal-zindex");
96
+ }
97
+ _setWidth() {
98
+ this._state.width ? this.style.setProperty("--l-modal-width", this._state.width) : this.style.removeProperty("--l-modal-width");
99
+ }
100
+ #e() {
101
+ this._bodyOverflow = getComputedStyle(document.body).overflow, this.classList.add("open"), document.body.style.overflow = "hidden";
102
+ let e = a(".l-modal-wrapper", this.root);
103
+ if (e) {
104
+ let e = a(".l-mask", this.root);
105
+ e && l(e, "mask-transition"), l(a(".l-modal", this.root), "modal-transition");
106
+ } else {
107
+ let t = document.createDocumentFragment(), n = null;
108
+ this._state.mask && (n = i("div", {
109
+ class: "l-mask l-modal-mask",
110
+ part: "mask"
111
+ }), t.appendChild(n)), e = i("div", {
112
+ class: "l-modal-wrapper",
113
+ part: "wrapper"
114
+ });
115
+ let r = i("div", {
116
+ class: [
117
+ "l-modal",
118
+ `l-modal--${this._state.mobile ? "mobile" : "pc"}`,
119
+ `l-modal--${this._state.verticalAlign}`
120
+ ],
121
+ part: "default"
122
+ });
123
+ if (r.setAttribute("modal-action", "modal"), this._state.close !== 0) {
124
+ let e = i("l-button", {
125
+ shape: "circle",
126
+ type: "normal",
127
+ class: `l-btn-modal-close l-modal-close${this._state.close}`,
128
+ "modal-action": "close",
129
+ part: "close-btn"
130
+ }), t = i("l-close-icon");
131
+ e.appendChild(t), r.appendChild(e);
132
+ }
133
+ if (this._state.header) {
134
+ let e = i("header", {
135
+ class: "l-modal-header",
136
+ part: "header"
137
+ }), t = i("slot", { name: "header" });
138
+ t.textContent = this._state.headerTitle || "", e.appendChild(t), r.appendChild(e);
139
+ }
140
+ let a = i("div", {
141
+ class: "l-modal-container",
142
+ part: "container"
143
+ }), o = i("slot");
144
+ if (a.appendChild(o), r.appendChild(a), this._state.footer) {
145
+ let e = i("footer", {
146
+ class: "l-modal-footer",
147
+ part: "footer"
148
+ }), t = i("slot", { name: "footer" });
149
+ if (this._state.cancel) {
150
+ let e = i("l-button", {
151
+ class: "l-modal-footer-btn",
152
+ text: this._state.mobile
153
+ });
154
+ e.textContent = this._state.cancelText, e.setAttribute("modal-action", "cancel"), t.appendChild(e);
155
+ }
156
+ let n = i("l-button", {
157
+ type: "primary",
158
+ class: "l-modal-footer-btn",
159
+ loading: this._state.confirmLoading,
160
+ text: this._state.mobile
161
+ });
162
+ n.textContent = this._state.okText, n.setAttribute("modal-action", "ok"), t.appendChild(n), e.appendChild(t), r.appendChild(e);
163
+ }
164
+ e.appendChild(r), e.setAttribute("role", "dialog"), e.setAttribute("modal-action", "mask"), s(e, "click", this.#r), t.appendChild(e), this.appendToRoot(t), l(r, "modal-transition"), n && l(n, "mask-transition");
165
+ }
166
+ }
167
+ #t() {
168
+ document.body.style.setProperty("overflow", this._bodyOverflow), l(a(".l-modal", this.root), "modal-transition", "leave", () => {
169
+ this._state.destroyOnClose && this.#n(), this.classList.remove("open"), this.dispatchEvent(new CustomEvent("close"));
170
+ });
171
+ let e = a(".l-mask", this.root);
172
+ e && l(e, "mask-transition", "leave");
173
+ }
174
+ disconnectedCallback() {
175
+ this.#n(), super.disconnectedCallback();
176
+ }
177
+ #n() {
178
+ let e = a(".l-modal-wrapper", this.root);
179
+ e && (o(e, "click", this.#r), this.root.removeChild(e));
180
+ let t = a(".l-mask", this.root);
181
+ t && this.root.removeChild(t);
182
+ }
183
+ #r = (e) => {
184
+ let [t, n] = c(e, "modal-action", this.root);
185
+ if (t) {
186
+ let e = "";
187
+ this._state.maskClosable && n === "mask" || n === "cancel" || n === "close" ? e = "cancel" : n === "ok" && (e = "ok"), e && this.dispatchEvent(new CustomEvent(e, { detail: { action: n } }));
188
+ }
189
+ };
190
+ };
191
+ //#endregion
192
+ export { f as t };