litos-ui 0.19.0 → 0.20.1

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 (155) hide show
  1. package/lib/{animation-DStAHzod.js → animation-Bo4jbSGK.js} +4 -3
  2. package/lib/{base-LvfO4mmL.js → base-Dyj1rzaK.js} +11 -12
  3. package/lib/base.d.ts +5 -4
  4. package/lib/base.js +19 -15
  5. package/lib/button/index.d.ts +2 -2
  6. package/lib/button/index.js +152 -2
  7. package/lib/button/style.d.ts +2 -0
  8. package/lib/button/style.js +2 -0
  9. package/lib/calendar/index.d.ts +2 -2
  10. package/lib/calendar/index.js +1 -1
  11. package/lib/{calendar-Clbg3qot.js → calendar-CvlUsN6w.js} +20 -23
  12. package/lib/card/index.d.ts +23 -0
  13. package/lib/card/index.js +2 -0
  14. package/lib/card-3DM-lJQV.js +63 -0
  15. package/lib/carousel/index.js +1 -1
  16. package/lib/carousel/item.js +1 -1
  17. package/lib/{carousel-Dgirxwzb.js → carousel-DvkZ1YXq.js} +23 -19
  18. package/lib/check/checkbox.js +1 -1
  19. package/lib/check/checkbox_group.js +1 -1
  20. package/lib/check/radio.js +1 -1
  21. package/lib/check/radio_group.js +1 -1
  22. package/lib/{check-BDOpD_0-.js → check-DFlwStH9.js} +10 -13
  23. package/lib/{check-CrlZ7zVL.js → check-doQ2ZpQj.js} +10 -10
  24. package/lib/{checkbox-D_bZGoUD.js → checkbox-DhGHJXwI.js} +1 -1
  25. package/lib/collapse/index.js +1 -1
  26. package/lib/collapse/item.js +1 -1
  27. package/lib/{collapse-BRxYoeJx.js → collapse-B6-Rn05A.js} +8 -10
  28. package/lib/color_picker/index.js +1 -1
  29. package/lib/{color_picker-AaFcIczZ.js → color_picker-0a-IGZY9.js} +3 -3
  30. package/lib/date_picker/index.d.ts +2 -2
  31. package/lib/date_picker/index.js +1 -1
  32. package/lib/{date_picker-HjkRma9j.js → date_picker-BDN2PAz5.js} +3 -7
  33. package/lib/date_picker_ori/index.js +1 -1
  34. package/lib/{date_picker_ori-1IOHZsan.js → date_picker_ori-BXFs1eET.js} +4 -6
  35. package/lib/description_panel/index.js +1 -1
  36. package/lib/{description_panel-DaqVcA6-.js → description_panel--AKXBzLL.js} +2 -6
  37. package/lib/dialog/dialog_box.d.ts +22 -0
  38. package/lib/dialog/dialog_box.js +98 -0
  39. package/lib/dialog/dialog_container.d.ts +7 -3
  40. package/lib/dialog/dialog_container.js +1 -1
  41. package/lib/dialog/index.d.ts +33 -11
  42. package/lib/dialog/index.js +48 -48
  43. package/lib/{dialog_container-CcTyfoaD.js → dialog_container-BNPQ9n0V.js} +34 -15
  44. package/lib/{esm-Cir9D6cn.js → esm-DAha108i.js} +67 -67
  45. package/lib/form/form_item.d.ts +3 -3
  46. package/lib/form/form_item.js +1 -1
  47. package/lib/form/index.d.ts +3 -3
  48. package/lib/form/index.js +1 -1
  49. package/lib/{form-BvZHaqAt.js → form-DJxvBiLy.js} +30 -32
  50. package/lib/{form_inner-52DR1IPu.js → form_inner-Cnwb6f_Q.js} +3 -5
  51. package/lib/{form_item-DtqChzc3.js → form_item-BqPMRABd.js} +7 -9
  52. package/lib/icon/arrow_down.js +1 -1
  53. package/lib/icon/arrow_left.js +1 -1
  54. package/lib/icon/arrow_right.js +1 -1
  55. package/lib/icon/arrow_up.js +1 -1
  56. package/lib/icon/base.d.ts +2 -2
  57. package/lib/icon/base.js +1 -1
  58. package/lib/icon/calendar.js +1 -1
  59. package/lib/icon/caret_bottom.js +1 -1
  60. package/lib/icon/caret_top.js +1 -1
  61. package/lib/icon/close.js +1 -1
  62. package/lib/icon/close_filled.js +1 -1
  63. package/lib/icon/d_arrow_left.js +1 -1
  64. package/lib/icon/d_arrow_right.js +1 -1
  65. package/lib/icon/font_icon.js +1 -1
  66. package/lib/icon/info.js +1 -1
  67. package/lib/icon/loading.js +1 -1
  68. package/lib/icon/moon.js +1 -1
  69. package/lib/icon/more.js +1 -1
  70. package/lib/icon/reduction.js +1 -1
  71. package/lib/icon/refresh.js +1 -1
  72. package/lib/icon/refresh_left.js +1 -1
  73. package/lib/icon/refresh_right.js +1 -1
  74. package/lib/icon/search.js +1 -1
  75. package/lib/icon/select.js +1 -1
  76. package/lib/icon/sort.js +1 -1
  77. package/lib/icon/success.js +1 -1
  78. package/lib/icon/sun.js +1 -1
  79. package/lib/icon/theme_default.js +1 -1
  80. package/lib/icon/warn.js +1 -1
  81. package/lib/icon/zoom_in.js +1 -1
  82. package/lib/icon/zoom_out.js +1 -1
  83. package/lib/image/image_preview.js +1 -1
  84. package/lib/image/index.js +1 -1
  85. package/lib/{image-BCUhVAFo.js → image-CVQai6NX.js} +19 -19
  86. package/lib/{image_preview-BeJzfEoF.js → image_preview-DfQAKSJH.js} +3 -5
  87. package/lib/index.d.ts +2 -0
  88. package/lib/index.js +71 -69
  89. package/lib/input/index.d.ts +2 -2
  90. package/lib/input/index.js +3 -5
  91. package/lib/{item-42bYhAkZ.js → item-CQ2Sknbz.js} +1 -1
  92. package/lib/{item-Dq6M7lxw.js → item-DI6mQXtB.js} +5 -7
  93. package/lib/{item-CX8C9X57.js → item-D_ZOPXuE.js} +1 -1
  94. package/lib/list/index.js +1 -1
  95. package/lib/{list-Dz1Ya118.js → list-MG8PRzos.js} +3 -3
  96. package/lib/loading/index.js +6 -4
  97. package/lib/mask/index.js +1 -1
  98. package/lib/{mask-BlDl9u8F.js → mask-Bx-yNIJv.js} +2 -6
  99. package/lib/mask-Ox6CoyFB.js +5 -0
  100. package/lib/md_input/index.js +1 -1
  101. package/lib/{md_input-DN3ceqsw.js → md_input-BX3bujz8.js} +2 -2
  102. package/lib/menu/index.d.ts +12 -4
  103. package/lib/menu/index.js +1 -1
  104. package/lib/menu-DKscK5mw.js +274 -0
  105. package/lib/message/index.js +1 -1
  106. package/lib/modal/index.d.ts +2 -2
  107. package/lib/modal/index.js +1 -1
  108. package/lib/modal/modal_box.js +13 -13
  109. package/lib/{modal-cjj3Nw1B.js → modal-Cwi3qlEf.js} +39 -33
  110. package/lib/page_header/index.js +1 -1
  111. package/lib/{page_header-BfuWJIdd.js → page_header-ujV3pncE.js} +2 -4
  112. package/lib/pagination/index.d.ts +25 -18
  113. package/lib/pagination/index.js +1 -1
  114. package/lib/{pagination-DpOSOFwl.js → pagination-aRbGd3Rf.js} +86 -83
  115. package/lib/polygon/index.js +1 -1
  116. package/lib/{polygon-BY1FAACc.js → polygon-DhhovlrG.js} +1 -1
  117. package/lib/qrcode/index.d.ts +2 -2
  118. package/lib/qrcode/index.js +1 -1
  119. package/lib/{qrcode-Bgr8gJzA.js → qrcode-Dip8uLSA.js} +1 -1
  120. package/lib/{radio-C7dkhgwc.js → radio-C9NPQWGI.js} +1 -1
  121. package/lib/select/index.d.ts +2 -2
  122. package/lib/select/index.js +1 -1
  123. package/lib/{select-Cis6kRjQ.js → select-BZMDj5VE.js} +33 -30
  124. package/lib/select_ori/index.d.ts +2 -2
  125. package/lib/select_ori/index.js +1 -1
  126. package/lib/{select_ori-DcJbNYYr.js → select_ori-C7sUZxen.js} +3 -3
  127. package/lib/space/index.js +1 -1
  128. package/lib/{space-BT_dVhhv.js → space-CKuTk0YB.js} +6 -5
  129. package/lib/style-gKR_qwzm.js +5 -0
  130. package/lib/styles/animation/index.d.ts +2 -0
  131. package/lib/styles/animation/index.js +2 -0
  132. package/lib/styles/mask/index.d.ts +2 -0
  133. package/lib/styles/mask/index.js +2 -0
  134. package/lib/switch/index.js +1 -1
  135. package/lib/{switch-UyhlgW7F.js → switch-wh2-ivty.js} +11 -9
  136. package/lib/tabbar/index.js +1 -1
  137. package/lib/tabbar/item.js +1 -1
  138. package/lib/{tabbar-DO0kB58Y.js → tabbar-CBXK-_AV.js} +1 -1
  139. package/lib/table/index.d.ts +7 -3
  140. package/lib/table/index.js +1 -1
  141. package/lib/{table-saZMryiV.js → table-BQxMD2Ae.js} +32 -33
  142. package/lib/tabs/index.js +4 -2
  143. package/lib/tag/index.js +1 -1
  144. package/lib/{tag-BtDcKdxo.js → tag-Di1z9PoZ.js} +3 -5
  145. package/lib/theme/index.js +1 -1
  146. package/lib/theme/theme_color.d.ts +1 -2
  147. package/lib/theme/theme_color.js +4 -5
  148. package/lib/{theme-Barcq234.js → theme-CLbBS-in.js} +9 -10
  149. package/lib/utils/context_provide.js +1 -1
  150. package/lib/utils/index.d.ts +1 -1
  151. package/lib/utils/popover.js +1 -1
  152. package/lib/utils/transition.js +1 -1
  153. package/package.json +11 -11
  154. package/lib/button-CC5NBWtI.js +0 -152
  155. package/lib/menu-BOmVa4xN.js +0 -224
