litos-ui 0.16.0 → 0.16.2

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.
@@ -1,10 +1,10 @@
1
- import { $$ as i, $one as o, addClass as n, removeClass as d } from "ph-utils/dom";
2
- import { parseAttrValue as h, initAttr as m } from "../utils/index.js";
1
+ import { $$ as i, $one as o, addClass as d, removeClass as h } from "ph-utils/dom";
2
+ import { parseAttrValue as a, initAttr as m } from "../utils/index.js";
3
3
  import f from "../base.js";
4
4
  import { emit as s, add as c, clear as p, remove as b } from "../utils/event.js";
5
- import { random as a } from "ph-utils";
5
+ import { random as n } from "ph-utils";
6
6
  const u = ':host{display:var(--l-form-item-display, flex);font-size:14px}.l-form-item__label{text-align:var(--l-form-label-align, right);display:inline-block;width:var(--l-form-label-width, auto);height:var(--l-form-control-height, 32px);line-height:var(--l-form-control-height, 32px);color:#606266;padding:0 10px 0 0;box-sizing:border-box}.l-form-item__label:empty{display:var(--l-form-label-empty-display, inline-block)}:host(.is-required) .l-form-item__label:before{content:"*";margin-right:4px;color:var(--l-warn-color, #f56c6c);vertical-align:middle}.l-form-item__content{flex:1;position:relative;display:flex;align-items:center}.l-form-item__error{font-size:12px;line-height:1;position:absolute;top:100%;left:0;color:var(--nt-error-color, #ed3f13);padding-top:3px}:host(.l-form-item--left){--l-form-label-align: left}:host(.l-form-item--top){--l-form-item-display: grid;--l-form-label-align: left;--l-form-label-empty-display: none;grid-template-columns:1fr}';
