easy-component-ui 3.0.5 → 3.0.6

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,19 +1,21 @@
1
- var h = Object.defineProperty;
2
- var r = (t) => {
1
+ var u = Object.defineProperty;
2
+ var d = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
- var u = (t, s, e) => s in t ? h(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
6
- var l = (t, s, e) => u(t, typeof s != "symbol" ? s + "" : s, e), o = (t, s, e) => s.has(t) || r("Cannot " + e);
7
- var n = (t, s, e) => (o(t, s, "read from private field"), e ? e.call(t) : s.get(t)), d = (t, s, e) => s.has(t) ? r("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), c = (t, s, e, a) => (o(t, s, "write to private field"), a ? a.call(t, e) : s.set(t, e), e);
8
- import { B as p } from "./Base.js";
9
- import { s as f } from "../css/ea-link.style.js";
10
- var i;
11
- class m extends p {
5
+ var p = (t, s, e) => s in t ? u(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
6
+ var c = (t, s, e) => p(t, typeof s != "symbol" ? s + "" : s, e), h = (t, s, e) => s.has(t) || d("Cannot " + e);
7
+ var a = (t, s, e) => (h(t, s, "read from private field"), e ? e.call(t) : s.get(t)), r = (t, s, e) => s.has(t) ? d("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), l = (t, s, e, o) => (h(t, s, "write to private field"), o ? o.call(t, e) : s.set(t, e), e);
8
+ import { B as m } from "./Base.js";
9
+ import { s as b } from "../css/ea-link.style.js";
10
+ var i, n;
11
+ class y extends m {
12
12
  constructor() {
13
13
  super();
14
14
  /** @type {HTMLAnchorElement} */
15
- d(this, i);
16
- /**
15
+ r(this, i);
16
+ /** @type {HTMLElement} */
17
+ r(this, n);
18
+ /**
17
19
  * @typedef {Object} LinkState
18
20
  * @property {string} type
19
21
  * @property {Boolean} disabled
@@ -22,46 +24,44 @@ class m extends p {
22
24
  * @property {string} icon
23
25
  */
24
26
  /** @type {LinkState} */
25
- l(this, "state", this.properties({
27
+ c(this, "state", this.properties({
26
28
  type: {
27
29
  type: ["normal", "primary", "success", "info", "warning", "danger"],
28
30
  default: "normal",
29
31
  observer: (e) => {
30
- n(this, i).className = this.updateContainerClasslist();
32
+ a(this, i).className = this.updateContainerClasslist();
31
33
  }
32
34
  },
33
35
  disabled: {
34
36
  type: Boolean,
35
37
  default: !1,
36
38
  observer: (e) => {
37
- n(this, i).className = this.updateContainerClasslist();
39
+ a(this, i).className = this.updateContainerClasslist();
38
40
  }
39
41
  },
40
42
  underline: {
41
43
  type: ["always", "hover", "never"],
42
44
  default: "",
43
45
  observer: (e) => {
44
- n(this, i).className = this.updateContainerClasslist();
46
+ a(this, i).className = this.updateContainerClasslist();
45
47
  }
46
48
  },
47
49
  href: {
48
50
  type: String,
49
51
  default: "",
50
52
  observer: (e) => {
51
- n(this, i).href = e;
53
+ a(this, i).href = e;
52
54
  }
53
55
  },
54
56
  icon: {
55
57
  type: String,
56
58
  default: "",
57
59
  observer: (e) => {
58
- if (!e) return;
59
- const a = document.createElement("ea-icon");
60
- a.icon = e, a.part = "icon", n(this, i).insertBefore(a, n(this, i).firstChild);
60
+ a(this, n).setAttribute("icon", e), a(this, i).className = this.updateContainerClasslist();
61
61
  }
62
62
  }
63
63
  }));
64
- this.stylesheet = f, this.$render();
64
+ this.stylesheet = b, this.$render();
65
65
  }
66
66
  static get observedAttributes() {
67
67
  return ["type", "disabled", "underline", "href", "icon"];
@@ -71,25 +71,31 @@ class m extends p {
71
71
  * @return {string} 属性值
72
72
  */
73
73
  updateContainerClasslist() {
74
- return this.computedClasslist("ea-link", {
75
- ["--" + this.type]: this.type,
76
- ["--underline-" + this.underline]: this.underline,
77
- "--disabled": this.disabled
78
- });
74
+ var e;
75
+ return this.computedClasslist(
76
+ "ea-link",
77
+ {
78
+ ["--" + this.type]: this.type,
79
+ ["--underline-" + this.underline]: this.underline,
80
+ "--disabled": this.disabled
81
+ },
82
+ { icon: (e = this.icon) == null ? void 0 : e.length }
83
+ );
79
84
  }
80
85
  $render() {
81
86
  this.shadowRoot.innerHTML = `
82
87
  <a class="ea-link" part="container" tabindex="-1">
88
+ <ea-icon class="ea-link__icon" part="icon"></ea-icon>
83
89
  <slot></slot>
84
90
  </a>
85
- `, c(this, i, this.shadowRoot.querySelector(".ea-link"));
91
+ `, l(this, i, this.shadowRoot.querySelector(".ea-link")), l(this, n, this.shadowRoot.querySelector(".ea-link__icon"));
86
92
  }
87
93
  connectedCallback() {
88
94
  super.connectedCallback();
89
95
  }
90
96
  }
91
- i = new WeakMap();
92
- window.customElements.get("ea-link") || window.customElements.define("ea-link", m);
97
+ i = new WeakMap(), n = new WeakMap();
98
+ window.customElements.get("ea-link") || window.customElements.define("ea-link", y);
93
99
  export {
94
- m as EaLink
100
+ y as EaLink
95
101
  };
@@ -1,29 +1,37 @@
1
- var p = Object.defineProperty;
2
- var r = (e) => {
1
+ var y = Object.defineProperty;
2
+ var p = (e) => {
3
3
  throw TypeError(e);
4
4
  };
5
- var d = (e, s, t) => s in e ? p(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
6
- var n = (e, s, t) => d(e, typeof s != "symbol" ? s + "" : s, t), h = (e, s, t) => s.has(e) || r("Cannot " + t);
7
- var a = (e, s, t) => (h(e, s, "read from private field"), t ? t.call(e) : s.get(e)), o = (e, s, t) => s.has(e) ? r("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), c = (e, s, t, l) => (h(e, s, "write to private field"), l ? l.call(e, t) : s.set(e, t), t);
8
- import { B as u } from "./Base.js";
9
- import { s as m } from "../css/ea-text.style.js";
10
- var i;
11
- class y extends u {
5
+ var f = (e, s, t) => s in e ? y(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
6
+ var u = (e, s, t) => f(e, typeof s != "symbol" ? s + "" : s, t), m = (e, s, t) => s.has(e) || p("Cannot " + t);
7
+ var i = (e, s, t) => (m(e, s, "read from private field"), t ? t.call(e) : s.get(e)), o = (e, s, t) => s.has(e) ? p("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), h = (e, s, t, l) => (m(e, s, "write to private field"), l ? l.call(e, t) : s.set(e, t), t);
8
+ import { B as w } from "./Base.js";
9
+ import { s as C } from "../css/ea-text.style.js";
10
+ var a, n, r;
11
+ class g extends w {
12
12
  constructor() {
13
13
  super();
14
14
  /** @type {HTMLElement} */
15
- o(this, i);
16
- /**
15
+ o(this, a);
16
+ o(this, n, {
17
+ isOriginalRendered: !1
18
+ });
19
+ o(this, r, new Promise((t) => {
20
+ h(this, n, new Proxy(i(this, n), {
21
+ set: (l, d, c) => (d === "isOriginalRendered" && c && t(!0), Reflect.set(l, d, c))
22
+ }));
23
+ }));
24
+ /**
17
25
  * @typedef {Object} State
18
26
  * @property {string} title - 标题
19
27
  * @property {string} type - 文本类型
20
28
  * @property {string} size - 文本大小
21
29
  * @property {boolean} truncated - 文本是否截断
22
30
  * @property {number} line-clamp - 截断的行数
23
- * @property {string} tag - 文本标签
31
+ * @property {string} tag - 文本标签
24
32
  */
25
33
  /** @type {State} */
26
- n(this, "state", this.properties({
34
+ u(this, "state", this.properties({
27
35
  title: {
28
36
  type: String,
29
37
  default: "",
@@ -33,39 +41,40 @@ class y extends u {
33
41
  type: {
34
42
  type: ["normal", "primary", "success", "warning", "danger", "info"],
35
43
  default: "normal",
36
- observer: (t) => {
37
- a(this, i).className = this.updateContainerClasslist();
44
+ observer: async (t) => {
45
+ await i(this, r), this.updateContainerClasslist();
38
46
  }
39
47
  },
40
48
  size: {
41
49
  type: ["large", "medium", "small"],
42
50
  default: "medium",
43
- observer: (t) => {
44
- a(this, i).className = this.updateContainerClasslist();
51
+ observer: async (t) => {
52
+ await i(this, r), this.updateContainerClasslist();
45
53
  }
46
54
  },
47
55
  truncated: {
48
56
  type: Boolean,
49
57
  default: !1,
50
- observer: (t) => {
51
- this.title = this.innerText || "", a(this, i).className = this.updateContainerClasslist();
58
+ observer: async (t) => {
59
+ await i(this, r), this.title = this.innerText || "", this.updateContainerClasslist();
52
60
  }
53
61
  },
54
62
  "line-clamp": {
55
63
  type: Number,
56
64
  default: 0,
57
- observer: (t) => {
58
- t > 0 && this.style.setProperty("--ea-text-line-clamp", t), a(this, i).className = this.updateContainerClasslist(), this.title = this.innerText || "";
65
+ observer: async (t) => {
66
+ await i(this, r), i(this, a).style.setProperty("--ea-text-line-clamp", t), this.title = this.innerText || "", this.updateContainerClasslist();
59
67
  }
60
68
  },
61
69
  tag: {
62
70
  type: String,
63
71
  default: "span",
64
72
  observer: (t) => {
73
+ this.$render(), this.hasAttribute("line-clamp") && i(this, a).style.setProperty("--ea-text-line-clamp", t), (this.hasAttribute("truncated") || this.hasAttribute("line-clamp")) && (this.title = this.innerText || ""), this.updateContainerClasslist();
65
74
  }
66
75
  }
67
76
  }));
68
- this.isMounted = !1, this.stylesheet = m;
77
+ this.stylesheet = C;
69
78
  }
70
79
  static get observedAttributes() {
71
80
  return ["title", "type", "size", "truncated", "line-clamp", "tag"];
@@ -75,29 +84,27 @@ class y extends u {
75
84
  * @return {string} 属性值
76
85
  */
77
86
  updateContainerClasslist() {
78
- return this.computedClasslist(
79
- "ea-text",
80
- {
81
- ["--" + this.type]: this.type,
82
- ["--" + this.size]: this.size,
83
- "--truncated": this.truncated,
84
- "--line-clamp": this["line-clamp"] > 0
85
- }
86
- );
87
+ const t = this.computedClasslist("ea-text", {
88
+ ["--" + this.type]: this.type,
89
+ ["--" + this.size]: this.size,
90
+ "--truncated": this.truncated,
91
+ "--line-clamp": this["line-clamp"] > 0
92
+ });
93
+ return i(this, a).className = t, t;
87
94
  }
88
95
  $render() {
89
96
  this.shadowRoot.innerHTML = `
90
- <${this.tag} class="ea-text" part="container">
91
- <slot></slot>
92
- </${this.tag}>
93
- `, c(this, i, this.shadowRoot.querySelector(".ea-text")), this.isMounted = !0;
97
+ <${this.tag} class="ea-text" part="container">
98
+ <slot></slot>
99
+ </${this.tag}>
100
+ `, h(this, a, this.shadowRoot.querySelector(".ea-text")), this.updateContainerClasslist(), i(this, n).isOriginalRendered = !0;
94
101
  }
95
102
  connectedCallback() {
96
- super.connectedCallback(), this.$render(), this.tag = this.tag, this.title = this.title, this.type = this.type, this.size = this.size, this.truncated = this.truncated, this["line-clamp"] = this["line-clamp"];
103
+ super.connectedCallback(), this.$render();
97
104
  }
98
105
  }
99
- i = new WeakMap();
100
- window.customElements.get("ea-text") || window.customElements.define("ea-text", y);
106
+ a = new WeakMap(), n = new WeakMap(), r = new WeakMap();
107
+ window.customElements.get("ea-text") || window.customElements.define("ea-text", g);
101
108
  export {
102
- y as EaText
109
+ g as EaText
103
110
  };