@@ -1,2 +1,2 @@
1
- import { t as e } from "../checkbox-D_bZGoUD.js";
1
+ import { t as e } from "../checkbox-DhGHJXwI.js";
2
2
  export { e as default };
@@ -1,4 +1,4 @@
1
- import { t as e } from "../check-BDOpD_0-.js";
1
+ import { t as e } from "../check-DFlwStH9.js";
2
2
  //#region src/components/check/checkbox_group.ts
3
3
  var t = class extends e {
4
4
  static baseName = "checkbox-group";
@@ -1,2 +1,2 @@
1
- import { t as e } from "../radio-C7dkhgwc.js";
1
+ import { t as e } from "../radio-C9NPQWGI.js";
2
2
  export { e as default };
@@ -1,4 +1,4 @@
1
- import { t as e } from "../check-BDOpD_0-.js";
1
+ import { t as e } from "../check-DFlwStH9.js";
2
2
  //#region src/components/check/radio_group.ts
3
3
  var t = class extends e {
4
4
  static baseName = "radio-group";
@@ -1,7 +1,7 @@
1
1
  import { unitNumberStr as e } from "./utils/index.js";
2
- import { n as t } from "./esm-Cir9D6cn.js";
3
- import { t as n } from "./form_inner-52DR1IPu.js";
4
- import { $$ as r, off as i, on as a } from "ph-utils/dom";
2
+ import { n as t } from "./esm-DAha108i.js";
3
+ import { t as n } from "./form_inner-Cnwb6f_Q.js";
4
+ import { $$ as r, off as i, on as a } from "ph-utils/browser";
5
5
  //#region src/components/check/index.less?inline
6
6
  var o = ":host{align-items:center;gap:var(--l-check-gap,0px);display:flex}", s = class extends n {
7
7
  values;
@@ -23,11 +23,7 @@ var o = ":host{align-items:center;gap:var(--l-check-gap,0px);display:flex}", s =
23
23
  ];
24
24
  }
25
25
  attributeChange(t, n, r) {
26
- switch (t) {
27
- case "gap":
28
- this._state.gap = e(r);
29
- break;
30
- }
26
+ t === "gap" && (this._state.gap = e(r));
31
27
  }
32
28
  updateDOM(e) {
33
29
  e.has("gap") && this._updateGap();
@@ -61,11 +57,12 @@ var o = ":host{align-items:center;gap:var(--l-check-gap,0px);display:flex}", s =
61
57
  };
62
58
  updateChecked() {
63
59
  let e = [];
64
- if (this.value) if (this.multiple) {
65
- let t = this.value.split("&");
66
- e.push(...t.map((e) => decodeURIComponent(e)));
67
- } else e = [this.value];
68
- else e = [];
60
+ if (this.value) {
61
+ if (this.multiple) {
62
+ let t = this.value.split("&");
63
+ e.push(...t.map((e) => decodeURIComponent(e)));
64
+ } else e = [this.value];
65
+ } else e = [];
69
66
  this.values(e);
70
67
  }
71
68
  };
