litos-ui 0.8.0 → 0.10.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 (52) hide show
  1. package/lib/base.js +26 -30
  2. package/lib/button/index.js +55 -59
  3. package/lib/checkbox/index.d.ts +17 -0
  4. package/lib/checkbox/index.js +135 -0
  5. package/lib/color_picker/index.js +17 -21
  6. package/lib/form/form_inner.js +46 -49
  7. package/lib/form/form_item.js +49 -54
  8. package/lib/form/index.js +62 -66
  9. package/lib/icon/arrow_down.js +4 -7
  10. package/lib/icon/arrow_left.js +4 -7
  11. package/lib/icon/arrow_right.js +4 -7
  12. package/lib/icon/arrow_up.js +4 -7
  13. package/lib/icon/base.js +21 -25
  14. package/lib/icon/caret_bottom.js +4 -7
  15. package/lib/icon/caret_top.js +4 -7
  16. package/lib/icon/font_icon.js +13 -17
  17. package/lib/icon/info.js +4 -7
  18. package/lib/icon/loading.js +4 -7
  19. package/lib/icon/mask_close.js +4 -7
  20. package/lib/icon/moon.js +4 -7
  21. package/lib/icon/reduction.js +4 -7
  22. package/lib/icon/refresh_left.js +4 -7
  23. package/lib/icon/refresh_right.js +4 -7
  24. package/lib/icon/search.js +4 -7
  25. package/lib/icon/sort.js +4 -7
  26. package/lib/icon/success.js +4 -7
  27. package/lib/icon/sun.js +4 -7
  28. package/lib/icon/theme_default.js +4 -7
  29. package/lib/icon/warn.js +4 -7
  30. package/lib/index.d.ts +4 -0
  31. package/lib/index.js +30 -26
  32. package/lib/input/index.js +66 -71
  33. package/lib/list/index.js +23 -27
  34. package/lib/litos-ui.css +1 -1
  35. package/lib/litos-ui.min.js +1 -1
  36. package/lib/md_input/index.d.ts +15 -0
  37. package/lib/md_input/index.js +60 -0
  38. package/lib/polygon/index.js +14 -18
  39. package/lib/popconfirm/index.js +11 -14
  40. package/lib/popover/index.js +107 -113
  41. package/lib/radio/index.js +53 -57
  42. package/lib/select_ori/index.js +23 -27
  43. package/lib/switch/index.js +34 -44
  44. package/lib/tabbar/index.js +117 -126
  45. package/lib/theme/index.js +71 -74
  46. package/lib/theme/theme_color.js +17 -27
  47. package/lib/{form/form_events.d.ts → utils/event.d.ts} +5 -7
  48. package/lib/utils/event.js +16 -18
  49. package/lib/utils/index.js +21 -21
  50. package/lib/utils/transition.js +23 -27
  51. package/package.json +1 -1
  52. package/lib/form/form_events.js +0 -24
