litos-ui 0.7.0 → 0.9.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 (81) hide show
  1. package/lib/{animation-QfX4RtqD.js → animation-DttknHkX.js} +2 -2
  2. package/lib/base.d.ts +1 -3
  3. package/lib/base.js +26 -58
  4. package/lib/button/index.js +58 -62
  5. package/lib/color_picker/index.js +18 -20
  6. package/lib/form/form_events.js +15 -17
  7. package/lib/form/form_inner.js +43 -47
  8. package/lib/form/form_item.d.ts +1 -1
  9. package/lib/form/form_item.js +49 -53
  10. package/lib/form/index.d.ts +1 -1
  11. package/lib/form/index.js +58 -61
  12. package/lib/icon/arrow_down.js +4 -7
  13. package/lib/icon/arrow_left.js +4 -7
  14. package/lib/icon/arrow_right.js +4 -7
  15. package/lib/icon/arrow_up.js +4 -7
  16. package/lib/icon/base.js +21 -24
  17. package/lib/icon/caret_bottom.js +4 -7
  18. package/lib/icon/caret_top.js +4 -7
  19. package/lib/icon/font_icon.js +13 -17
  20. package/lib/icon/info.js +4 -7
  21. package/lib/icon/loading.js +4 -7
  22. package/lib/icon/mask_close.js +4 -7
  23. package/lib/icon/moon.js +4 -7
  24. package/lib/icon/reduction.js +4 -7
  25. package/lib/icon/refresh_left.js +4 -7
  26. package/lib/icon/refresh_right.js +4 -7
  27. package/lib/icon/search.js +4 -7
  28. package/lib/icon/sort.js +4 -7
  29. package/lib/icon/success.js +4 -7
  30. package/lib/icon/sun.js +4 -7
  31. package/lib/icon/theme_default.js +4 -7
  32. package/lib/icon/warn.js +4 -7
  33. package/lib/{index-B_9rPBWp.js → index-391POYEJ.js} +1 -1
  34. package/lib/index.d.ts +2 -10
  35. package/lib/index.js +62 -70
  36. package/lib/input/index.d.ts +1 -1
  37. package/lib/input/index.js +66 -70
  38. package/lib/list/index.d.ts +1 -1
  39. package/lib/list/index.js +26 -30
  40. package/lib/litos-ui.css +1 -1
  41. package/lib/litos-ui.min.js +1 -1
  42. package/lib/message/index.js +35 -33
  43. package/lib/polygon/index.d.ts +1 -1
  44. package/lib/polygon/index.js +14 -17
  45. package/lib/popconfirm/index.js +11 -17
  46. package/lib/popover/index.js +115 -120
  47. package/lib/radio/index.d.ts +2 -2
  48. package/lib/radio/index.js +65 -68
  49. package/lib/select_ori/index.d.ts +1 -1
  50. package/lib/select_ori/index.js +25 -29
  51. package/lib/switch/index.js +39 -48
  52. package/lib/tabbar/index.js +115 -123
  53. package/lib/theme/index.js +71 -74
  54. package/lib/theme/theme_color.js +17 -27
  55. package/lib/utils/event.js +16 -18
  56. package/lib/utils/index.js +48 -51
  57. package/lib/utils/transition.js +24 -34
  58. package/package.json +4 -1
  59. package/lib/browser.d.ts +0 -17
  60. package/lib/button/regist.d.ts +0 -2
  61. package/lib/button/regist.js +0 -7
  62. package/lib/form/types.js +0 -1
  63. package/lib/index-116dRdDj.js +0 -4
  64. package/lib/index-BUyxD_nH.js +0 -4
  65. package/lib/index-BeOxuMd4.js +0 -4
  66. package/lib/index-Bl8lRTJd.js +0 -4
  67. package/lib/index-BxlGVrX3.js +0 -4
  68. package/lib/index-C2D4YsFw.js +0 -4
  69. package/lib/index-C98Kx857.js +0 -4
  70. package/lib/index-CCcVpk6U.js +0 -4
  71. package/lib/index-CMz7GCCH.js +0 -4
  72. package/lib/index-D-Ikkdx0.js +0 -4
  73. package/lib/index-DJ70Xyma.js +0 -4
  74. package/lib/index-DKvzJmsR.js +0 -4
  75. package/lib/index-oNjb_IVt.js +0 -4
  76. package/lib/popconfirm/regist.d.ts +0 -2
  77. package/lib/popconfirm/regist.js +0 -7
  78. package/lib/popover/regist.d.ts +0 -2
  79. package/lib/popover/regist.js +0 -7
  80. package/lib/tabbar/regist.d.ts +0 -2
  81. package/lib/tabbar/regist.js +0 -7