@@ -1,7 +1,7 @@
1
1
  import { parseAttrValue as e, stopSignal as t } from "./utils/index.js";
2
- import { t as n } from "./esm-Cir9D6cn.js";
3
- import { t as r } from "./form_inner-52DR1IPu.js";
4
- import { $$ as i, addClass as a, off as o, on as s, removeClass as c, toggleClass as l } from "ph-utils/dom";
2
+ import { t as n } from "./esm-DAha108i.js";
3
+ import { t as r } from "./form_inner-Cnwb6f_Q.js";
4
+ import { $$ as i, addClass as a, off as o, on as s, removeClass as c, toggleClass as l } from "ph-utils/browser";
5
5
  //#region src/components/check/check.ts
6
6
  var u = class extends r {
7
7
  _checked;
@@ -79,9 +79,7 @@ var u = class extends r {
79
79
  let i = e(r, !1, t);
80
80
  this._state.indeterminate = i, this._updateIndeterminate();
81
81
  break;
82
- case "label":
83
- this._state.label = r;
84
- break;
82
+ case "label": this._state.label = r;
85
83
  }
86
84
  }
87
85
  checkedChange() {
@@ -94,10 +92,12 @@ var u = class extends r {
94
92
  this._state.indeterminate ? a(this, "is-indeterminate") : c(this, "is-indeterminate");
95
93
  }
96
94
  #e = () => {
97
- if (!this.isDisabled()) if (this.value && this._groupCtx) this.emitChange();
98
- else {
99
- let e = this._inputType === "radio" ? !0 : !this.getChecked();
100
- this.setChecked(e), this.emitChange();
95
+ if (!this.isDisabled()) {
96
+ if (this.value && this._groupCtx) this.emitChange();
97
+ else {
98
+ let e = this._inputType === "radio" || !this.getChecked();
99
+ this.setChecked(e), this.emitChange();
100
+ }
101
101
  }
102
102
  };
103
103
  emitChange() {
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./check-CrlZ7zVL.js";
1
+ import { n as e, t } from "./check-doQ2ZpQj.js";
2
2
  //#region src/components/check/checkbox.less?inline
3
3
  var n = ":host(.is-indeterminate) .l-check__inner{background-color:var(--l-primary-color,#722ed1)}:host(.is-indeterminate) .l-check__inner:after{content:\"\";width:calc(var(--l-check-size,14px) * .4);border:none;border-bottom:1px solid #fff;height:1px;margin-top:0;display:block;transform:rotate(0)}.l-check__inner:after,:host(.is-checked) .l-check__inner:after{content:\"\";width:calc(var(--l-check-size,14px) * .6);height:calc(var(--l-check-size,14px) * .3);border-top:none;border-bottom:1px solid #0000;border-left:1px solid #0000;border-right:none;margin-top:-3px;transition:border-color .2s ease-in-out;display:block;transform:rotate(-45deg)}:host(.is-checked) .l-check__inner{background-color:var(--l-primary-color,#722ed1)}:host(.is-checked) .l-check__inner:after{border-color:#fff}:host(.is-disabled) .l-check__inner{background-color:var(--l-disabled-color,#e6e6e6);border-color:var(--l-disabled-color,#e6e6e6)}", r = class extends e {
4
4
  static baseName = "checkbox";
@@ -1,2 +1,2 @@
1
- import { t as e } from "../collapse-BRxYoeJx.js";
1
+ import { t as e } from "../collapse-B6-Rn05A.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../item-Dq6M7lxw.js";
1
+ import { t as e } from "../item-DI6mQXtB.js";
2
2
  export { e as default };
@@ -1,7 +1,7 @@
1
1
  import e from "./base.js";
2
2
  import { kebabToCamel as t, parseAttrValue as n, unitNumberStr as r } from "./utils/index.js";
3
- import { n as i } from "./esm-Cir9D6cn.js";
4
- import { $$ as a, off as o, on as s } from "ph-utils/dom";
3
+ import { n as i } from "./esm-DAha108i.js";
4
+ import { $$ as a, off as o, on as s } from "ph-utils/browser";
5
5
  //#region src/components/collapse/index.less?inline
6
6
  var c = ":host{--l-collapse-border-color:var(--l-border-color,#dedede);--l-collapse-border-radius:0px;gap:var(--l-collapse-gap,0px);box-sizing:border-box;grid-template-columns:1fr;display:grid}:host(.l-collapse-grid){grid-template-columns:repeat(auto-fill,minmax(200px,1fr));align-items:start}", l = class extends e {
7
7
  static baseName = "collapse";
@@ -55,14 +55,12 @@ var c = ":host{--l-collapse-border-color:var(--l-border-color,#dedede);--l-colla
55
55
  case "grid":
56
56
  this._state[e] = n(a, !1, e);
57
57
  break;
58
- case "prop":
59
- if (a !== this._state.prop) {
60
- this._state.prop = a;
61
- let e = [], t = a.split("&");
62
- for (let n = 0, r = t.length; n < r; n++) e.push(t[n]);
63
- this.expands(e);
64
- }
65
- break;
58
+ case "prop": if (a !== this._state.prop) {
59
+ this._state.prop = a;
60
+ let e = [], t = a.split("&");
61
+ for (let n = 0, r = t.length; n < r; n++) e.push(t[n]);
62
+ this.expands(e);
63
+ }
66
64
  }
67
65
  }
68
66
  updateDOM(e) {
@@ -1,2 +1,2 @@
1
- import { t as e } from "../color_picker-AaFcIczZ.js";
1
+ import { t as e } from "../color_picker-0a-IGZY9.js";
2
2
  export { e as default };
@@ -1,7 +1,7 @@
1
1
  import { initAttr as e, setAttrs as t } from "./utils/index.js";
2
- import { t as n } from "./form_inner-52DR1IPu.js";
2
+ import { t as n } from "./form_inner-Cnwb6f_Q.js";
3
3
  import { t as r } from "./input-DUBlLEXS.js";
4
- import { $one as i, off as a, on as o } from "ph-utils/dom";
4
+ import { $one as i, off as a, on as o } from "ph-utils/browser";
5
5
  //#region src/components/color_picker/index.less?inline
6
6
  var s = ":host{--l-input-width:60px}", c = class extends n {
7
7
  static baseName = "color-picker";
@@ -34,7 +34,7 @@ var s = ":host{--l-input-width:60px}", c = class extends n {
34
34
  }
35
35
  _handleChange = (e) => {
36
36
  let t = e.target.value;
37
- super.setValue(t), this.dispatchEvent(new CustomEvent("change", { detail: t }));
37
+ super.setValue(t), this.emit("change", { detail: t });
38
38
  };
39
39
  };
40
40
  //#endregion
@@ -12,8 +12,8 @@ export default class DatePicker extends FormInner<DatePickerState> {
12
12
  attributeChange(name: string, oldValue: string, newValue: string): void;
13
13
  protected updateDOM(changedProps: Set<string>): void;
14
14
  render_v2(): {
15
- template?: string | HTMLElement | DocumentFragment;
16
- style?: string | string[];
15
+ style: string[];
16
+ template: DocumentFragment;
17
17
  };
18
18
  private _popoverContentRender;
19
19
  private _updateWidth;
@@ -1,3 +1,3 @@
1
1
  import "../utils/popover.js";
2
- import { t as e } from "../date_picker-HjkRma9j.js";
2
+ import { t as e } from "../date_picker-BDN2PAz5.js";
3
3
  export { e as default };
@@ -1,8 +1,8 @@
1
1
  import { unitNumberStr as e } from "./utils/index.js";
2
- import { t } from "./form_inner-52DR1IPu.js";
2
+ import { t } from "./form_inner-Cnwb6f_Q.js";
3
3
  import { t as n } from "./input_inner-x4GfLGjj.js";
4
4
  import { Popover as r } from "./utils/popover.js";
5
- import { $$ as i, on as a } from "ph-utils/dom";
5
+ import { $$ as i, on as a } from "ph-utils/browser";
6
6
  //#region src/components/date_picker/index.less?inline
7
7
  var o = ":host{height:var(--l-form-control-height,32px);border:1px solid var(--l-border-color,#dedede);border-radius:var(--l-border-radius,3px);width:var(--l-date-picker-width,140px);align-items:center;gap:8px;padding:0 8px;transition:border-color .3s;display:inline-flex}:host(:hover){border-color:var(--l-primary-color-light2,#66b3ff)}.icon{color:#00000059;flex-shrink:0;min-width:0}", s = class extends t {
8
8
  static baseName = "date-picker";
@@ -29,11 +29,7 @@ var o = ":host{height:var(--l-form-control-height,32px);border:1px solid var(--l
29
29
  return ["width"];
30
30
  }
31
31
  attributeChange(t, n, r) {
32
- switch (t) {
33
- case "width":
34
- this._state.width = e(r);
35
- break;
36
- }
32
+ t === "width" && (this._state.width = e(r));
37
33
  }
38
34
  updateDOM(e) {
39
35
  e.has("width") && this._updateWidth();
@@ -1,2 +1,2 @@
1
- import { t as e } from "../date_picker_ori-1IOHZsan.js";
1
+ import { t as e } from "../date_picker_ori-BXFs1eET.js";
2
2
  export { e as default };
@@ -1,7 +1,7 @@
1
1
  import { kebabToCamel as e, parseAttrValue as t, unitNumberStr as n } from "./utils/index.js";
2
- import { t as r } from "./form_inner-52DR1IPu.js";
3
- import { $ as i, $$ as a, iterate as o, off as s, on as c } from "ph-utils/dom";
4
- import { parse as l } from "ph-utils/date";
2
+ import { t as r } from "./form_inner-Cnwb6f_Q.js";
3
+ import { $ as i, $$ as a, iterate as o, off as s, on as c } from "ph-utils/browser";
4
+ import { parse as l } from "ph-utils";
5
5
  //#region src/components/date_picker_ori/index.less?inline
6
6
  var u = ":host{width:var(--l-date-picker-width,auto);align-items:center;display:inline-flex}.l-date-inner{height:var(--l-form-control-height,32px);border:1px solid var(--l-border-color,#dedede);cursor:text;border-radius:3px;outline:none;flex-grow:1;padding:0 5px;transition:border-color .3s}.l-date-inner:hover{border-color:var(--l-primary-color-light1,#9254de)}.l-date-inner:focus{border-color:var(--l-primary-color,#722ed1)}.l-date-range-divider{margin:0 10px}", d = class extends r {
7
7
  static baseName = "date-picker-ori";
@@ -58,9 +58,7 @@ var u = ":host{width:var(--l-date-picker-width,auto);align-items:center;display:
58
58
  case "delay":
59
59
  this._state.delay = t(a, 300);
60
60
  break;
61
- case "width":
62
- this._state.width = n(a);
63
- break;
61
+ case "width": this._state.width = n(a);
64
62
  }
65
63
  }
66
64
  updateDOM(e) {
@@ -1,2 +1,2 @@
1
- import { t as e } from "../description_panel-DaqVcA6-.js";
1
+ import { t as e } from "../description_panel--AKXBzLL.js";
2
2
  export { e as default };
@@ -1,6 +1,6 @@
1
1
  import e from "./base.js";
2
2
  import { kebabToCamel as t, parseAttrValue as n } from "./utils/index.js";
3
- import { $one as r, addClass as i, hasClass as a, on as o, removeClass as s, shouldEventNext as c } from "ph-utils/dom";
3
+ import { $one as r, addClass as i, hasClass as a, on as o, removeClass as s, shouldEventNext as c } from "ph-utils/browser";
4
4
  //#region src/components/description_panel/index.less?inline
5
5
  var l = ":host{--l-desc-panel-min-height:100px;--l-desc-panel-font-size:14px;--l-desc-panel-textindent:calc(var(--l-desc-panel-font-size) * 2);max-height:var(--l-desc-panel-max-height,max-content);color:#1f2937;font-size:var(--l-desc-panel-font-size);text-indent:var(--l-desc-panel-textindent);box-sizing:border-box;transition:all .15s linear;display:block;position:relative}.content{box-sizing:border-box;border:1px solid #0000}.l-desc-panel-operator{z-index:2;box-sizing:border-box;background:0 0;justify-content:center;width:100%;padding-top:0;padding-bottom:0;display:flex}.l-desc-panel-btnmore{font-size:var(--nt-desc-panel-font-size)}.l-desc-panel-btnmore:before{content:attr(data-text)}.l-desc-panel-arrow{transition:transform .3s ease-in-out;transform:rotate(180deg)}:host(.collapse){max-height:var(--l-desc-panel-min-height);overflow-y:hidden}:host(.collapse) .l-desc-panel-operator{background:linear-gradient(-180deg,#fff0 0%,#fff 80%);padding-top:65px;position:absolute;bottom:0;left:0}:host(.collapse) .l-desc-panel-arrow{transform:rotateX(0)}", u = class extends e {
6
6
  static baseName = "description-panel";
@@ -11,11 +11,7 @@ var l = ":host{--l-desc-panel-min-height:100px;--l-desc-panel-font-size:14px;--l
11
11
  attributeChangedCallback(e, r, i) {
12
12
  e = t(e);
13
13
  let a = n(i, this[e]);
14
- if (a !== this[e]) switch (this[e] = a, e) {
15
- case "collapseHeight":
16
- this.collapseHeight === 100 ? this.style.removeProperty("--l-desc-panel-min-height") : this.style.setProperty("--l-desc-panel-min-height", `${this.collapseHeight}px`);
17
- break;
18
- }
14
+ a !== this[e] && (this[e] = a, e === "collapseHeight") && (this.collapseHeight === 100 ? this.style.removeProperty("--l-desc-panel-min-height") : this.style.setProperty("--l-desc-panel-min-height", `${this.collapseHeight}px`));
19
15
  }
20
16
  connectedCallback() {
21
17
  this.loadStyleText(l), super.connectedCallback();
@@ -0,0 +1,22 @@
1
+ type AlertOptions = {
2
+ /** 是否显示取消按钮 */
3
+ showCancel?: boolean;
4
+ /** 右上角关闭按钮, 1 - 显示在框内, 2 - 显示在框角, 0 - 不显示, 默认: 0 */
5
+ close?: number;
6
+ /** 点击蒙层是否允许关闭, 默认: false */
7
+ maskClosable?: boolean;
8
+ /** 显示图标 */
9
+ icon?: () => HTMLElement;
10
+ };
11
+ type PromptOptions = AlertOptions & {
12
+ placeholder?: string;
13
+ };
14
+ declare function alert(content: string, title?: string, option?: AlertOptions): Promise<boolean>;
15
+ declare function confirm(content: string, title?: string, option?: AlertOptions): Promise<boolean>;
16
+ declare function prompt(label: string, title?: string, option?: PromptOptions): Promise<string | false>;
17
+ declare const _default: {
18
+ alert: typeof alert;
19
+ confirm: typeof confirm;
20
+ prompt: typeof prompt;
21
+ };
22
+ export default _default;
@@ -0,0 +1,98 @@
1
+ import { regist as e } from "../utils/index.js";
2
+ import t from "../icon/info.js";
3
+ import n from "./index.js";
4
+ import { t as r } from "../dialog_container-BNPQ9n0V.js";
5
+ import i from "../button/index.js";
6
+ import a from "../icon/close.js";
7
+ import { t as o } from "../form_item-BqPMRABd.js";
8
+ import s from "../input/index.js";
9
+ import { $$ as c, $one as l } from "ph-utils/browser";
10
+ //#region src/components/dialog/dialog_box.ts
11
+ function u(e, t, r, i = "alert") {
12
+ return new Promise((a) => {
13
+ let o = [];
14
+ if (r.icon) {
15
+ let e = r.icon();
16
+ e.setAttribute("slot", "header"), o.push(e.outerHTML);
17
+ }
18
+ o.push(`<span slot="header">${e}</span>`), i === "prompt" ? (o.push(`<l-form-item label="${t}" label-position="top" inner-block>`), o.push(`<l-input placeholder="${r.placeholder || ""}"></l-input>`), o.push("</l-form-item>")) : o.push(`<span>${t}</span>`);
19
+ let s = document.createElement("dialog"), c = document.createElement("l-dialog-container");
20
+ c.setAttribute("header", e), c.setAttribute("close", `${r.close}`), c.setAttribute("show-cancel", `${r.showCancel}`), c.innerHTML = o.join(""), s.appendChild(c), document.body.appendChild(s);
21
+ let u = new n({
22
+ el: s,
23
+ maskClosable: r.maskClosable,
24
+ close: r.close,
25
+ onAction: (e, t) => {
26
+ if (e === "ok") {
27
+ let e = !0;
28
+ if (i === "prompt") {
29
+ let t = l("l-input", c);
30
+ e = t ? t.value : "";
31
+ }
32
+ t(), a(e);
33
+ } else t(), a(!1);
34
+ setTimeout(() => {
35
+ u.destroy(), s.remove();
36
+ }, 350);
37
+ }
38
+ });
39
+ u.open();
40
+ });
41
+ }
42
+ function d(t, n, o) {
43
+ e([
44
+ i,
45
+ r,
46
+ a
47
+ ]);
48
+ let s = {
49
+ showCancel: !1,
50
+ close: 0,
51
+ maskClosable: !1,
52
+ icon: void 0,
53
+ ...o
54
+ };
55
+ return u(n || "提示", t, s, "alert");
56
+ }
57
+ function f(n, o, s) {
58
+ e([
59
+ i,
60
+ r,
61
+ a,
62
+ t
63
+ ]);
64
+ let l = {
65
+ showCancel: !0,
66
+ close: 0,
67
+ maskClosable: !0,
68
+ icon: () => c("l-info-icon", { style: "color:#1890ff;" }),
69
+ ...s
70
+ };
71
+ return u(o || "提示", n, l, "confirm");
72
+ }
73
+ function p(n, c, l) {
74
+ e([
75
+ i,
76
+ r,
77
+ a,
78
+ t,
79
+ o,
80
+ s
81
+ ]);
82
+ let d = {
83
+ showCancel: !0,
84
+ close: 0,
85
+ maskClosable: !0,
86
+ placeholder: "",
87
+ icon: void 0,
88
+ ...l
89
+ };
90
+ return u(c || "提示", n, d, "prompt");
91
+ }
92
+ var m = {
93
+ alert: d,
94
+ confirm: f,
95
+ prompt: p
96
+ };
97
+ //#endregion
98
+ export { m as default };
@@ -15,9 +15,13 @@ type DialogContainerState = {
15
15
  /** 确定按钮文本 */
16
16
  okText: string;
17
17
  /** 是否显示右上角关闭按钮, 1 - 显示在框内, 2 - 显示在框角, 0 - 不显示 */
18
- showClose: number;
18
+ close: number;
19
19
  /** 容器类名 */
20
20
  containerClass?: string;
21
+ /** 是否是移动风格弹出框 */
22
+ mobile: boolean;
23
+ /** 确定按钮 loading */
24
+ confirmLoading: boolean;
21
25
  };
22
26
  export default class DialogContainer extends BaseComponent<DialogContainerState> {
23
27
  #private;
@@ -28,8 +32,8 @@ export default class DialogContainer extends BaseComponent<DialogContainerState>
28
32
  static get observedAttributes(): string[] | null | undefined;
29
33
  protected attributeChanged(name: string, oldValue: string, newValue: string): void;
30
34
  render_v2(): {
31
- template?: string | HTMLElement | DocumentFragment;
32
- style?: string | string[];
35
+ style: string;
36
+ template: DocumentFragment;
33
37
  };
34
38
  render(): DocumentFragment;
35
39
  }
@@ -1,2 +1,2 @@
1
- import { t as e } from "../dialog_container-CcTyfoaD.js";
1
+ import { t as e } from "../dialog_container-BNPQ9n0V.js";
2
2
  export { e as default };
@@ -10,21 +10,43 @@ type DialogProps = {
10
10
  /** 是否可以通过点击 mask 关闭对话框 */
11
11
  maskClosable?: boolean;
12
12
  /** 是否显示右上角关闭按钮, 1 - 显示在框内, 2 - 显示在框角, 0 - 不显示 */
13
- showClose?: number;
13
+ close?: number;
14
14
  };
15
15
  /** 初始化对话框配置 */
16
16
  type DialogInitialParams = DialogProps & {
17
17
  /** dialog 节点 */
18
18
  el: HTMLDialogElement | string;
19
19
  /** 返回 true 表明手动调用 done 关闭 */
20
- onAction?: (action: string, done: () => void) => boolean;
20
+ onAction?: (action: string, done: () => void) => void;
21
21
  };
22
- declare const Dialog: (option?: DialogInitialParams) => {
23
- init: (option: DialogInitialParams) => void;
24
- open: () => void;
25
- close: () => void;
26
- destroy: () => void;
27
- setProp: (key: keyof DialogProps, value: DialogProps[keyof DialogProps]) => void;
28
- setProps: (props: DialogProps) => void;
29
- };
30
- export default Dialog;
22
+ export default class Dialog {
23
+ private $dialog;
24
+ private $container;
25
+ private config;
26
+ constructor(option?: DialogInitialParams);
27
+ private handleKeydown;
28
+ private handleClick;
29
+ private handleContainerAction;
30
+ /**
31
+ * 初始化对话框
32
+ * @param option 配置项
33
+ */
34
+ init(option: DialogInitialParams): void;
35
+ /**
36
+ * 打开对话框
37
+ */
38
+ open(): void;
39
+ /**
40
+ * 关闭对话框
41
+ */
42
+ close(): void;
43
+ destroy(): void;
44
+ setProp(key: keyof DialogProps, value: DialogProps[keyof DialogProps]): void;
45
+ setProps(props: DialogProps): void;
46
+ /**
47
+ * 设置确定按钮 loading 状态
48
+ * @param loading 是否 loading
49
+ */
50
+ setConfirmLoading(loading: boolean): void;
51
+ }
52
+ export {};
@@ -1,68 +1,68 @@
1
- import { $one as e, addClass as t, getAttr as n, hasClass as r, off as i, on as a, removeClass as o } from "ph-utils/dom";
1
+ import { $one as e, addClass as t, getAttr as n, hasClass as r, off as i, on as a, removeClass as o } from "ph-utils/browser";
2
2
  //#region src/components/dialog/index.ts
3
- var s = (s) => {
4
- let c, l, u;
5
- function d(e) {
6
- e.code === "Escape" && (e.preventDefault(), g());
3
+ var s = class {
4
+ $dialog;
5
+ $container;
6
+ config;
7
+ constructor(e) {
8
+ e != null && this.init(e);
7
9
  }
8
- function f(e) {
9
- c.isSameNode(e.target) && u && u.maskClosable && g();
10
- }
11
- function p(e) {
10
+ handleKeydown = (e) => {
11
+ e.code === "Escape" && (e.preventDefault(), this.close());
12
+ };
13
+ handleClick = (e) => {
14
+ this.$dialog.isSameNode(e.target) && this.config && this.config.maskClosable && this.close();
15
+ };
16
+ handleContainerAction = (e) => {
12
17
  let t = e.detail.action;
13
- u.onAction != null && u.onAction(t, g);
14
- }
15
- function m(i) {
16
- if (!u) {
18
+ t === "ok" && this.$container?.hasAttribute("confirm-loading") || this.config.onAction != null && this.config.onAction(t, () => this.close());
19
+ };
20
+ init(i) {
21
+ if (!this.config) {
17
22
  let o = {
18
23
  escClose: !0,
19
24
  verticalAlign: "top",
20
25
  maskClosable: !0,
21
- showClose: 1,
26
+ close: 1,
22
27
  ...i
23
28
  };
24
- if (c = e(i.el), c) {
25
- r(c, "l-dialog") || t(c, "l-dialog"), l = e("l-dialog-container", c), o.verticalAlign = n(c, "vertical-align") || "top", t(c, `l-dialog--vertical-${o.verticalAlign}`);
26
- let i = n(c, "translate") || o.translate;
27
- i && c.style.setProperty("--l-dialog-translate", `translate3d(${i})`);
28
- let s = n(c, "width") || o.width;
29
- s && c.style.setProperty("--l-dialog-width", s);
30
- let u = n(c, "show-close", 1);
31
- u === 2 && t(c, "l-dialog-close-outside"), l && l.setAttribute("show-close", `${u}`), o.showClose = u, a(c, "keydown", d), a(c, "click", f), l && a(l, "dialogAction", p);
29
+ if (this.$dialog = e(i.el), this.$dialog) {
30
+ r(this.$dialog, "l-dialog") || t(this.$dialog, "l-dialog"), this.$container = e("l-dialog-container", this.$dialog), o.verticalAlign = n(this.$dialog, "vertical-align") || "top", t(this.$dialog, `l-dialog--vertical-${o.verticalAlign}`);
31
+ let i = n(this.$dialog, "translate") || o.translate;
32
+ i && this.$dialog.style.setProperty("--l-dialog-translate", `translate3d(${i})`);
33
+ let s = n(this.$dialog, "width") || o.width;
34
+ s && this.$dialog.style.setProperty("--l-dialog-width", s);
35
+ let c = n(this.$dialog, "close", 1);
36
+ c === 2 && t(this.$dialog, "l-dialog-close-outside"), this.$container && this.$container.setAttribute("close", `${c}`), o.close = c, a(this.$dialog, "keydown", this.handleKeydown), a(this.$dialog, "click", this.handleClick), this.$container && a(this.$container, "dialogAction", this.handleContainerAction);
32
37
  }
33
- u = o;
38
+ this.config = o;
34
39
  }
35
40
  }
36
- function h() {
37
- c && (c.showModal(), t(c, "l-dialog--open"), t(document.body, "l-body--dialog-open"));
41
+ open() {
42
+ this.$dialog && (this.$dialog.showModal(), t(this.$dialog, "l-dialog--open"), t(document.body, "l-body--dialog-open"));
43
+ }
44
+ close() {
45
+ this.$dialog && r(this.$dialog, "l-dialog--open") && (a(this.$dialog, "transitionend", () => {
46
+ this.$dialog.close(), o(document.body, "l-body--dialog-open");
47
+ }, { once: !0 }), o(this.$dialog, "l-dialog--open"));
38
48
  }
39
- function g() {
40
- c && r(c, "l-dialog--open") && (a(c, "transitionend", () => {
41
- c.close(), o(document.body, "l-body--dialog-open");
42
- }, { once: !0 }), o(c, "l-dialog--open"));
49
+ destroy() {
50
+ this.$dialog &&= (this.close(), i(this.$dialog, "keydown", this.handleKeydown), i(this.$dialog, "click", this.handleClick), this.$container && i(this.$container, "dialogAction", this.handleContainerAction), this.$container = void 0, void 0);
43
51
  }
44
- function _() {
45
- c &&= (g(), i(c, "keydown", d), i(c, "click", f), l && i(l, "dialogAction", p), l = void 0, void 0);
52
+ setProp(e, t) {
53
+ if (this.config && (this.config[e] = t, this.$dialog)) {
54
+ if (e === "verticalAlign") {
55
+ let e = this.$dialog.className.replace(/l-dialog--vertical-\w+/g, () => `l-dialog--vertical-${t || "top"}`);
56
+ this.$dialog.className = e;
57
+ } else e === "translate" ? t ? this.$dialog.style.setProperty("--l-dialog-translate", `translate3d(${t})`) : this.$dialog.style.removeProperty("--l-dialog-translate") : e === "width" ? t ? this.$dialog.style.setProperty("--l-dialog-width", t) : this.$dialog.style.removeProperty("--l-dialog-width") : e === "close" && this.$container && this.$container.setAttribute("close", `${t}`);
58
+ }
46
59
  }
47
- function v(e, t) {
48
- if (u && (u[e] = t, c)) if (e === "verticalAlign") {
49
- let e = c.className.replace(/l-dialog--vertical-\w+/g, function() {
50
- return `l-dialog--vertical-${t || "top"}`;
51
- });
52
- c.className = e;
53
- } else e === "translate" ? t ? c.style.setProperty("--l-dialog-translate", `translate3d(${t})`) : c.style.removeProperty("--l-dialog-translate") : e === "width" ? t ? c.style.setProperty("--l-dialog-width", t) : c.style.removeProperty("--l-dialog-width") : e === "showClose" && l && l.setAttribute("show-close", `${t}`);
60
+ setProps(e) {
61
+ for (let t in e) this.setProp(t, e[t]);
54
62
  }
55
- function y(e) {
56
- for (let t in e) v(t, e[t]);
63
+ setConfirmLoading(e) {
64
+ this.$container && (e ? this.$container.setAttribute("confirm-loading", "") : this.$container.removeAttribute("confirm-loading"));
57
65
  }
58
- return s != null && m(s), {
59
- init: m,
60
- open: h,
61
- close: g,
62
- destroy: _,
63
- setProp: v,
64
- setProps: y
65
- };
66
66
  };
67
67
  //#endregion
68
68
  export { s as default };