package/lib/icon/moon.js CHANGED
@@ -1,8 +1,6 @@
1
- var s = Object.defineProperty;
2
- var a = (t, e, r) => e in t ? s(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var o = (t, e, r) => a(t, typeof e != "symbol" ? e + "" : e, r);
4
- import c from "./base.js";
5
- class n extends c {
1
+ import e from "./base.js";
2
+ class r extends e {
3
+ static baseName = "moon-icon";
6
4
  constructor() {
7
5
  super(), this.viewBox = "0 0 24 24";
8
6
  }
@@ -10,7 +8,6 @@ class n extends c {
10
8
  return '<path d="M12.1 22h-.9c-5.5-.5-9.5-5.4-9-10.9.4-4.8 4.2-8.6 9-9 .4 0 .8.2 1 .5.2.3.2.8-.1 1.1-2 2.7-1.4 6.4 1.3 8.4 2.1 1.6 5 1.6 7.1 0 .3-.2.7-.3 1.1-.1.3.2.5.6.5 1-.2 2.7-1.5 5.1-3.6 6.8-1.9 1.4-4.1 2.2-6.4 2.2zM9.3 4.4c-2.9 1-5 3.6-5.2 6.8-.4 4.4 2.8 8.3 7.2 8.7 2.1.2 4.2-.4 5.8-1.8 1.1-.9 1.9-2.1 2.4-3.4-2.5.9-5.3.5-7.5-1.1-2.8-2.2-3.9-5.9-2.7-9.2z"></path>';
11
9
  }
12
10
  }
13
- o(n, "baseName", "moon-icon");
14
11
  export {
15
- n as default
12
+ r as default
16
13
  };
@@ -1,8 +1,6 @@
1
- var r = Object.defineProperty;
2
- var c = (e, a, t) => a in e ? r(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t;
3
- var l = (e, a, t) => c(e, typeof a != "symbol" ? a + "" : a, t);
4
- import L from "./base.js";
5
- class s extends L {
1
+ import a from "./base.js";
2
+ class l extends a {
3
+ static baseName = "reduction-icon";
6
4
  constructor() {
7
5
  super();
8
6
  }
@@ -10,7 +8,6 @@ class s extends L {
10
8
  return '<path d="M1039.92888889 967.11111111L1039.92888889 56.88888889c0-40.15900445-32.65877333-72.81777778-72.81777778-72.81777778l-910.22222222 0c-40.15900445 0-72.81777778 32.65877333-72.81777778 72.81777778l0 910.22222222c0 40.15900445 32.65877333 72.81777778 72.81777778 72.81777778L967.11111111 1039.92888889c40.15900445 0 72.81777778-32.65877333 72.81777778-72.81777778zM56.88888889 56.88888889L967.11111111 56.88888889l0 910.22222222-910.22222221 0.07281778L56.88888889 56.88888889z"></path><path d="M876.08888889 349.17944888a36.40888889 36.40888889 0 0 0-36.40888889-36.40888889l-120.47701333 1e-8L719.20298668 184.32a36.40888889 36.40888889 0 0 0-72.81777779 0l0 164.85944889a36.40888889 36.40888889 0 0 0 36.40888889 36.40888889L839.68 385.58833778a36.40888889 36.40888889 0 0 0 36.40888889-36.4088889z m-156.88590221 473.27914667L719.20298667 694.04444445 839.68 694.04444445a36.40888889 36.40888889 0 1 0 0-72.81777778l-156.88590222 0a36.40888889 36.40888889 0 0 0-36.40888889 36.40888888l0 164.82304a36.40888889 36.40888889 0 1 0 72.81777779 0zM366.36444445 349.17944888L366.36444445 184.32a36.40888889 36.40888889 0 1 0-72.81777778 0l0 128.45055999-120.51342222 1e-8a36.40888889 36.40888889 0 1 0 0 72.81777778L329.95555555 385.58833778a36.40888889 36.40888889 0 0 0 36.4088889-36.4088889z m0 473.27914667L366.36444445 657.63555555a36.40888889 36.40888889 0 0 0-36.4088889-36.40888888l-156.9223111-1e-8a36.40888889 36.40888889 0 1 0 0 72.81777779L293.54666667 694.04444445l0 128.4141511a36.40888889 36.40888889 0 1 0 72.81777778 0z"></path>';
11
9
  }
12
10
  }
13
- l(s, "baseName", "reduction-icon");
14
11
  export {
15
- s as default
12
+ l as default
16
13
  };
@@ -1,8 +1,6 @@
1
- var s = Object.defineProperty;
2
- var n = (a, e, r) => e in a ? s(a, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[e] = r;
3
- var t = (a, e, r) => n(a, typeof e != "symbol" ? e + "" : e, r);
4
- import o from "./base.js";
5
- class c extends o {
1
+ import e from "./base.js";
2
+ class t extends e {
3
+ static baseName = "refresh-left-icon";
6
4
  constructor() {
7
5
  super();
8
6
  }
@@ -10,7 +8,6 @@ class c extends o {
10
8
  return '<path d="M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"></path>';
11
9
  }
12
10
  }
13
- t(c, "baseName", "refresh-left-icon");
14
11
  export {
15
- c as default
12
+ t as default
16
13
  };
@@ -1,13 +1,10 @@
1
- var s = Object.defineProperty;
2
- var h = (e, a, r) => a in e ? s(e, a, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[a] = r;
3
- var t = (e, a, r) => h(e, typeof a != "symbol" ? a + "" : a, r);
4
- import n from "./base.js";
5
- class d extends n {
1
+ import e from "./base.js";
2
+ class t extends e {
3
+ static baseName = "refresh-right-icon";
6
4
  renderChildren() {
7
5
  return '<path d="M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"></path>';
8
6
  }
9
7
  }
10
- t(d, "baseName", "refresh-right-icon");
11
8
  export {
12
- d as default
9
+ t as default
13
10
  };
@@ -1,13 +1,10 @@
1
- var s = Object.defineProperty;
2
- var n = (e, a, r) => a in e ? s(e, a, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[a] = r;
3
- var t = (e, a, r) => n(e, typeof a != "symbol" ? a + "" : a, r);
4
- import o from "./base.js";
5
- class c extends o {
1
+ import a from "./base.js";
2
+ class t extends a {
3
+ static baseName = "search-icon";
6
4
  renderChildren() {
7
5
  return '<path fill="currentColor" d="m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"></path>';
8
6
  }
9
7
  }
10
- t(c, "baseName", "search-icon");
11
8
  export {
12
- c as default
9
+ t as default
13
10
  };
package/lib/icon/sort.js CHANGED
@@ -1,13 +1,10 @@
1
- var s = Object.defineProperty;
2
- var n = (e, a, t) => a in e ? s(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t;
3
- var r = (e, a, t) => n(e, typeof a != "symbol" ? a + "" : a, t);
4
- import o from "./base.js";
5
- class d extends o {
1
+ import a from "./base.js";
2
+ class r extends a {
3
+ static baseName = "sort-icon";
6
4
  renderChildren() {
7
5
  return '<path d="M384 96a32 32 0 0 1 64 0v786.752a32 32 0 0 1-54.592 22.656L95.936 608a32 32 0 0 1 0-45.312h.128a32 32 0 0 1 45.184 0L384 805.632zm192 45.248a32 32 0 0 1 54.592-22.592L928.064 416a32 32 0 0 1 0 45.312h-.128a32 32 0 0 1-45.184 0L640 218.496V928a32 32 0 1 1-64 0V141.248z"></path>';
8
6
  }
9
7
  }
10
- r(d, "baseName", "sort-icon");
11
8
  export {
12
- d as default
9
+ r as default
13
10
  };
@@ -1,8 +1,6 @@
1
- var r = Object.defineProperty;
2
- var s = (c, e, a) => e in c ? r(c, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : c[e] = a;
3
- var l = (c, e, a) => s(c, typeof e != "symbol" ? e + "" : e, a);
4
- import t from "./base.js";
5
- class n extends t {
1
+ import e from "./base.js";
2
+ class a extends e {
3
+ static baseName = "success-icon";
6
4
  connectedCallback() {
7
5
  super.connectedCallback();
8
6
  }
@@ -10,7 +8,6 @@ class n extends t {
10
8
  return '<path fill="currentColor" d="M512 0C228.693333 0 0 228.693333 0 512s228.693333 512 512 512 512-228.693333 512-512S795.306667 0 512 0z m307.2 368.64L467.626667 730.453333c0 3.413333-3.413333 3.413333-3.413334 6.826667-13.653333 13.653333-37.546667 13.653333-51.2 0l-177.493333-177.493333c-13.653333-13.653333-13.653333-37.546667 0-51.2 13.653333-13.653333 37.546667-13.653333 51.2 0l150.186667 153.6 334.506666-341.333334c13.653333-13.653333 37.546667-13.653333 51.2 0 10.24 10.24 10.24 34.133333-3.413333 47.786667z m0 0"></path>';
11
9
  }
12
10
  }
13
- l(n, "baseName", "success-icon");
14
11
  export {
15
- n as default
12
+ a as default
16
13
  };
package/lib/icon/sun.js CHANGED
@@ -1,8 +1,6 @@
1
- var r = Object.defineProperty;
2
- var l = (s, c, e) => c in s ? r(s, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[c] = e;
3
- var t = (s, c, e) => l(s, typeof c != "symbol" ? c + "" : c, e);
4
- import z from "./base.js";
5
- class a extends z {
1
+ import c from "./base.js";
2
+ class t extends c {
3
+ static baseName = "sun-icon";
6
4
  constructor() {
7
5
  super(), this.viewBox = "0 0 24 24";
8
6
  }
@@ -10,7 +8,6 @@ class a extends z {
10
8
  return '<path d="M12 18c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6zm0-10c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zM12 4c-.6 0-1-.4-1-1V1c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM12 24c-.6 0-1-.4-1-1v-2c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM5.6 6.6c-.3 0-.5-.1-.7-.3L3.5 4.9c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.1.2-.4.3-.7.3zM19.8 20.8c-.3 0-.5-.1-.7-.3l-1.4-1.4c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.2.2-.5.3-.7.3zM3 13H1c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM23 13h-2c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM4.2 20.8c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.4.3-.7.3zM18.4 6.6c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.5.3-.7.3z"></path>';
11
9
  }
12
10
  }
13
- t(a, "baseName", "sun-icon");
14
11
  export {
15
- a as default
12
+ t as default
16
13
  };
@@ -1,8 +1,6 @@
1
- var a = Object.defineProperty;
2
- var o = (t, e, r) => e in t ? a(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var s = (t, e, r) => o(t, typeof e != "symbol" ? e + "" : e, r);
4
- import c from "./base.js";
5
- class n extends c {
1
+ import e from "./base.js";
2
+ class r extends e {
3
+ static baseName = "theme-default-icon";
6
4
  constructor() {
7
5
  super(), this.viewBox = "0 0 24 24";
8
6
  }
@@ -10,7 +8,6 @@ class n extends c {
10
8
  return '<path d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12s4.477 10 10 10m0-1.5v-17a8.5 8.5 0 0 1 0 17"/>';
11
9
  }
12
10
  }
13
- s(n, "baseName", "theme-default-icon");
14
11
  export {
15
- n as default
12
+ r as default
16
13
  };
package/lib/icon/warn.js CHANGED
@@ -1,8 +1,6 @@
1
- var l = Object.defineProperty;
2
- var n = (a, e, c) => e in a ? l(a, e, { enumerable: !0, configurable: !0, writable: !0, value: c }) : a[e] = c;
3
- var r = (a, e, c) => n(a, typeof e != "symbol" ? e + "" : e, c);
4
- import t from "./base.js";
5
- class o extends t {
1
+ import e from "./base.js";
2
+ class r extends e {
3
+ static baseName = "warn-icon";
6
4
  connectedCallback() {
7
5
  super.connectedCallback();
8
6
  }
@@ -10,7 +8,6 @@ class o extends t {
10
8
  return '<path fill="currentColor" d="M512 1024C229.234 1024 0 794.766 0 512S229.234 0 512 0s512 229.234 512 512-229.234 512-512 512z m-64.853-734.52l19.484 244.906 1.309 16.156c1.251 15.93 15.018 28.644 30.72 28.644h25.571c15.56 0 29.298-12.601 30.663-28.132l1.422-16.668 21.334-244.907c3.214-36.978-24.434-66.844-61.725-66.844h-6.627c-37.462 0-65.138 29.923-62.18 66.844zM512 801.393a66.788 66.788 0 1 0 0-133.575 66.788 66.788 0 0 0 0 133.575z"></path>';
11
9
  }
12
10
  }
13
- r(o, "baseName", "warn-icon");
14
11
  export {
15
- o as default
12
+ r as default
16
13
  };
package/lib/index.d.ts CHANGED
@@ -24,6 +24,7 @@ export { default as ThemeDefaultIcon } from "./icon/theme_default";
24
24
  export { default as Form } from "./form";
25
25
  export { default as FormItem } from "./form/form_item";
26
26
  export { default as Radio } from "./radio";
27
+ export { default as Checkbox } from "./checkbox";
27
28
  export { default as Button } from "./button";
28
29
  export { default as Input } from "./input";
29
30
  export { default as SelectOri } from "./select_ori";
@@ -34,6 +35,7 @@ export { default as ColorPicker } from "./color_picker";
34
35
  export { default as Tabbar } from "./tabbar";
35
36
  export { default as Theme } from "./theme";
36
37
  export { default as ThemeColor } from "./theme/theme_color";
38
+ export { default as MdInput } from "./md_input";
37
39
 
38
40
  declare global {
39
41
  interface HTMLElementTagNameMap {
@@ -60,6 +62,7 @@ declare global {
60
62
  "l-form": import("./form").default
61
63
  "l-form-item": import("./form/form_item").default
62
64
  "l-radio": import("./radio").default
65
+ "l-checkbox": import("./checkbox").default
63
66
  "l-button": import("./button").default
64
67
  "l-input": import("./input").default
65
68
  "l-select-ori": import("./select_ori").default
@@ -70,5 +73,6 @@ declare global {
70
73
  "l-tabbar": import("./tabbar").default
71
74
  "l-theme": import("./theme").default
72
75
  "l-theme-color": import("./theme/theme_color").default
76
+ "l-md-input": import("./md_input").default
73
77
  }
74
78
  }
package/lib/index.js CHANGED
@@ -5,9 +5,9 @@ import { default as C } from "./message/index.js";
5
5
  import { default as P } from "./popover/index.js";
6
6
  import { default as T } from "./popconfirm/index.js";
7
7
  import { default as O } from "./icon/base.js";
8
- import { default as B } from "./icon/arrow_down.js";
9
- import { default as k } from "./icon/arrow_left.js";
10
- import { default as F } from "./icon/arrow_right.js";
8
+ import { default as k } from "./icon/arrow_down.js";
9
+ import { default as L } from "./icon/arrow_left.js";
10
+ import { default as D } from "./icon/arrow_right.js";
11
11
  import { default as M } from "./icon/arrow_up.js";
12
12
  import { default as U } from "./icon/caret_top.js";
13
13
  import { default as X } from "./icon/caret_bottom.js";
@@ -24,36 +24,40 @@ import { default as ao } from "./icon/theme_default.js";
24
24
  import { default as so } from "./form/index.js";
25
25
  import { default as po } from "./form/form_item.js";
26
26
  import { default as lo } from "./radio/index.js";
27
- import { default as no } from "./button/index.js";
28
- import { default as io } from "./input/index.js";
29
- import { default as go } from "./select_ori/index.js";
30
- import { default as Ao } from "./switch/index.js";
31
- import { default as wo } from "./list/index.js";
32
- import { default as Ro } from "./polygon/index.js";
33
- import { default as vo } from "./color_picker/index.js";
34
- import { default as So } from "./tabbar/index.js";
35
- import { default as Lo } from "./theme/index.js";
36
- import { default as Do } from "./theme/theme_color.js";
27
+ import { default as no } from "./checkbox/index.js";
28
+ import { default as io } from "./button/index.js";
29
+ import { default as go } from "./input/index.js";
30
+ import { default as Ao } from "./select_ori/index.js";
31
+ import { default as wo } from "./switch/index.js";
32
+ import { default as Ro } from "./list/index.js";
33
+ import { default as vo } from "./polygon/index.js";
34
+ import { default as So } from "./color_picker/index.js";
35
+ import { default as Bo } from "./tabbar/index.js";
36
+ import { default as bo } from "./theme/index.js";
37
+ import { default as Fo } from "./theme/theme_color.js";
38
+ import { default as yo } from "./md_input/index.js";
37
39
  export {
38
- B as ArrowDownIcon,
39
- k as ArrowLeftIcon,
40
- F as ArrowRightIcon,
40
+ k as ArrowDownIcon,
41
+ L as ArrowLeftIcon,
42
+ D as ArrowRightIcon,
41
43
  M as ArrowUpIcon,
42
44
  h as BaseComponent,
43
45
  O as BaseIcon,
44
- no as Button,
46
+ io as Button,
45
47
  X as CaretBottomIcon,
46
48
  U as CaretTopIcon,
47
- vo as ColorPicker,
49
+ no as Checkbox,
50
+ So as ColorPicker,
48
51
  j as FontIcon,
49
52
  so as Form,
50
53
  po as FormItem,
51
- io as Input,
52
- wo as List,
54
+ go as Input,
55
+ Ro as List,
53
56
  z as LoadingIcon,
57
+ yo as MdInput,
54
58
  C as Message,
55
59
  N as MoonIcon,
56
- Ro as Polygon,
60
+ vo as Polygon,
57
61
  T as Popconfirm,
58
62
  P as Popover,
59
63
  lo as Radio,
@@ -61,13 +65,13 @@ export {
61
65
  _ as RefreshLeftIcon,
62
66
  oo as RefreshRightIcon,
63
67
  G as SearchIcon,
64
- go as SelectOri,
68
+ Ao as SelectOri,
65
69
  to as SortIcon,
66
70
  J as SunIcon,
67
- Ao as Switch,
68
- So as Tabbar,
69
- Lo as Theme,
70
- Do as ThemeColor,
71
+ wo as Switch,
72
+ Bo as Tabbar,
73
+ bo as Theme,
74
+ Fo as ThemeColor,
71
75
  ao as ThemeDefaultIcon,
72
76
  i as addClickOutside,
73
77
  t as config,
@@ -1,52 +1,29 @@
1
- var p = Object.defineProperty;
2
- var d = (l, n, t) => n in l ? p(l, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[n] = t;
3
- var r = (l, n, t) => d(l, typeof n != "symbol" ? n + "" : n, t);
4
- import { off as c, formatClass as f, $one as m, on as g, formatStyle as v, addClass as $, removeClass as b } from "ph-utils/dom";
5
- import { initAttr as _, tagAttr as u, parseAttrValue as w } from "../utils/index.js";
6
- import C from "../form/form_inner.js";
7
- import { remove as k, add as y } from "../form/form_events.js";
8
- import { i as I } from "../index-391POYEJ.js";
9
- class A extends C {
1
+ import { off as u, formatClass as o, $one as h, on as p, formatStyle as d, addClass as c, removeClass as f } from "ph-utils/dom";
2
+ import { initAttr as m, tagAttr as n, parseAttrValue as g } from "../utils/index.js";
3
+ import v from "../form/form_inner.js";
4
+ import { remove as $, add as b } from "../utils/event.js";
5
+ import { i as _ } from "../index-391POYEJ.js";
6
+ class S extends v {
7
+ static baseName = "input";
8
+ /** 原生 input 的 type */
9
+ type = "text";
10
+ placeholder = void 0;
11
+ autosize = !1;
12
+ /** 限制输入类型, number, integer */
13
+ allowInput = void 0;
14
+ /** 自定义输入解析器 */
15
+ parser;
16
+ /** 宽度 */
17
+ width;
18
+ /** 宽度铺满 */
19
+ block = !1;
20
+ error = !1;
21
+ $input = void 0;
10
22
  constructor() {
11
- super();
12
- /** 原生 input 的 type */
13
- r(this, "type", "text");
14
- r(this, "placeholder");
15
- r(this, "autosize", !1);
16
- /** 限制输入类型, number, integer */
17
- r(this, "allowInput");
18
- /** 自定义输入解析器 */
19
- r(this, "parser");
20
- /** 宽度 */
21
- r(this, "width");
22
- /** 宽度铺满 */
23
- r(this, "block", !1);
24
- r(this, "error", !1);
25
- r(this, "$input");
26
- r(this, "_input", (t) => {
27
- const s = t.target;
28
- let e = s.value;
29
- if (this.allowInput != null) {
30
- let i = this.allowInput.indexOf("."), a = i === -1 ? i : parseInt(this.allowInput.substring(i + 1));
31
- e = this._numberInputParse(e, {
32
- integer: this.allowInput.includes("integer"),
33
- negative: this.allowInput.startsWith("-"),
34
- precition: a
35
- }), e = String(e), s.value = e;
36
- }
37
- this.parser != null && (e = this.parser(e), s.value = e), this.setValue(e);
38
- });
39
- r(this, "_validateChange", (t, s) => {
40
- const e = this.getName();
41
- if (e) {
42
- const i = t === !0 ? !1 : t[e] != null;
43
- (s == null || s === e && this.error != i) && (this.error = i, this._updateError()), Object.keys(t)[0] === e && this.focus();
44
- }
45
- });
46
- _(this);
23
+ super(), m(this);
47
24
  }
48
- set value(t) {
49
- this.setValue(t), this.$input != null && (this.$input.value = this.value);
25
+ set value(e) {
26
+ this.setValue(e), this.$input != null && (this.$input.value = this.value);
50
27
  }
51
28
  get value() {
52
29
  return this.getValue();
@@ -55,65 +32,83 @@ class A extends C {
55
32
  return ["disabled", "error"];
56
33
  }
57
34
  connectedCallback() {
58
- super.connectedCallback(), this.loadStyleText([I]);
35
+ super.connectedCallback(), this.loadStyleText([_]);
59
36
  }
60
37
  disconnectedCallback() {
61
- super.disconnectedCallback(), this.formAttrs.id && k(this.formAttrs.id, "validateChange", this._validateChange), c(this.$input, "input", this._input), this.$input = void 0;
38
+ super.disconnectedCallback(), this.formAttrs.id && $(this.formAttrs.id, "validateChange", this._validateChange), u(this.$input, "input", this._input), this.$input = void 0;
62
39
  }
63
- attributeChange(t, s, e) {
64
- if (t === "error") {
65
- const i = w(e, !1, t);
40
+ attributeChange(e, s, t) {
41
+ if (e === "error") {
42
+ const i = g(t, !1, e);
66
43
  i !== this.error && (this.error = i, this._updateError());
67
44
  }
68
45
  }
69
46
  render() {
70
- let t = u("value", this.value);
71
- const s = u("placeholder", this.placeholder), e = u("disabled", this.isDisabled()), i = f({
47
+ let e = n("value", this.value);
48
+ const s = n("placeholder", this.placeholder), t = n("disabled", this.isDisabled()), i = o({
72
49
  "l-input": !0,
73
50
  "is-autosize": this.autosize,
74
51
  "is-error": this.error
75
- }), a = this.getName(), o = u("name", a), h = `${t}${o}${s}${e}`;
76
- this.shadow.innerHTML = `<input part="default" type="${this.type}" class="${i}"${h}></input>`, this.$input = m("input", this.root), g(this.$input, "input", this._input), this.style.cssText = v(this._getStyleObj()) + this.getAttr("style", ""), a && this.formAttrs.id && y(this.formAttrs.id, "validateChange", this._validateChange);
52
+ }), r = this.getName(), a = n("name", r), l = `${e}${a}${s}${t}`;
53
+ this.shadow.innerHTML = `<input part="default" type="${this.type}" class="${i}"${l}></input>`, this.$input = h("input", this.root), p(this.$input, "input", this._input), this.style.cssText = d(this._getStyleObj()) + this.getAttr("style", ""), r && this.formAttrs.id && b(this.formAttrs.id, "validateChange", this._validateChange);
77
54
  }
78
55
  /**
79
56
  * 设置自定义的输入解析器
80
57
  * @param cb
81
58
  */
82
- setParser(t) {
83
- this.parser = t;
59
+ setParser(e) {
60
+ this.parser = e;
84
61
  }
85
62
  focus() {
86
- var t;
87
- (t = this.$input) == null || t.focus();
63
+ this.$input?.focus();
88
64
  }
65
+ _input = (e) => {
66
+ const s = e.target;
67
+ let t = s.value;
68
+ if (this.allowInput != null) {
69
+ let i = this.allowInput.indexOf("."), r = i === -1 ? i : parseInt(this.allowInput.substring(i + 1));
70
+ t = this._numberInputParse(t, {
71
+ integer: this.allowInput.includes("integer"),
72
+ negative: this.allowInput.startsWith("-"),
73
+ precition: r
74
+ }), t = String(t), s.value = t;
75
+ }
76
+ this.parser != null && (t = this.parser(t), s.value = t), this.setValue(t);
77
+ };
89
78
  _changeDisabled() {
90
79
  this.$input != null && (this.$input.disabled = this.isDisabled());
91
80
  }
92
- _numberInputParse(t, s) {
93
- let e = t, i = s.negative ? "-?" : "";
81
+ _numberInputParse(e, s) {
82
+ let t = e, i = s.negative ? "-?" : "";
94
83
  if (s.integer) {
95
- const o = e.match(new RegExp(`^(${i}\\d*)`));
96
- return o != null ? o[1] : e.substring(0, e.length - 1);
84
+ const a = t.match(new RegExp(`^(${i}\\d*)`));
85
+ return a != null ? a[1] : t.substring(0, t.length - 1);
97
86
  }
98
- const a = e.match(
87
+ const r = t.match(
99
88
  new RegExp(
100
89
  `(${i}\\d+\\.\\d{0,${s.precition}})|(${i}\\d*)`
101
90
  )
102
91
  );
103
- return a != null ? e = a[1] || a[2] : e = "", a != null ? a[1] || a[2] : "";
92
+ return r != null ? t = r[1] || r[2] : t = "", r != null ? r[1] || r[2] : "";
104
93
  }
105
94
  _getStyleObj() {
106
- const t = {};
107
- return this._isBlock() && (t["--l-input-width"] = "100%"), this.width && (t["--l-input-width"] = this.width), t;
95
+ const e = {};
96
+ return this._isBlock() && (e["--l-input-width"] = "100%"), this.width && (e["--l-input-width"] = this.width), e;
108
97
  }
109
98
  _isBlock() {
110
99
  if (this.block === !0 || this.formItemAttrs.innerBlock === !0 || this.formAttrs.innerBlock === !0) return !0;
111
100
  }
112
101
  _updateError() {
113
- this.$input && (this.error ? $(this.$input, "is-error") : b(this.$input, "is-error"));
102
+ this.$input && (this.error ? c(this.$input, "is-error") : f(this.$input, "is-error"));
114
103
  }
104
+ _validateChange = (e, s) => {
105
+ const t = this.getName();
106
+ if (t) {
107
+ const i = e === !0 ? !1 : e[t] != null;
108
+ (s == null || s === t && this.error != i) && (this.error = i, this._updateError()), Object.keys(e)[0] === t && this.focus();
109
+ }
110
+ };
115
111
  }
116
- r(A, "baseName", "input");
117
112
  export {
118
- A as default
113
+ S as default
119
114
  };
package/lib/list/index.js CHANGED
@@ -1,36 +1,33 @@
1
- var a = Object.defineProperty;
2
- var h = (o, t, i) => t in o ? a(o, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : o[t] = i;
3
- var s = (o, t, i) => h(o, typeof t != "symbol" ? t + "" : t, i);
4
- import c from "../base.js";
5
- import { initAttr as f, parseAttrValue as d } from "../utils/index.js";
6
- import { $one as r } from "ph-utils/dom";
7
- import { a as m } from "../animation-DttknHkX.js";
8
- const v = ":host{display:block;overflow:auto;-webkit-overflow-scrolling:touch;height:100%;position:relative}.l-list-loadmore{padding:10px;display:flex;align-items:center;justify-content:center;color:#999}.l-list-icon{font-size:24px;margin-right:10px;transform:rotate3d(0,0,1,80deg)}";
9
- class b extends c {
1
+ import r from "../base.js";
2
+ import { initAttr as n, parseAttrValue as l } from "../utils/index.js";
3
+ import { $one as e } from "ph-utils/dom";
4
+ import { a } from "../animation-DttknHkX.js";
5
+ const h = ":host{display:block;overflow:auto;-webkit-overflow-scrolling:touch;height:100%;position:relative}.l-list-loadmore{padding:10px;display:flex;align-items:center;justify-content:center;color:#999}.l-list-icon{font-size:24px;margin-right:10px;transform:rotate3d(0,0,1,80deg)}";
6
+ class b extends r {
7
+ static baseName = "list";
8
+ /** 是否已经全部加载完成 */
9
+ finish = !1;
10
+ /** 是否显示无限加载模式 */
11
+ infinite = !0;
12
+ observer;
13
+ loadMoreEmit;
14
+ $more;
10
15
  constructor() {
11
- super();
12
- /** 是否已经全部加载完成 */
13
- s(this, "finish", !1);
14
- /** 是否显示无限加载模式 */
15
- s(this, "infinite", !0);
16
- s(this, "observer");
17
- s(this, "loadMoreEmit");
18
- s(this, "$more");
19
- f(this), this.loadMoreEmit = new CustomEvent("load-more");
16
+ super(), n(this), this.loadMoreEmit = new CustomEvent("load-more");
20
17
  }
21
18
  static get observedAttributes() {
22
19
  return ["finish"];
23
20
  }
24
- attributeChangedCallback(i, e, l) {
21
+ attributeChangedCallback(i, t, o) {
25
22
  if (i === "finish") {
26
- const n = d(l, !1, i);
27
- this.finish !== n && (this.finish = n, this._finishChange());
23
+ const s = l(o, !1, i);
24
+ this.finish !== s && (this.finish = s, this._finishChange());
28
25
  }
29
26
  }
30
27
  connectedCallback() {
31
- this.loadStyleText([v, m]), super.connectedCallback(), this.infinite && (this.observer = new IntersectionObserver((i) => {
28
+ this.loadStyleText([h, a]), super.connectedCallback(), this.infinite && (this.observer = new IntersectionObserver((i) => {
32
29
  i[0].isIntersecting && !this.finish && this.dispatchEvent(this.loadMoreEmit);
33
- }), this.$more = r(".l-list-loadmore", this.root), !this.finish && this.$more && this.observer.observe(this.$more));
30
+ }), this.$more = e(".l-list-loadmore", this.root), !this.finish && this.$more && this.observer.observe(this.$more));
34
31
  }
35
32
  disconnectedCallback() {
36
33
  super.disconnectedCallback(), this.observer && (this.$more && (this.observer.unobserve(this.$more), this.$more = void 0), this.observer.disconnect(), this.observer = void 0), this.loadMoreEmit = void 0;
@@ -49,14 +46,13 @@ class b extends c {
49
46
  _finishChange() {
50
47
  if (this.$more) {
51
48
  this.observer && (this.finish ? this.observer.unobserve(this.$more) : this.observer.observe(this.$more));
52
- const i = r(".l-list-loadmore-text", this.$more);
49
+ const i = e(".l-list-loadmore-text", this.$more);
53
50
  i && (i.textContent = this._loadingText());
54
- let e = r(".l-list-icon", this.$more);
55
- this.finish ? e && e.remove() : e == null && (e = document.createElement("l-loading-icon"), e.className = "l-list-icon l-rotate-anim", this.$more.prepend(e));
51
+ let t = e(".l-list-icon", this.$more);
52
+ this.finish ? t && t.remove() : t == null && (t = document.createElement("l-loading-icon"), t.className = "l-list-icon l-rotate-anim", this.$more.prepend(t));
56
53
  }
57
54
  }
58
55
  }
59
- s(b, "baseName", "list");
60
56
  export {
61
57
  b as default
62
58
  };