@@ -1,4 +1,4 @@
1
- const t = "@keyframes l-rotate-frame{0%{transform:rotate3d(0,0,1,0)}to{transform:rotate3d(0,0,1,360deg)}}.l-rotate-anim{animation:l-rotate-frame 1.5s infinite linear}";
1
+ const a = "@keyframes l-rotate-frame{0%{transform:rotate3d(0,0,1,0)}to{transform:rotate3d(0,0,1,360deg)}}.l-rotate-anim{animation:l-rotate-frame 1.5s infinite linear}";
2
2
  export {
3
- t as default
3
+ a
4
4
  };
package/lib/base.d.ts CHANGED
@@ -12,9 +12,7 @@ export default class BaseComponent extends HTMLElement {
12
12
  get root(): ShadowRoot | HTMLElement;
13
13
  createStyle(text: string): void;
14
14
  createLink(href: string): void;
15
- loadStyle(styleNames: string[]): void;
16
- loadExternalStyle(styleNames: string[]): void;
17
- loadStyleText(styleText: string): void;
15
+ loadStyleText(styleText: string | string[]): void;
18
16
  /**
19
17
  * 获取属性值
20
18
  * @param key 属性名称
package/lib/base.js CHANGED
@@ -1,26 +1,10 @@
1
- var d = Object.defineProperty;
2
- var p = (o, n, e) => n in o ? d(o, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[n] = e;
3
- var l = (o, n, e) => p(o, typeof n != "symbol" ? n + "" : n, e);
4
- import { getAttr as c } from "ph-utils/dom";
5
- const a = (o, n, e) => {
6
- const t = o[n];
7
- return t ? typeof t == "function" ? t() : Promise.resolve(t) : new Promise((i, s) => {
8
- (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
9
- s.bind(
10
- null,
11
- new Error(
12
- "Unknown variable dynamic import: " + n + (n.split("/").length !== e ? ". Note that variables only represent file names one level deep." : "")
13
- )
14
- )
15
- );
16
- });
17
- };
18
- class m extends HTMLElement {
19
- constructor(e = !0) {
20
- super();
21
- /** 组件是否渲染完成, 是否已经调用 connectedCallback */
22
- l(this, "rendered", !1);
23
- e && this.attachShadow({ mode: "open" });
1
+ import { getAttr as r } from "ph-utils/dom";
2
+ class a extends HTMLElement {
3
+ static baseName = "base-component";
4
+ /** 组件是否渲染完成, 是否已经调用 connectedCallback */
5
+ rendered = !1;
6
+ constructor(t = !0) {
7
+ super(), t && this.attachShadow({ mode: "open" });
24
8
  }
25
9
  /**
26
10
  * 返回一个数组,表示观察的属性列表
@@ -29,7 +13,7 @@ class m extends HTMLElement {
29
13
  return [];
30
14
  }
31
15
  // 当属性发生变化时调用的回调函数
32
- attributeChangedCallback(e, t, i) {
16
+ attributeChangedCallback(t, e, n) {
33
17
  }
34
18
  get shadow() {
35
19
  return this.shadowRoot;
@@ -37,42 +21,27 @@ class m extends HTMLElement {
37
21
  get root() {
38
22
  return this.shadowRoot || this;
39
23
  }
40
- createStyle(e) {
41
- const t = document.createElement("style");
42
- t.textContent = e.trim(), this.root.appendChild(t);
43
- }
44
- createLink(e) {
45
- const t = document.createElement("link");
46
- t.rel = "stylesheet", t.href = e, this.root.appendChild(t);
47
- }
48
- loadStyle(e) {
49
- for (let t = 0, i = e.length; t < i; t++) {
50
- const s = e[t];
51
- a(/* @__PURE__ */ Object.assign({ "./button/index.less": () => import("./index-Bl8lRTJd.js"), "./color_picker/index.less": () => import("./index-BeOxuMd4.js"), "./form/index.less": () => import("./index-BxlGVrX3.js"), "./icon/index.less": () => import("./index-oNjb_IVt.js"), "./input/index.less": () => import("./index-B_9rPBWp.js"), "./list/index.less": () => import("./index-D-Ikkdx0.js"), "./polygon/index.less": () => import("./index-CMz7GCCH.js"), "./popconfirm/index.less": () => import("./index-C2D4YsFw.js"), "./popover/index.less": () => import("./index-BUyxD_nH.js"), "./radio/index.less": () => import("./index-CCcVpk6U.js"), "./select_ori/index.less": () => import("./index-C98Kx857.js"), "./switch/index.less": () => import("./index-116dRdDj.js"), "./tabbar/index.less": () => import("./index-DKvzJmsR.js"), "./theme/index.less": () => import("./index-DJ70Xyma.js") }), `./${s}/index.less`, 3).then((r) => {
52
- this.createStyle(r.default);
53
- });
54
- }
24
+ createStyle(t) {
25
+ const e = document.createElement("style");
26
+ e.textContent = t.trim(), this.root.appendChild(e);
55
27
  }