7
- class I extends f {
7
+ class k extends f {
8
8
  static baseName = "form-item";
9
9
  disabled = !1;
10
10
  sharedAttrs = ["disabled", "id", "name", "innerBlock"];
@@ -19,12 +19,12 @@ class I extends f {
19
19
  /** 自定义验证的正则 */
20
20
  pattern;
21
21
  name;
22
- innerBlock = !1;
23
22
  labelPosition = "right";
24
23
  formId;
24
+ innerBlock;
25
25
  #e;
26
26
  static get observedAttributes() {
27
- return ["error", "label", "disabled"];
27
+ return ["error", "label", "disabled", "inner-block"];
28
28
  }
29
29
  get error() {
30
30
  return this.#e;
@@ -38,12 +38,12 @@ class I extends f {
38
38
  else if (e === "label")
39
39
  this.label = r, this._updateLabel();
40
40
  else if (e === "disabled") {
41
- const l = h(r, !1, e);
41
+ const l = a(r, !1, e);
42
42
  l !== this.disabled && (s(this.id, "attributeChanged", e, l, this.id), this.disabled = l);
43
- }
43
+ } else e === "inner-block" && (this.innerBlock = a(r, !1, e));
44
44
  }
45
45
  connectedCallback() {
46
- if (m(this), this.id == null && (this.id = `l-fi${a(3)}-${a(6)}`), this.loadStyleText([u]), super.connectedCallback(), this.formId = this._getFormId(), this.name && this.formId) {
46
+ if (m(this), this.id == null && (this.id = `l-fi${n(3)}-${n(6)}`), this.loadStyleText([u]), super.connectedCallback(), this.formId = this._getFormId(), this.name && this.formId) {
47
47
  let e = this.verify?.split("|") || [];
48
48
  this.pattern && e.push(new RegExp(this.pattern));
49
49
  const t = {
@@ -75,9 +75,7 @@ class I extends f {
75
75
  })
76
76
  );
77
77
  const t = i("div", { class: "l-form-item__content" }), r = i("slot");
78
- return t.appendChild(r), this.error && t.appendChild(
79
- i("div", { class: "l-form-item__error", textContent: this.error })
80
- ), e.appendChild(t), e;
78
+ return t.appendChild(r), this.error && t.appendChild(i("div", { class: "l-form-item__error", textContent: this.error })), e.appendChild(t), e;
81
79
  }
82
80
  _validateChange = (e, t) => {
83
81
  const r = e === !0 ? void 0 : e[this.name];
@@ -93,7 +91,7 @@ class I extends f {
93
91
  const t = o(".l-form-item__content", this.root);
94
92
  t && t.appendChild(e);
95
93
  }
96
- this.error ? n(this, "is-error") : d(this, "is-error");
94
+ this.error ? d(this, "is-error") : h(this, "is-error");
97
95
  }
98
96
  _updateLabel() {
99
97
  if (!this.rendered) return;
@@ -115,5 +113,5 @@ class I extends f {
115
113
  }
116
114
  }
117
115
  export {
118
- I as default
116
+ k as default
119
117
  };
package/lib/form/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { $one as n, formatClass as o, formatStyle as f } from "ph-utils/dom";
2
2
  import m from "../base.js";
3
- import { parseAttrValue as c, initAttr as u } from "../utils/index.js";
3
+ import { initAttr as c, parseAttrValue as u } from "../utils/index.js";
4
4
  import { random as d } from "ph-utils";
5
5
  import { emit as l, add as h, clear as v } from "../utils/event.js";
6
6
  import p from "ph-utils/validator";
@@ -25,7 +25,7 @@ class $ extends m {
25
25
  }
26
26
  attributeChangedCallback(t, e, i) {
27
27
  if (t === "disabled") {
28
- const a = c(i, !1, t);
28
+ const a = u(i, !1, t);
29
29
  a !== this.disabled && (l(this.id, "attributeChanged", t, a, this.id), this.disabled = a);
30
30
  } else if (t === "label-position") {
31
31
  const a = n("form", this.root);
@@ -37,7 +37,7 @@ class $ extends m {
37
37
  }
38
38
  }
39
39
  connectedCallback() {
40
- u(this), this.id || (this.id = `l-f${d(3)}-${d(6)}`), this.loadStyleText([b]), super.connectedCallback(), h(this.id, "ruleChange", this.ruleChange), h(this.id, "valueChange", this._valueChange);
40
+ c(this), this.id || (this.id = `l-f${d(3)}-${d(6)}`), this.loadStyleText([b]), super.connectedCallback(), h(this.id, "ruleChange", this.ruleChange), h(this.id, "valueChange", this._valueChange);
41
41
  }
42
42
  disconnectedCallback() {
43
43
  v(this.id), this.validator = void 0;
@@ -1,9 +1,9 @@
1
- import { addClass as h, removeClass as u, $one as d, on as o, formatStyle as c, off as p, $ as f, $$ as n } from "ph-utils/dom";
2
- import { initAttr as g, parseAttrValue as a } from "../utils/index.js";
3
- import m from "../form/form_inner.js";
4
- import { add as b, remove as x } from "../utils/event.js";
5
- import { i as v } from "../index-DvcllHRh.js";
6
- class I extends m {
1
+ import { addClass as d, removeClass as p, $one as f, on as c, formatStyle as x, off as g, $ as m, $$ as a } from "ph-utils/dom";
2
+ import { initAttr as C, parseAttrValue as o } from "../utils/index.js";
3
+ import v from "../form/form_inner.js";
4
+ import { add as $, remove as _ } from "../utils/event.js";
5
+ import { i as w } from "../index-DvcllHRh.js";
6
+ class j extends v {
7
7
  static baseName = "input";
8
8
  /** 原生 input 的 type */
9
9
  type = "text";
@@ -33,54 +33,42 @@ class I extends m {
33
33
  return this.#t;
34
34
  }
35
35
  set clearable(t) {
36
- this.#t = t, t ? h(this, "l-input--clearable") : u(this, "l-input--clearable");
36
+ this.#t = t, t ? d(this, "l-input--clearable") : p(this, "l-input--clearable");
37
37
  }
38
38
  static get observedAttributes() {
39
- return [
40
- "disabled",
41
- "value",
42
- "name",
43
- "error",
44
- "clearable",
45
- "maxlength",
46
- "inputmode"
47
- ];
39
+ return ["disabled", "value", "name", "error", "clearable", "maxlength", "inputmode"];
48
40
  }
49
41
  connectedCallback() {
50
- g(this), this.loadStyleText([v]), super.connectedCallback(), this.$inner = d(".l-input__inner", this.root), o(this.$inner, "input", this._input), o(this.$inner, "change", this.#s), this.style.cssText = c(this._getStyleObj()) + this.getAttr("style", ""), this.error && h(this, "is-error"), this.getName() && this.formAttrs.id && b(this.formAttrs.id, "validateChange", this._validateChange);
42
+ C(this), this.loadStyleText([w]), super.connectedCallback(), this.$inner = f(".l-input__inner", this.root), c(this.$inner, "input", this._input), c(this.$inner, "change", this.#s), this.style.cssText = x(this._getStyleObj()) + this.getAttr("style", ""), this.error && d(this, "is-error"), this.getName() && this.formAttrs.id && $(this.formAttrs.id, "validateChange", this._validateChange);
51
43
  }
52
44
  disconnectedCallback() {
53
- super.disconnectedCallback(), this.formAttrs.id && x(this.formAttrs.id, "validateChange", this._validateChange), p(this.$inner, "input", this._input);
45
+ super.disconnectedCallback(), this.formAttrs.id && _(this.formAttrs.id, "validateChange", this._validateChange), g(this.$inner, "input", this._input);
54
46
  }
55
- attributeChange(t, s, e) {
56
- const r = a(
57
- e,
58
- this[t],
59
- t
60
- );
61
- if (r !== this[t] && (this[t] = r), t === "error") {
62
- const i = a(e, !1, t);
47
+ attributeChange(t, l, e) {
48
+ const s = o(e, this[t], t);
49
+ if (s !== this[t] && (this[t] = s), t === "error") {
50
+ const i = o(e, !1, t);
63
51
  i !== this.error && (this.error = i, this._updateError());
64
52
  } else if (t === "clearable") {
65
- const i = a(e, !1, t);
53
+ const i = o(e, !1, t);
66
54
  i !== this.clearable && (this.clearable = i);
67
55
  } else if (t === "maxlength") {
68
- const i = a(e, this.maxlength);
56
+ const i = o(e, this.maxlength);
69
57
  i !== this.maxlength && (this.maxlength = i);
70
58
  }
71
59
  }
72
60
  render() {
73
61
  const t = document.createDocumentFragment();
74
- if (f('[slot="prefix"]', this).length > 0) {
75
- const i = n("slot", {
62
+ if (m('[slot="prefix"]', this).length > 0) {
63
+ const i = a("slot", {
76
64
  name: "prefix"
77
- }), l = n("span", {
65
+ }), r = a("span", {
78
66
  class: "l-input__prefix",
79
67
  part: "prefix"
80
68
  });
81
- l.appendChild(i), t.appendChild(l);
69
+ r.appendChild(i), t.appendChild(r);
82
70
  }
83
- const e = n("input", {
71
+ const e = a("input", {
84
72
  class: "l-input__inner",
85
73
  value: this.value,
86
74
  name: this.getName() || "",
@@ -89,14 +77,14 @@ class I extends m {
89
77
  type: this.type,
90
78
  inputmode: this.inputmode
91
79
  });
92
- if (this.isDisabled() && (e.disabled = !0), this.maxlength && e.setAttribute("maxlength", this.maxlength), this.minlength && e.setAttribute("minlength", this.minlength), t.appendChild(e), f('[slot="suffix"]', this).length > 0) {
93
- const i = n("slot", {
80
+ if (this.isDisabled() && (e.disabled = !0), this.maxlength && e.setAttribute("maxlength", this.maxlength), this.minlength && e.setAttribute("minlength", this.minlength), t.appendChild(e), m('[slot="suffix"]', this).length > 0) {
81
+ const i = a("slot", {
94
82
  name: "suffix"
95
- }), l = n("span", {
83
+ }), r = a("span", {
96
84
  class: "l-input__suffix",
97
85
  part: "suffix"
98
86
  });
99
- l.appendChild(i), t.appendChild(l);
87
+ r.appendChild(i), t.appendChild(r);
100
88
  }
101
89
  return t;
102
90
  }
@@ -108,31 +96,34 @@ class I extends m {
108
96
  this.parser = t;
109
97
  }
110
98
  _input = (t) => {
111
- const s = t.target;
112
- let e = s.value;
99
+ const l = t.target;
100
+ let e = l.value, s = "";
113
101
  if (this.allowInput != null) {
114
- let r = this.allowInput.indexOf("."), i = r === -1 ? r : parseInt(this.allowInput.substring(r + 1));
115
- e = this._numberInputParse(e, {
102
+ let u = this.allowInput.indexOf("."), b = u === -1 ? u : parseInt(this.allowInput.substring(u + 1));
103
+ s = this._numberInputParse(e, {
116
104
  integer: this.allowInput.includes("integer"),
117
105
  negative: this.allowInput.startsWith("-"),
118
- precition: i
119
- }), e = String(e);
106
+ precision: b
107
+ }), s = String(s);
120
108
  }
121
- this.parser != null && (e = this.parser(e)), s.value = e, this.setValue(e), this.#e();
109
+ this.parser != null && (s = this.parser(s));
110
+ const i = l.selectionStart || 0, r = l.selectionEnd;
111
+ let n = i, h = r;
112
+ s.length < e.length ? (n = Math.max(0, i - (e.length - s.length)), h = n) : s.length > e.length ? (n = Math.min(s.length, i + (s.length - e.length)), h = n) : (n = Math.min(s.length, i), h = n), l.value = s, l.setSelectionRange(n, h), this.setValue(s), this.#e();
122
113
  };
123
114
  #e() {
124
115
  if (this.clearable) {
125
- let t = d(".l-clearable", this.root);
116
+ let t = f(".l-clearable", this.root);
126
117
  if (this.value.length > 0) {
127
118
  if (t == null) {
128
- t = n("span", {
119
+ t = a("span", {
129
120
  class: "l-input__suffix l-clearable"
130
121
  });
131
- const s = n("l-close-filled-icon");
132
- t.appendChild(s), this.root.appendChild(t), o(t, "click", this.#i);
122
+ const l = a("l-close-filled-icon");
123
+ t.appendChild(l), this.root.appendChild(t), c(t, "click", this.#i);
133
124
  }
134
125
  } else
135
- t && (p(t, "click", this.#i), t.remove());
126
+ t && (g(t, "click", this.#i), t.remove());
136
127
  }
137
128
  }
138
129
  #i = () => {
@@ -146,18 +137,23 @@ class I extends m {
146
137
  disabledChange() {
147
138
  this.isDisabled() ? this.classList.add("is-disabled") : this.classList.remove("is-disabled"), this.$inner && (this.$inner.disabled = this.isDisabled());
148
139
  }
149
- _numberInputParse(t, s) {
150
- let e = t, r = s.negative ? "-?" : "";
151
- if (s.integer) {
152
- const l = e.match(new RegExp(`^(${r}\\d*)`));
153
- return l != null ? l[1] : e.substring(0, e.length - 1);
140
+ _numberInputParse(t, l) {
141
+ let e = t.trim();
142
+ if (e === "") return "";
143
+ let s = e.startsWith("-");
144
+ if (s && (l.negative || (e = e.slice(1), s = !1)), l.integer)
145
+ e = e.replace(/[^\d]/g, "");
146
+ else {
147
+ const i = e.split(".");
148
+ if (i.length > 2)
149
+ e = i[0] + "." + i.slice(1).join("").substring(0, l.precision);
150
+ else if (i.length === 2) {
151
+ const r = i[0].replace(/[^\d]/g, ""), n = i[1].replace(/[^\d]/g, "").substring(0, l.precision);
152
+ e = `${r}.${n}`;
153
+ } else
154
+ e = e.replace(/[^\d]/g, "");
154
155
  }
155
- const i = e.match(
156
- new RegExp(
157
- `(${r}\\d+\\.\\d{0,${s.precition}})|(${r}\\d*)`
158
- )
159
- );
160
- return i != null ? e = i[1] || i[2] : e = "", i != null ? i[1] || i[2] : "";
156
+ return e.length > 1 && (e = e.replace(/^0+(\d)/, "$1")), s ? "-" + e : e;
161
157
  }
162
158
  _getStyleObj() {
163
159
  const t = {};
@@ -167,26 +163,26 @@ class I extends m {
167
163
  return this.block === !0 || this.formItemAttrs.innerBlock === !0 || this.formAttrs.innerBlock === !0;
168
164
  }
169
165
  _updateError() {
170
- this.error ? h(this, "is-error") : u(this, "is-error");
166
+ this.error ? d(this, "is-error") : p(this, "is-error");
171
167
  }
172
- _validateChange = (t, s) => {
168
+ _validateChange = (t, l) => {
173
169
  const e = this.getName();
174
170
  if (e) {
175
- const r = t === !0 ? !1 : t[e] != null;
176
- (s == null || s === e && this.error != r) && (this.error = r, this._updateError()), Object.keys(t)[0] === e && this.focus();
171
+ const s = t === !0 ? !1 : t[e] != null;
172
+ (l == null || l === e && this.error != s) && (this.error = s, this._updateError()), Object.keys(t)[0] === e && this.focus();
177
173
  }
178
174
  };
179
175
  #s = (t) => {
180
- const s = t.target;
176
+ const l = t.target;
181
177
  this.dispatchEvent(
182
178
  new CustomEvent("change", {
183
179
  bubbles: !0,
184
180
  composed: !0,
185
- detail: { value: s.value }
181
+ detail: { value: l.value }
186
182
  })
187
183
  );
188
184
  };
189
185
  }
190
186
  export {
191
- I as default
187
+ j as default
192
188
  };
@@ -21,11 +21,13 @@ declare class LoadingInstance {
21
21
  /** 加载容器 */
22
22
  el: HTMLElement;
23
23
  option: Required<Omit<LoadingInstanceParams, "to" | "zindex">>;
24
+ isLoading: boolean;
24
25
  constructor(option?: LoadingInstanceParams);
25
26
  /** 显示进度条 */
26
27
  show(): void;
27
28
  /** 隐藏进度条 */
28
29
  hide(): void;
30
+ destroy(): void;
29
31
  }
30
32
  declare const _default: {
31
33
  /** 创建并显示进度条 */
@@ -1,70 +1,59 @@
1
- import { $ as u, iterate as g, $one as c, addClass as d, hasClass as m, $$ as o } from "ph-utils/dom";
1
+ import { $ as c, iterate as d, $one as r, addClass as g, hasClass as m, $$ as o } from "ph-utils/dom";
2
2
  function f(t, e) {
3
3
  if (m(t, "l-loading")) return;
4
- let n;
5
- if (e.fullscreen && c("#l-loading") != null)
4
+ let l;
5
+ if (e.fullscreen && r("#l-loading") != null)
6
6
  return;
7
- d(t, "l-loading"), (e.mask === 1 || e.mask === 2 && e.shape === "circle") && (n = o("div", {
7
+ const s = ["l-loading"];
8
+ (e.mask === 1 || e.mask === 2 && e.shape === "circle") && (l = o("div", {
8
9
  class: "l-loading-mask",
9
10
  style: {
10
11
  "background-color": e.background,
11
12
  "--l-loading-zindex": e.zindex
12
13
  }
13
- }), t.appendChild(n));
14
- const l = o("div", {
14
+ }), t.appendChild(l));
15
+ const n = o("div", {
15
16
  class: `l-loading-spinner l-loading--${e.shape}`,
16
17
  style: {
17
18
  "--l-loading-color": e.color
18
19
  }
19
20
  });
20
21
  if (e.shape === "bar") {
21
- const s = o("div", { class: "l-loading-progress" });
22
- l.style.setProperty(
23
- "top",
24
- `-${getComputedStyle(t).borderTopWidth}`
25
- ), l.appendChild(s);
22
+ const i = o("div", { class: "l-loading-progress" });
23
+ n.appendChild(i);
26
24
  } else if (e.shape === "circle") {
27
- const s = document.createElementNS(
28
- "http://www.w3.org/2000/svg",
29
- "svg"
30
- );
31
- s.setAttribute("viewBox", "0 0 50 50"), s.classList.add("circle");
32
- const a = document.createElementNS(
33
- "http://www.w3.org/2000/svg",
34
- "circle"
35
- );
36
- if (a.classList.add("path"), a.setAttribute("cx", "25"), a.setAttribute("cy", "25"), a.setAttribute("r", "23"), a.setAttribute("fill", "none"), s.appendChild(a), l.appendChild(s), e.text) {
37
- const i = o("p", {
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", {
38
30
  class: "l-loading-text",
39
31
  textContent: e.text
40
32
  });
41
- l.appendChild(i);
33
+ n.appendChild(p);
42
34
  }
43
35
  }
44
- if (t.appendChild(l), e.fullscreen) {
45
- const s = ["l-loading-fullscreen"];
46
- e.lock && s.push("l-loading-lock"), t.classList.add(...s), l.id = "l-loading";
47
- }
48
- requestAnimationFrame(() => {
49
- n && (n.style.opacity = "1"), l.style.opacity = "1", d(l, "l-loading-bar--start");
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");
50
38
  });
51
39
  }
52
- function p(t, e) {
53
- const n = t.tagName === "BODY" ? "body" : ".l-loading", l = c(`${n} > .l-loading-mask`, t), s = c(`${n} > .l-loading-spinner`, t);
54
- if (!s) return;
55
- function a() {
56
- l && l.remove(), s.remove();
57
- const i = ["l-loading"];
58
- t.tagName === "BODY" && i.push("l-loading-fullscreen", "l-loading-lock"), t.classList.remove(...i);
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);
59
47
  }
60
- s.addEventListener("transitionend", a, { once: !0 }), requestAnimationFrame(() => {
61
- l && (l.style.opacity = "0"), d(s, "l-loading-bar--finish"), s.style.opacity = "0";
48
+ n.addEventListener("transitionend", i, { once: !0 }), requestAnimationFrame(() => {
49
+ s && (s.style.opacity = "0"), g(n, "l-loading-bar--finish"), n.style.opacity = "0";
62
50
  });
63
51
  }
64
- class h {
52
+ class b {
65
53
  /** 加载容器 */
66
54
  el;
67
55
  option;
56
+ isLoading = !1;
68
57
  constructor(e) {
69
58
  this.option = {
70
59
  fullscreen: !0,
@@ -76,45 +65,45 @@ class h {
76
65
  mask: 2,
77
66
  ...e
78
67
  };
79
- const n = (e || {}).to;
80
- let l = null;
81
- n != null && (typeof n == "string" ? l = document.querySelector(n) : l = n), (l == null || this.option.fullscreen) && (l = document.body), this.el = l, this.show();
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();
82
71
  }
83
72
  /** 显示进度条 */
84
73
  show() {
85
- f(this.el, this.option);
74
+ this.isLoading = !0, f(this.el, this.option);
86
75
  }
87
76
  /** 隐藏进度条 */
88
77
  hide() {
89
- p(this.el, this.option);
78
+ this.isLoading = !1, h(this.el, this.option);
79
+ }
80
+ destroy() {
81
+ this.hide(), this.el = void 0;
90
82
  }
91
83
  }
92
- function r(t) {
93
- const e = t.getAttribute("l-loading-text"), n = t.getAttribute("l-loading-lock");
84
+ function u(t) {
85
+ const e = t.getAttribute("l-loading-text"), l = t.getAttribute("l-loading-lock");
94
86
  return {
95
87
  background: t.getAttribute("l-loading-background"),
96
88
  text: e ? e === "0" || e === "false" ? void 0 : e : "加载中……",
97
89
  fullscreen: t.hasAttribute("l-loading-fullscreen"),
98
- lock: !(n === "0" || n === "false"),
90
+ lock: !(l === "0" || l === "false"),
99
91
  mask: Number(t.hasAttribute("l-loading-mask") || 2),
100
92
  shape: t.getAttribute("l-loading-shape") || "circle",
101
93
  color: t.getAttribute("l-loading-color")
102
94
  };
103
95
  }
104
- const $ = {
96
+ const k = {
105
97
  /** 创建并显示进度条 */
106
98
  create(t) {
107
- return new h(t);
99
+ return new b(t);
108
100
  },
109
101
  /** 根据指令参数初始化进度条 */
110
102
  init(t) {
111
- const e = t ? `[l-loading="${t}"]` : "[l-loading]", n = u(e);
112
- g(n, (l) => {
113
- const s = r(l);
114
- f(
115
- s.fullscreen ? document.body : l,
116
- r(l)
117
- );
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);
118
107
  });
119
108
  },
120
109
  /**
@@ -126,16 +115,13 @@ const $ = {
126
115
  * @param id 可选参数,指定特定的加载元素 l-loading 对应的值,如果提供,则只关闭匹配该 id 的元素
127
116
  */
128
117
  close(t) {
129
- const e = t ? `[l-loading="${t}"]` : "[l-loading]", n = u(e);
130
- g(n, (l) => {
131
- const s = r(l);
132
- p(
133
- s.fullscreen ? document.body : l,
134
- r(l)
135
- );
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);
136
122
  });
137
123
  }
138
124
  };
139
125
  export {
140
- $ as default
126
+ k as default
141
127
  };
@@ -1,9 +1,9 @@
1
1
  import { regist as g, useId as y } from "../utils/index.js";
2
2
  import { transition as m } from "ph-utils/dom";
3
- import p from "../icon/close_filled.js";
4
- import h from "../icon/success.js";
5
- import $ from "../icon/warn.js";
6
- import x from "../icon/info.js";
3
+ import h from "../icon/close_filled.js";
4
+ import p from "../icon/success.js";
5
+ import x from "../icon/warn.js";
6
+ import $ from "../icon/info.js";
7
7
  const r = [], d = [
8
8
  ["opacity", "0", "0.3s"],
9
9
  ["transform", "translate3d(-50%, -100%, 0)", "0.3s"]
@@ -20,8 +20,8 @@ function u(e) {
20
20
  const i = 15 + s.offsetHeight, n = r.length;
21
21
  if (n !== 0)
22
22
  for (let o = t; o < n; o++) {
23
- const a = r[o], f = parseInt(a.style.top, 10) - i;
24
- a.style.setProperty("top", `${f}px`);
23
+ const f = r[o], a = parseInt(f.style.top, 10) - i;
24
+ f.style.setProperty("top", `${a}px`);
25
25
  }
26
26
  }
27
27
  function v(e) {
@@ -29,7 +29,7 @@ function v(e) {
29
29
  t.id = e.id;
30
30
  const s = e.type || "info";
31
31
  let i = `l-message l-message-${s}`;
32
- e.customClass && (i += " " + e.customClass), t.className = i, t.style.setProperty("top", `${e.offset}px`), t.style.setProperty("z-index", `${e.zindex || 1e3}`), e.width && t.style.setProperty("width", e.width);
32
+ e.customClass && (i += " " + e.customClass), t.className = i, t.style.setProperty("top", `${e.offset}px`), e.zindex && t.style.setProperty("z-index", `${e.zindex}`), e.width && t.style.setProperty("width", e.width);
33
33
  let n = s;
34
34
  return n === "error" && (n = "close-filled"), t.innerHTML = [
35
35
  '<div class="l-message-container">',
@@ -39,8 +39,8 @@ function v(e) {
39
39
  ].join(""), t;
40
40
  }
41
41
  const w = ((e) => {
42
- l && (g([p, h, $, x]), l = !1);
43
- const t = r.reduce((a, f) => a + f.offsetHeight + 15, 15), s = y(), i = typeof e == "string" ? { message: e } : e;
42
+ l && (g([h, p, x, $]), l = !1);
43
+ const t = r.reduce((f, a) => f + a.offsetHeight + 15, 15), s = y(), i = typeof e == "string" ? { message: e } : e;
44
44
  i.id = s, i.offset = t;
45
45
  const n = v(i);
46
46
  r.push(n), document.body.appendChild(n), m(n, d, "enter");
@@ -2,18 +2,12 @@ import BaseComponent from "../base";
2
2
  export default class Modal extends BaseComponent {
3
3
  #private;
4
4
  static baseName: string;
5
- /** 是否显示对话框 */
6
- show: boolean;
7
5
  /** 关闭时销毁 Modal 里的子元素 */
8
6
  destroyOnClose: boolean;
9
7
  /** 点击蒙层是否允许关闭 */
10
8
  maskClosable: boolean;
11
9
  /** 是否展示遮罩 */
12
10
  mask: boolean;
13
- /** 标题 */
14
- title: string;
15
- /** 是否展示底部 */
16
- footer: boolean;
17
11
  /** 是否显示取消按钮 */
18
12
  cancel: boolean;
19
13
  /** 取消按钮文本 */
@@ -32,6 +26,7 @@ export default class Modal extends BaseComponent {
32
26
  mobile: boolean;
33
27
  /** 设置 Modal 的 z-index */
34
28
  zIndex?: string;
29
+ _bodyOverflow: string;
35
30
  static get observedAttributes(): string[];
36
31
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
37
32
  connectedCallback(): void;