56
- loadExternalStyle(e) {
57
- for (let t = 0, i = e.length; t < i; t++) {
58
- const s = e[t];
59
- a(/* @__PURE__ */ Object.assign({ "./styles/animation.css": () => import("./animation-QfX4RtqD.js") }), `./styles/${s}.css`, 3).then((r) => {
60
- this.createStyle(r.default);
61
- });
62
- }
28
+ createLink(t) {
29
+ const e = document.createElement("link");
30
+ e.rel = "stylesheet", e.href = t, this.root.appendChild(e);
63
31
  }
64
- loadStyleText(e) {
65
- this.createStyle(e);
32
+ loadStyleText(t) {
33
+ let e = t;
34
+ Array.isArray(e) && (e = e.join("")), this.createStyle(e);
66
35
  }
67
- getAttr(e, t) {
68
- return c(this, e, t);
36
+ getAttr(t, e) {
37
+ return r(this, t, e);
69
38
  }
70
- appendToRoot(e) {
71
- if (e)
72
- if (typeof e == "string") {
73
- let t = document.createElement("div");
74
- t.innerHTML = e, this.root.append(...t.children), t = void 0;
75
- } else e.length ? this.root.append(...e) : this.root.append(e);
39
+ appendToRoot(t) {
40
+ if (t)
41
+ if (typeof t == "string") {
42
+ let e = document.createElement("div");
43
+ e.innerHTML = t, this.root.append(...e.children), e = void 0;
44
+ } else t.length ? this.root.append(...t) : this.root.append(t);
76
45
  }
77
46
  connectedCallback() {
78
47
  this.appendToRoot(this.render()), this.rendered = !0;
@@ -83,7 +52,6 @@ class m extends HTMLElement {
83
52
  render() {
84
53
  }
85
54
  }
86
- l(m, "baseName", "base-component");
87
55
  export {
88
- m as default
56
+ a as default
89
57
  };
@@ -1,95 +1,91 @@
1
- var b = Object.defineProperty;
2
- var h = (a, r, t) => r in a ? b(a, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[r] = t;
3
- var i = (a, r, t) => h(a, typeof r != "symbol" ? r + "" : r, t);
4
- import { regist as p, initAttr as g, parseAttrValue as m } from "../utils/index.js";
5
- import u from "../base.js";
6
- import { $one as y, addClass as A, removeClass as k, on as C, off as T, formatClass as $, formatStyle as v, getAttr as x } from "ph-utils/dom";
7
- import L from "../icon/loading.js";
8
- import { adjust as c } from "ph-utils/color";
9
- p(L);
10
- class M extends u {
1
+ import { initAttr as s, parseAttrValue as c } from "../utils/index.js";
2
+ import d from "../base.js";
3
+ import { $one as h, addClass as g, removeClass as p, on as v, off as f, formatClass as u, formatStyle as m, getAttr as k } from "ph-utils/dom";
4
+ import { adjust as b } from "ph-utils/color";
5
+ import { a as x } from "../animation-DttknHkX.js";
6
+ const y = ":host{display:inline-flex}:host{--l-btn-text-color: #ffffff;--l-btn-hover-text-color: var(--l-btn-text-color);--l-btn-active-text-color: var(--l-btn-text-color);--l-btn-border-color: var(--l-primary-color, #722ed1);--l-btn-background: var(--l-btn-border-color);--l-btn-hover-border-color: var(--l-primary-color-light1, #9254de);--l-btn-hover-background: var(--l-btn-hover-border-color);--l-btn-active-border-color: var(--l-primary-color-dark1, #531dab);--l-btn-active-background: var(--l-btn-active-border-color);--l-btn-disabled-color: #c9c9c9;--l-btn-disabled-background: #fbfbfb;--l-btn-disabled-border-color: #e6e6e6;display:inline-block}.l-btn{display:inline-flex;justify-content:center;align-items:center;cursor:pointer;outline:none;box-sizing:border-box;vertical-align:middle;padding:0 15px;line-height:1;height:var(--l-form-edit-height, 32px);border-radius:3px;font-size:14px;color:var(--l-btn-text-color);background:var(--l-btn-background);border:1px solid var(--l-btn-border-color);position:relative;gap:5px;transition:border-color .3s,background-color .3s,color .3s}.l-btn:hover{border-color:var(--l-btn-hover-border-color, var(--l-btn-hover-background));color:var(--l-btn-hover-text-color);background:var(--l-btn-hover-background)}.l-btn:active{border-color:var(--l-btn-active-border-color, var(--l-btn-active-background));color:var(--l-btn-active-text-color);background:var(--l-btn-active-background)}.l-btn-normal{--l-btn-text-color: auto;--l-btn-background: transparent;--l-btn-border-color: #d9d9d9;--l-btn-hover-text-color: var(--l-primary-color-light1, #9254de);--l-btn-active-text-color: var(--l-primary-color-dark1, #531dab);--l-btn-hover-background: #fff;--l-btn-active-background: #fff;--l-btn-hover-border-color: var(--l-btn-hover-text-color);--l-btn-active-border-color: var(--l-btn-active-text-color)}.l-btn-primary{--l-btn-background: var(--l-primary-color, #722ed1);--l-btn-hover-background: var(--l-primary-color-light1, #9254de);--l-btn-active-background: var(--l-primary-color-dark1, #531dab)}.l-btn:not(.l-btn-loading):disabled{border-color:var(--l-btn-disabled-border-color);background:var(--l-btn-disabled-background);color:var(--l-btn-disabled-color);cursor:not-allowed;opacity:1}.l-btn-text{--l-btn-background: transparent;--l-btn-border-color: transparent;--l-btn-hover-border-color: transparent;--l-btn-active-border-color: transparent;--l-btn-disabled-background: transparent;--l-btn-disabled-border-color: transparent;--l-btn-hover-background: transparent;--l-btn-active-background: transparent;height:auto;padding:5px}.l-btn-primary.l-btn-text{--l-btn-text-color: var(--l-primary-color, #722ed1);--l-btn-hover-text-color: var(--l-primary-color-light1, #9254de);--l-btn-active-text-color: var(--l-primary-color-dark1, #531dab)}.l-btn-ghost{--l-btn-text-color: var(--l-btn-border-color);--l-btn-background: transparent;--l-btn-hover-background: transparent;--l-btn-active-background: transparent;--l-btn-hover-text-color: var(--l-btn-hover-border-color);--l-btn-active-text-color: var(--l-btn-active-border-color)}.l-btn-round{border-radius:calc(var(--l-form-edit-height, 32px) / 2)}.l-btn-circle{border-radius:50%;width:var(--l-form-edit-height, 32px);padding:0}.l-btn-block{width:100%}.l-btn:not(.l-btn-text)+.l-btn{margin-left:10px}html.dark .l-btn:disabled{--l-btn-disabled-background: rgba(255, 255, 255, .08);--l-btn-disabled-color: rgba(255, 255, 255, .3);--l-btn-disabled-border-color: rgba(255, 255, 255, .3)}";
7
+ class M extends d {
8
+ static baseName = "button";
9
+ htmlType = "button";
11
10
  constructor() {
12
- super();
13
- i(this, "htmlType", "button");
14
- i(this, "_handleClick", (t) => {
15
- const e = t.target, s = x(e, "html-type");
16
- if (s === "reset" || s === "submit") {
17
- const l = this._getForm();
18
- l && (s === "reset" ? l.reset() : s === "submit" && l.submit());
19
- }
20
- });
21
- g(this);
11
+ super(), s(this);
22
12
  }
23
13
  // 初始化属性观察器
24
14
  static get observedAttributes() {
25
15
  return ["loading", "color", "disabled"];
26
16
  }
27
17
  // 当属性发生变化时调用的回调函数
28
- attributeChangedCallback(t, e, s) {
29
- const l = y(".l-btn", this.root);
18
+ attributeChangedCallback(r, t, o) {
19
+ const l = h(".l-btn", this.root);
30
20
  if (l)
31
- if (t === "loading")
32
- m(s, !1, t) ? (A(l, "l-btn-loading"), l.disabled = !0, l.innerHTML = this.loadingBody()) : (k(l, "l-btn-loading"), l.disabled = this.getAttr("disabled", !1), l.innerHTML = "<slot></slot>");
33
- else if (t === "color") {
34
- const n = this.getAttr("text", !1), o = this.getAttr("ghost", !1);
35
- l.style.cssText = this.applyColor(s, n, o);
36
- } else t === "disabled" && (l.disabled = this.getAttr("disabled", !1));
21
+ if (r === "loading")
22
+ c(o, !1, r) ? (g(l, "l-btn-loading"), l.disabled = !0, l.innerHTML = this.loadingBody()) : (p(l, "l-btn-loading"), l.disabled = this.getAttr("disabled", !1), l.innerHTML = "<slot></slot>");
23
+ else if (r === "color") {
24
+ const e = this.getAttr("text", !1), n = this.getAttr("ghost", !1);
25
+ l.style.cssText = this.applyColor(o, e, n);
26
+ } else r === "disabled" && (l.disabled = this.getAttr("disabled", !1));
37
27
  }
38
28
  connectedCallback() {
39
- this.loadStyle(["button"]), this.loadExternalStyle(["animation"]), this.render(), (this.htmlType === "reset" || this.htmlType === "submit") && C(this, "click", this._handleClick);
29
+ this.loadStyleText([y, x]), this.render(), (this.htmlType === "reset" || this.htmlType === "submit") && v(this, "click", this._handleClick);
40
30
  }
41
31
  disconnectedCallback() {
42
- super.disconnectedCallback(), (this.htmlType === "reset" || this.htmlType === "submit") && T(this, "click", this._handleClick);
32
+ super.disconnectedCallback(), (this.htmlType === "reset" || this.htmlType === "submit") && f(this, "click", this._handleClick);
43
33
  }
44
34
  render() {
45
- const t = this.getAttr("type", "normal"), e = document.createElement("button"), s = this.getAttr("loading", !1), l = this.getAttr("shape", "default"), n = this.getAttr("text", !1), o = this.getAttr("ghost", !1), f = [
35
+ const r = this.getAttr("type", "normal"), t = document.createElement("button"), o = this.getAttr("loading", !1), l = this.getAttr("shape", "default"), e = this.getAttr("text", !1), n = this.getAttr("ghost", !1), i = [
46
36
  "l-btn",
47
- `l-btn-${t}`,
37
+ `l-btn-${r}`,
48
38
  this.getAttr("block", !1) ? "l-btn-block" : "",
49
39
  l === "round" ? "l-btn-round" : "",
50
40
  l === "circle" ? "l-btn-circle" : "",
51
- o ? "l-btn-ghost" : "",
52
- n ? "l-btn-text" : "",
53
- s ? "l-btn-loading" : ""
41
+ n ? "l-btn-ghost" : "",
42
+ e ? "l-btn-text" : "",
43
+ o ? "l-btn-loading" : ""
54
44
  ];
55
- e.className = $(f), e.disabled = this.getAttr("disabled", !1) || s, e.type = this.getAttr("html-type", "button");
56
- const d = this.applyColor(this.getAttr("color"), n, o);
57
- d && (e.style.cssText = d), s ? e.innerHTML = this.loadingBody() : e.innerHTML = "<slot></slot>", e.setAttribute("part", "default"), this.root.appendChild(e);
45
+ t.className = u(i), t.disabled = this.getAttr("disabled", !1) || o, t.type = this.getAttr("html-type", "button");
46
+ const a = this.applyColor(this.getAttr("color"), e, n);
47
+ a && (t.style.cssText = a), o ? t.innerHTML = this.loadingBody() : t.innerHTML = "<slot></slot>", t.setAttribute("part", "default"), this.root.appendChild(t);
58
48
  }
59
49
  loadingBody() {
60
- const t = this.getAttr("loading-text", ""), e = ['<l-loading-icon class="l-rotate-anim"></l-loading-icon>'];
61
- return t === "" ? e.push("<slot></slot>") : e.push(`<span>${t}</span>`), e.join("");
50
+ const r = this.getAttr("loading-text", ""), t = ['<l-loading-icon class="l-rotate-anim"></l-loading-icon>'];
51
+ return r === "" ? t.push("<slot></slot>") : t.push(`<span>${r}</span>`), t.join("");
62
52
  }
63
- applyColor(t, e = !1, s = !1) {
64
- if (!t) return "";
65
- const l = c(t, 1, !0), n = c(t, 3, !1);
66
- return v({
67
- "--l-btn-border-color": e ? "transparent" : t,
68
- "--l-btn-text-color": s || e ? t : "#ffffff",
69
- "--l-btn-hover-text-color": s || e ? l : "#ffffff",
70
- "--l-btn-background": s || e ? "transparent" : t,
71
- "--l-btn-active-text-color": s || e ? n : "#ffffff",
72
- "--l-btn-hover-border-color": e ? "transparent" : l,
73
- "--l-btn-hover-background": s || e ? "transparent" : l,
74
- "--l-btn-active-background": s || e ? "transparent" : n,
75
- "--l-btn-active-border-color": e ? "transparent" : n
53
+ applyColor(r, t = !1, o = !1) {
54
+ if (!r) return "";
55
+ const l = b(r, 1, !0), e = b(r, 3, !1);
56
+ return m({
57
+ "--l-btn-border-color": t ? "transparent" : r,
58
+ "--l-btn-text-color": o || t ? r : "#ffffff",
59
+ "--l-btn-hover-text-color": o || t ? l : "#ffffff",
60
+ "--l-btn-background": o || t ? "transparent" : r,
61
+ "--l-btn-active-text-color": o || t ? e : "#ffffff",
62
+ "--l-btn-hover-border-color": t ? "transparent" : l,
63
+ "--l-btn-hover-background": o || t ? "transparent" : l,
64
+ "--l-btn-active-background": o || t ? "transparent" : e,
65
+ "--l-btn-active-border-color": t ? "transparent" : e
76
66
  });
77
67
  }
68
+ _handleClick = (r) => {
69
+ const t = r.target, o = k(t, "html-type");
70
+ if (o === "reset" || o === "submit") {
71
+ const l = this._getForm();
72
+ l && (o === "reset" ? l.reset() : o === "submit" && l.submit());
73
+ }
74
+ };
78
75
  _getForm() {
79
- let t = this.parentElement, e;
80
- for (; t != null; ) {
81
- const s = t.tagName;
82
- if (s === "L-FORM") {
83
- e = t;
76
+ let r = this.parentElement, t;
77
+ for (; r != null; ) {
78
+ const o = r.tagName;
79
+ if (o === "L-FORM") {
80
+ t = r;
84
81
  break;
85
82
  }
86
- if (s === "BODY") break;
87
- t = t.parentElement;
83
+ if (o === "BODY") break;
84
+ r = r.parentElement;
88
85
  }
89
- return t = null, e;
86
+ return r = null, t;
90
87
  }
91
88
  }
92
- i(M, "baseName", "button");
93
89
  export {
94
90
  M as default
95
91
  };
@@ -1,32 +1,27 @@
1
- var c = Object.defineProperty;
2
- var r = (i, t, e) => t in i ? c(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var s = (i, t, e) => r(i, typeof t != "symbol" ? t + "" : t, e);
4
- import { $one as n, on as l, off as o } from "ph-utils/dom";
5
- import h from "../form/form_inner.js";
6
- import { initAttr as p, setAttrs as d } from "../utils/index.js";
7
- class u extends h {
1
+ import { $one as i, on as s, off as a } from "ph-utils/dom";
2
+ import c from "../form/form_inner.js";
3
+ import { initAttr as r, setAttrs as n } from "../utils/index.js";
4
+ import { i as l } from "../index-391POYEJ.js";
5
+ const o = ":host{--l-input-width: 60px}";
6
+ class m extends c {
7
+ static baseName = "color-picker";
8
+ $picker;
9
+ _value = "#000000";
8
10
  constructor() {
9
- super();
10
- s(this, "$picker");
11
- s(this, "_value", "#000000");
12
- s(this, "_handleChange", (e) => {
13
- const a = e.target.value;
14
- super.setValue(a), this.dispatchEvent(new CustomEvent("change", { detail: a }));
15
- });
16
- p(this);
11
+ super(), r(this);
17
12
  }
18
13
  setValue(e) {
19
14
  super.setValue(e), this.$picker && (this.$picker.value = e);
20
15
  }
21
16
  connectedCallback() {
22
- this.loadStyle(["input", "color_picker"]), super.connectedCallback(), this.$picker = n("input", this.root), l(this.$picker, "change", this._handleChange);
17
+ this.loadStyleText([l, o]), super.connectedCallback(), this.$picker = i("input", this.root), s(this.$picker, "change", this._handleChange);
23
18
  }
24
19
  disconnectedCallback() {
25
- super.disconnectedCallback(), this.$picker && (o(this.$picker, "change", this._handleChange), this.$picker = void 0);
20
+ super.disconnectedCallback(), this.$picker && (a(this.$picker, "change", this._handleChange), this.$picker = void 0);
26
21
  }
27
22
  render() {
28
23
  const e = document.createElement("input");
29
- return d(e, [
24
+ return n(e, [
30
25
  ["value", this.value],
31
26
  ["disabled", this.isDisabled()],
32
27
  ["name", this.getName()],
@@ -37,8 +32,11 @@ class u extends h {
37
32
  _changeDisabled() {
38
33
  this.$picker && (this.$picker.disabled = this.isDisabled());
39
34
  }
35
+ _handleChange = (e) => {
36
+ const t = e.target.value;
37
+ super.setValue(t), this.dispatchEvent(new CustomEvent("change", { detail: t }));
38
+ };
40
39
  }
41
- s(u, "baseName", "color-picker");
42
40
  export {
43
- u as default
41
+ m as default
44
42
  };
@@ -1,24 +1,22 @@
1
1
  let e;
2
- function n(l, f, t) {
3
- e == null && (e = /* @__PURE__ */ new Map()), e.has(l) || e.set(l, /* @__PURE__ */ new Map([[f, /* @__PURE__ */ new Set()]])), e.get(l).has(f) || e.get(l).set(f, /* @__PURE__ */ new Set()), e.get(l).get(f).add(t);
2
+ function o(t, l, f) {
3
+ e == null && (e = /* @__PURE__ */ new Map()), e.has(t) || e.set(t, /* @__PURE__ */ new Map([[l, /* @__PURE__ */ new Set()]])), e.get(t).has(l) || e.get(t).set(l, /* @__PURE__ */ new Set()), e.get(t).get(l).add(f);
4
4
  }
5
- function r(l, f, t) {
6
- var i, o, g, u, a, c;
7
- (o = (i = e == null ? void 0 : e.get(l)) == null ? void 0 : i.get(f)) == null || o.delete(t), ((u = (g = e == null ? void 0 : e.get(l)) == null ? void 0 : g.get(f)) == null ? void 0 : u.size) == 0 && ((a = e.get(l)) == null || a.delete(f)), ((c = e == null ? void 0 : e.get(l)) == null ? void 0 : c.size) == 0 && e.delete(l), (e == null ? void 0 : e.size) == 0 && (e = void 0);
5
+ function g(t, l, f) {
6
+ e?.get(t)?.get(l)?.delete(f), e?.get(t)?.get(l)?.size == 0 && e.get(t)?.delete(l), e?.get(t)?.size == 0 && e.delete(t), e?.size == 0 && (e = void 0);
8
7
  }
9
- function w(l) {
10
- l == null ? e != null && (e.clear(), e = void 0) : e != null && (e.delete(l), e.size === 0 && (e = void 0));
8
+ function s(t) {
9
+ t == null ? e != null && (e.clear(), e = void 0) : e != null && (e.delete(t), e.size === 0 && (e = void 0));
11
10
  }
12
- function z(l, f, ...t) {
13
- var o;
14
- const i = (o = e == null ? void 0 : e.get(l)) == null ? void 0 : o.get(f);
15
- if (i != null)
16
- for (const g of i)
17
- g(...t);
11
+ function u(t, l, ...f) {
12
+ const n = e?.get(t)?.get(l);
13
+ if (n != null)
14
+ for (const i of n)
15
+ i(...f);
18
16
  }
19
17
  export {
20
- n as add,
21
- w as clear,
22
- z as emit,
23
- r as remove
18
+ o as add,
19
+ s as clear,
20
+ u as emit,
21
+ g as remove
24
22
  };
@@ -1,31 +1,21 @@
1
- var f = Object.defineProperty;
2
- var m = (h, s, t) => s in h ? f(h, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[s] = t;
3
- var e = (h, s, t) => m(h, typeof s != "symbol" ? s + "" : s, t);
4
- import A from "../base.js";
5
- import { parseAttrValue as g } from "../utils/index.js";
6
- import { add as u, remove as d, emit as b } from "./form_events.js";
7
- class p extends A {
1
+ import o from "../base.js";
2
+ import { parseAttrValue as u } from "../utils/index.js";
3
+ import { add as l, remove as n, emit as d } from "./form_events.js";
4
+ class b extends o {
5
+ disabled = !1;
6
+ name = void 0;
7
+ formAttrs = {};
8
+ formItemAttrs = {};
9
+ _value = "";
10
+ _resetValue;
11
+ _firstPushValue = !0;
12
+ _reseting = !1;
8
13
  /**
9
14
  *
10
15
  * @param firstPushValue 是否第一次赋值 value 时, 推送数据到 Form, 默认: true
11
16
  */
12
17
  constructor(t = !0) {
13
- super();
14
- e(this, "disabled", !1);
15
- e(this, "name");
16
- e(this, "formAttrs", {});
17
- e(this, "formItemAttrs", {});
18
- e(this, "_value", "");
19
- e(this, "_resetValue");
20
- e(this, "_firstPushValue", !0);
21
- e(this, "_reseting", !1);
22
- e(this, "_formAttributeChanged", (t, r, i) => {
23
- i === this.formAttrs.formId ? this.formAttrs[t] = r : this.formItemAttrs[t] = r, t === "disabled" && this._changeDisabled();
24
- });
25
- e(this, "_resetFieldValue", () => {
26
- this._reseting = !0, this.reset();
27
- });
28
- this._firstPushValue = t;
18
+ super(), this._firstPushValue = t;
29
19
  }
30
20
  set value(t) {
31
21
  this.setValue(t);
@@ -42,25 +32,25 @@ class p extends A {
42
32
  static get observedAttributes() {
43
33
  return ["disabled"];
44
34
  }
45
- attributeChangedCallback(t, r, i) {
35
+ attributeChangedCallback(t, e, s) {
46
36
  if (t === "disabled") {
47
- const l = g(i, !1, t);
48
- l !== this.disabled && (this._changeDisabled(), this.disabled = l);
37
+ const i = u(s, !1, t);
38
+ i !== this.disabled && (this._changeDisabled(), this.disabled = i);
49
39
  } else
50
- this.attributeChange(t, r, i);
40
+ this.attributeChange(t, e, s);
51
41
  }
52
- attributeChange(t, r, i) {
42
+ attributeChange(t, e, s) {
53
43
  }
54
44
  connectedCallback() {
55
45
  const t = this._getForm();
56
- this.formAttrs = t.formAttr, this.formItemAttrs = t.formItemAttr, this.formAttrs.id && (u(this.formAttrs.id, "attributeChanged", this._formAttributeChanged), u(this.formAttrs.id, "reset", this._resetFieldValue), this._firstPushValue && this.pushValueChange()), this.formItemAttrs.id && u(
46
+ this.formAttrs = t.formAttr, this.formItemAttrs = t.formItemAttr, this.formAttrs.id && (l(this.formAttrs.id, "attributeChanged", this._formAttributeChanged), l(this.formAttrs.id, "reset", this._resetFieldValue), this._firstPushValue && this.pushValueChange()), this.formItemAttrs.id && l(
57
47
  this.formItemAttrs.id,
58
48
  "attributeChanged",
59
49
  this._formAttributeChanged
60
50
  ), super.connectedCallback();
61
51
  }
62
52
  disconnectedCallback() {
63
- this.formAttrs.id && (d(this.formAttrs.id, "attributeChanged", this._formAttributeChanged), d(this.formAttrs.id, "reset", this._resetFieldValue)), this.formItemAttrs.id && d(
53
+ this.formAttrs.id && (n(this.formAttrs.id, "attributeChanged", this._formAttributeChanged), n(this.formAttrs.id, "reset", this._resetFieldValue)), this.formItemAttrs.id && n(
64
54
  this.formItemAttrs.id,
65
55
  "attributeChanged",
66
56
  this._formAttributeChanged
@@ -73,38 +63,41 @@ class p extends A {
73
63
  return this.name ? this.name : this.formItemAttrs.name;
74
64
  }
75
65
  _getForm() {
76
- let t = this.parentElement, r = {}, i = {};
66
+ let t = this.parentElement, e = {}, s = {};
77
67
  for (; t != null; ) {
78
- const l = t.tagName;
79
- if (l === "L-FORM") {
80
- const n = t.sharedAttrs;
81
- for (let a = 0; a < n.length; a++) {
82
- const o = n[a];
83
- r[o] = t[o];
68
+ const i = t.tagName;
69
+ if (i === "L-FORM") {
70
+ const a = t.sharedAttrs;
71
+ for (let r = 0; r < a.length; r++) {
72
+ const h = a[r];
73
+ e[h] = t[h];
84
74
  }
85
75
  break;
86
76
  }
87
- if (l === "BODY") break;
88
- if (l === "L-FORM-ITEM") {
89
- const n = t.sharedAttrs;
90
- for (let a = 0; a < n.length; a++) {
91
- const o = n[a];
92
- i[o] = t[o];
77
+ if (i === "BODY") break;
78
+ if (i === "L-FORM-ITEM") {
79
+ const a = t.sharedAttrs;
80
+ for (let r = 0; r < a.length; r++) {
81
+ const h = a[r];
82
+ s[h] = t[h];
93
83
  }
94
84
  }
95
85
  t = t.parentElement;
96
86
  }
97
87
  return t = null, {
98
- formAttr: r,
99
- formItemAttr: i
88
+ formAttr: e,
89
+ formItemAttr: s
100
90
  };
101
91
  }
92
+ _formAttributeChanged = (t, e, s) => {
93
+ s === this.formAttrs.formId ? this.formAttrs[t] = e : this.formItemAttrs[t] = e, t === "disabled" && this._changeDisabled();
94
+ };
102
95
  /** disable 属性改变时回调 */
103
96
  _changeDisabled() {
104
97
  }
105
98
  pushValueChange() {
106
99
  const t = this.getName();
107
- this.formAttrs.id && t && b(
100
+ this.formAttrs.id && t && d(
108
101
  this.formAttrs.id,
109
102
  "valueChange",
110
103
  t,
@@ -112,10 +105,13 @@ class p extends A {
112
105
  !this._reseting
113
106
  ), this._reseting = !1;
114
107
  }
108
+ _resetFieldValue = () => {
109
+ this._reseting = !0, this.reset();
110
+ };
115
111
  reset() {
116
112
  this.value = this._resetValue || "";
117
113
  }
118
114
  }
119
115
  export {
120
- p as default
116
+ b as default
121
117
  };
@@ -31,7 +31,7 @@ export default class FormItem extends BaseComponent {
31
31
  message?: string;
32
32
  }): void;
33
33
  setError(error: string): void;
34
- render(): void;
34
+ render(): string;
35
35
  private _validateChange;
36
36
  private _updateError;
37
37
  private _updateLabel;