litos-ui 0.12.2 → 0.14.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 (86) hide show
  1. package/lib/base.d.ts +23 -2
  2. package/lib/base.js +37 -8
  3. package/lib/button/index.d.ts +3 -1
  4. package/lib/button/index.js +18 -19
  5. package/lib/carousel/index.d.ts +20 -0
  6. package/lib/carousel/index.js +280 -0
  7. package/lib/carousel/item.d.ts +6 -0
  8. package/lib/carousel/item.js +15 -0
  9. package/lib/carousel/timer.d.ts +5 -0
  10. package/lib/carousel/timer.js +19 -0
  11. package/lib/check/check.d.ts +22 -0
  12. package/lib/check/check.js +81 -0
  13. package/lib/check/checkbox.d.ts +7 -0
  14. package/lib/check/checkbox.js +25 -0
  15. package/lib/check/checkbox_group.d.ts +9 -0
  16. package/lib/check/checkbox_group.js +33 -0
  17. package/lib/check/index.d.ts +12 -0
  18. package/lib/check/index.js +35 -0
  19. package/lib/check/radio.d.ts +6 -0
  20. package/lib/check/radio.js +19 -0
  21. package/lib/check/radio_group.d.ts +6 -0
  22. package/lib/check/radio_group.js +24 -0
  23. package/lib/check-BlDsQQo0.js +4 -0
  24. package/lib/color_picker/index.d.ts +1 -1
  25. package/lib/color_picker/index.js +6 -6
  26. package/lib/date_picker/index.d.ts +22 -0
  27. package/lib/date_picker/index.js +99 -0
  28. package/lib/dialog/dialog_container.d.ts +28 -0
  29. package/lib/dialog/dialog_container.js +100 -0
  30. package/lib/dialog/index.d.ts +30 -0
  31. package/lib/dialog/index.js +86 -0
  32. package/lib/form/form_inner.d.ts +3 -5
  33. package/lib/form/form_inner.js +29 -31
  34. package/lib/form/form_item.d.ts +1 -3
  35. package/lib/form/form_item.js +30 -41
  36. package/lib/form/index.d.ts +0 -2
  37. package/lib/form/index.js +23 -25
  38. package/lib/icon/base.d.ts +0 -1
  39. package/lib/icon/base.js +15 -17
  40. package/lib/icon/close.d.ts +5 -0
  41. package/lib/icon/close.js +10 -0
  42. package/lib/icon/{mask_close.d.ts → close_filled.d.ts} +1 -1
  43. package/lib/icon/{mask_close.js → close_filled.js} +1 -1
  44. package/lib/index-dwS1N2uN.js +4 -0
  45. package/lib/index.d.ts +40 -6
  46. package/lib/index.js +120 -87
  47. package/lib/input/index.d.ts +6 -5
  48. package/lib/input/index.js +105 -57
  49. package/lib/list/index.d.ts +2 -3
  50. package/lib/list/index.js +17 -17
  51. package/lib/litos-ui.css +1 -1
  52. package/lib/loading/index.d.ts +45 -0
  53. package/lib/loading/index.js +141 -0
  54. package/lib/md_input/index.js +9 -9
  55. package/lib/menu/base.js +1 -0
  56. package/lib/menu/index.d.ts +31 -0
  57. package/lib/menu/index.js +95 -0
  58. package/lib/menu/menu_item.d.ts +6 -0
  59. package/lib/menu/menu_item.js +21 -0
  60. package/lib/menu/sub_menu.d.ts +15 -0
  61. package/lib/menu/sub_menu.js +82 -0
  62. package/lib/message/index.js +1 -1
  63. package/lib/modal/index.d.ts +40 -0
  64. package/lib/modal/index.js +153 -0
  65. package/lib/modal/modal_box.js +95 -0
  66. package/lib/popover/index.d.ts +1 -4
  67. package/lib/popover/index.js +6 -12
  68. package/lib/select_ori/index.d.ts +1 -3
  69. package/lib/select_ori/index.js +12 -16
  70. package/lib/switch/index.d.ts +0 -1
  71. package/lib/switch/index.js +8 -13
  72. package/lib/tabbar/index.d.ts +0 -1
  73. package/lib/tabbar/index.js +55 -63
  74. package/lib/theme/index.d.ts +1 -2
  75. package/lib/theme/index.js +9 -12
  76. package/lib/utils/index.d.ts +1 -6
  77. package/lib/utils/index.js +47 -54
  78. package/lib/utils/transition.js +4 -2
  79. package/package.json +8 -8
  80. package/styles/vars.css +1 -1
  81. package/lib/checkbox/index.d.ts +0 -17
  82. package/lib/checkbox/index.js +0 -135
  83. package/lib/index-391POYEJ.js +0 -4
  84. package/lib/litos-ui.min.js +0 -1
  85. package/lib/radio/index.d.ts +0 -28
  86. package/lib/radio/index.js +0 -122
package/lib/index.d.ts CHANGED
@@ -4,6 +4,10 @@ export { default as BaseComponent } from "./base";
4
4
  export { default as Message } from "./message";
5
5
  export { default as Popover } from "./popover";
6
6
  export { default as Popconfirm } from "./popconfirm";
7
+ export { default as Dialog } from "./dialog";
8
+ export { default as DialogContainer } from "./dialog/dialog_container";
9
+ export { default as Loading } from "./loading";
10
+ export { default as Modal } from "./modal";
7
11
  export { default as BaseIcon } from "./icon/base";
8
12
  export { default as ArrowDownIcon } from "./icon/arrow_down";
9
13
  export { default as ArrowLeftIcon } from "./icon/arrow_left";
@@ -21,27 +25,44 @@ export { default as RefreshLeftIcon } from "./icon/refresh_left";
21
25
  export { default as RefreshRightIcon } from "./icon/refresh_right";
22
26
  export { default as SortIcon } from "./icon/sort";
23
27
  export { default as ThemeDefaultIcon } from "./icon/theme_default";
28
+ export { default as CloseIcon } from "./icon/close";
29
+ export { default as InfoIcon } from "./icon/info";
30
+ export { default as SuccessIcon } from "./icon/success";
31
+ export { default as WarnIcon } from "./icon/warn";
32
+ export { default as CloseFilledIcon } from "./icon/close_filled";
24
33
  export { default as Form } from "./form";
25
34
  export { default as FormItem } from "./form/form_item";
26
- export { default as Radio } from "./radio";
27
- export { default as Checkbox } from "./checkbox";
35
+ export { default as RadioGroup } from "./check/radio_group";
36
+ export { default as Radio } from "./check/radio";
37
+ export { default as Checkbox } from "./check/checkbox";
38
+ export { default as CheckboxGroup } from "./check/checkbox_group";
28
39
  export { default as Button } from "./button";
29
40
  export { default as Input } from "./input";
30
41
  export { default as SelectOri } from "./select_ori";
31
42
  export { default as Switch } from "./switch";
43
+ export { default as MdInput } from "./md_input";
32
44
  export { default as List } from "./list";
33
45
  export { default as Polygon } from "./polygon";
34
46
  export { default as ColorPicker } from "./color_picker";
35
47
  export { default as Tabbar } from "./tabbar";
36
48
  export { default as Theme } from "./theme";
37
49
  export { default as ThemeColor } from "./theme/theme_color";
38
- export { default as MdInput } from "./md_input";
50
+ export { default as DatePicker } from "./date_picker";
51
+ export { default as Menu } from "./menu";
52
+ export { default as MenuItem } from "./menu/menu_item";
53
+ export { default as SubMenu } from "./menu/sub_menu";
54
+ export { default as Carousel } from "./carousel";
55
+ export { default as CarouselItem } from "./carousel/item";
39
56
 
40
57
  declare global {
41
58
  interface HTMLElementTagNameMap {
42
59
  "l-base-component": import("./base").default
43
60
  "l-popover": import("./popover").default
44
61
  "l-popconfirm": import("./popconfirm").default
62
+ "l-dialog": import("./dialog").default
63
+ "l-dialog-container": import("./dialog/dialog_container").default
64
+ "l-loading": import("./loading").default
65
+ "l-modal": import("./modal").default
45
66
  "l-base-icon": import("./icon/base").default
46
67
  "l-arrow-down-icon": import("./icon/arrow_down").default
47
68
  "l-arrow-left-icon": import("./icon/arrow_left").default
@@ -59,20 +80,33 @@ declare global {
59
80
  "l-refresh-right-icon": import("./icon/refresh_right").default
60
81
  "l-sort-icon": import("./icon/sort").default
61
82
  "l-theme-default-icon": import("./icon/theme_default").default
83
+ "l-close-icon": import("./icon/close").default
84
+ "l-info-icon": import("./icon/info").default
85
+ "l-success-icon": import("./icon/success").default
86
+ "l-warn-icon": import("./icon/warn").default
87
+ "l-close-filled-icon": import("./icon/close_filled").default
62
88
  "l-form": import("./form").default
63
89
  "l-form-item": import("./form/form_item").default
64
- "l-radio": import("./radio").default
65
- "l-checkbox": import("./checkbox").default
90
+ "l-radio-group": import("./check/radio_group").default
91
+ "l-radio": import("./check/radio").default
92
+ "l-checkbox": import("./check/checkbox").default
93
+ "l-checkbox-group": import("./check/checkbox_group").default
66
94
  "l-button": import("./button").default
67
95
  "l-input": import("./input").default
68
96
  "l-select-ori": import("./select_ori").default
69
97
  "l-switch": import("./switch").default
98
+ "l-md-input": import("./md_input").default
70
99
  "l-list": import("./list").default
71
100
  "l-polygon": import("./polygon").default
72
101
  "l-color-picker": import("./color_picker").default
73
102
  "l-tabbar": import("./tabbar").default
74
103
  "l-theme": import("./theme").default
75
104
  "l-theme-color": import("./theme/theme_color").default
76
- "l-md-input": import("./md_input").default
105
+ "l-date-picker": import("./date_picker").default
106
+ "l-menu": import("./menu").default
107
+ "l-menu-item": import("./menu/menu_item").default
108
+ "l-sub-menu": import("./menu/sub_menu").default
109
+ "l-carousel": import("./carousel").default
110
+ "l-carousel-item": import("./carousel/item").default
77
111
  }
78
112
  }
package/lib/index.js CHANGED
@@ -1,90 +1,123 @@
1
- import { config as t, createTransition as r, getPopoverOffsetX as a, getPopoverOffsetY as f, impactDetect as s, initAttr as m, parseAttrValue as p, regist as u, setAttrs as d, tagAttr as l, tagAttrs as x, useId as n } from "./utils/index.js";
2
- import { set as i, remove as I } from "./utils/clickoutside.js";
3
- import { default as h } from "./base.js";
4
- import { default as C } from "./message/index.js";
5
- import { default as P } from "./popover/index.js";
6
- import { default as T } from "./popconfirm/index.js";
7
- import { default as O } from "./icon/base.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
- import { default as M } from "./icon/arrow_up.js";
12
- import { default as U } from "./icon/caret_top.js";
13
- import { default as X } from "./icon/caret_bottom.js";
14
- import { default as j } from "./icon/font_icon.js";
15
- import { default as z } from "./icon/loading.js";
16
- import { default as G } from "./icon/search.js";
17
- import { default as J } from "./icon/sun.js";
18
- import { default as N } from "./icon/moon.js";
19
- import { default as W } from "./icon/reduction.js";
20
- import { default as _ } from "./icon/refresh_left.js";
21
- import { default as oo } from "./icon/refresh_right.js";
22
- import { default as to } from "./icon/sort.js";
23
- import { default as ao } from "./icon/theme_default.js";
24
- import { default as so } from "./form/index.js";
25
- import { default as po } from "./form/form_item.js";
26
- import { default as lo } from "./radio/index.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";
1
+ import { createTransition as t, getPopoverOffsetX as r, getPopoverOffsetY as a, impactDetect as f, initAttr as s, parseAttrValue as u, regist as l, setAttrs as m, tagAttr as p, tagAttrs as d, useId as x } from "./utils/index.js";
2
+ import { set as c, remove as I } from "./utils/clickoutside.js";
3
+ import { default as C } from "./base.js";
4
+ import { default as h } from "./message/index.js";
5
+ import { default as M } from "./popover/index.js";
6
+ import { default as R } from "./popconfirm/index.js";
7
+ import { default as k } from "./dialog/index.js";
8
+ import { default as D } from "./dialog/dialog_container.js";
9
+ import { default as b } from "./loading/index.js";
10
+ import { default as L } from "./modal/index.js";
11
+ import { default as B } from "./icon/base.js";
12
+ import { default as G } from "./icon/arrow_down.js";
13
+ import { default as U } from "./icon/arrow_left.js";
14
+ import { default as W } from "./icon/arrow_right.js";
15
+ import { default as Y } from "./icon/arrow_up.js";
16
+ import { default as q } from "./icon/caret_top.js";
17
+ import { default as E } from "./icon/caret_bottom.js";
18
+ import { default as J } from "./icon/font_icon.js";
19
+ import { default as N } from "./icon/loading.js";
20
+ import { default as Z } from "./icon/search.js";
21
+ import { default as $ } from "./icon/sun.js";
22
+ import { default as eo } from "./icon/moon.js";
23
+ import { default as ro } from "./icon/reduction.js";
24
+ import { default as fo } from "./icon/refresh_left.js";
25
+ import { default as uo } from "./icon/refresh_right.js";
26
+ import { default as mo } from "./icon/sort.js";
27
+ import { default as xo } from "./icon/theme_default.js";
28
+ import { default as co } from "./icon/close.js";
29
+ import { default as io } from "./icon/info.js";
30
+ import { default as go } from "./icon/success.js";
31
+ import { default as Ao } from "./icon/warn.js";
32
+ import { default as Po } from "./icon/close_filled.js";
33
+ import { default as So } from "./form/index.js";
34
+ import { default as wo } from "./form/form_item.js";
35
+ import { default as To } from "./check/radio_group.js";
36
+ import { default as vo } from "./check/radio.js";
37
+ import { default as Oo } from "./check/checkbox.js";
38
+ import { default as Fo } from "./check/checkbox_group.js";
39
+ import { default as yo } from "./button/index.js";
40
+ import { default as Vo } from "./input/index.js";
41
+ import { default as Xo } from "./select_ori/index.js";
42
+ import { default as jo } from "./switch/index.js";
43
+ import { default as zo } from "./md_input/index.js";
44
+ import { default as Ho } from "./list/index.js";
45
+ import { default as Ko } from "./polygon/index.js";
46
+ import { default as Qo } from "./color_picker/index.js";
47
+ import { default as _o } from "./tabbar/index.js";
48
+ import { default as oe } from "./theme/index.js";
49
+ import { default as te } from "./theme/theme_color.js";
50
+ import { default as ae } from "./date_picker/index.js";
51
+ import { default as se } from "./menu/index.js";
52
+ import { default as le } from "./menu/menu_item.js";
53
+ import { default as pe } from "./menu/sub_menu.js";
54
+ import { default as xe } from "./carousel/index.js";
55
+ import { default as ce } from "./carousel/item.js";
39
56
  export {
40
- k as ArrowDownIcon,
41
- L as ArrowLeftIcon,
42
- D as ArrowRightIcon,
43
- M as ArrowUpIcon,
44
- h as BaseComponent,
45
- O as BaseIcon,
46
- io as Button,
47
- X as CaretBottomIcon,
48
- U as CaretTopIcon,
49
- no as Checkbox,
50
- So as ColorPicker,
51
- j as FontIcon,
52
- so as Form,
53
- po as FormItem,
54
- go as Input,
55
- Ro as List,
56
- z as LoadingIcon,
57
- yo as MdInput,
58
- C as Message,
59
- N as MoonIcon,
60
- vo as Polygon,
61
- T as Popconfirm,
62
- P as Popover,
63
- lo as Radio,
64
- W as ReductionIcon,
65
- _ as RefreshLeftIcon,
66
- oo as RefreshRightIcon,
67
- G as SearchIcon,
68
- Ao as SelectOri,
69
- to as SortIcon,
70
- J as SunIcon,
71
- wo as Switch,
72
- Bo as Tabbar,
73
- bo as Theme,
74
- Fo as ThemeColor,
75
- ao as ThemeDefaultIcon,
76
- i as addClickOutside,
77
- t as config,
78
- r as createTransition,
79
- a as getPopoverOffsetX,
80
- f as getPopoverOffsetY,
81
- s as impactDetect,
82
- m as initAttr,
83
- p as parseAttrValue,
84
- u as regist,
57
+ G as ArrowDownIcon,
58
+ U as ArrowLeftIcon,
59
+ W as ArrowRightIcon,
60
+ Y as ArrowUpIcon,
61
+ C as BaseComponent,
62
+ B as BaseIcon,
63
+ yo as Button,
64
+ E as CaretBottomIcon,
65
+ q as CaretTopIcon,
66
+ xe as Carousel,
67
+ ce as CarouselItem,
68
+ Oo as Checkbox,
69
+ Fo as CheckboxGroup,
70
+ Po as CloseFilledIcon,
71
+ co as CloseIcon,
72
+ Qo as ColorPicker,
73
+ ae as DatePicker,
74
+ k as Dialog,
75
+ D as DialogContainer,
76
+ J as FontIcon,
77
+ So as Form,
78
+ wo as FormItem,
79
+ io as InfoIcon,
80
+ Vo as Input,
81
+ Ho as List,
82
+ b as Loading,
83
+ N as LoadingIcon,
84
+ zo as MdInput,
85
+ se as Menu,
86
+ le as MenuItem,
87
+ h as Message,
88
+ L as Modal,
89
+ eo as MoonIcon,
90
+ Ko as Polygon,
91
+ R as Popconfirm,
92
+ M as Popover,
93
+ vo as Radio,
94
+ To as RadioGroup,
95
+ ro as ReductionIcon,
96
+ fo as RefreshLeftIcon,
97
+ uo as RefreshRightIcon,
98
+ Z as SearchIcon,
99
+ Xo as SelectOri,
100
+ mo as SortIcon,
101
+ pe as SubMenu,
102
+ go as SuccessIcon,
103
+ $ as SunIcon,
104
+ jo as Switch,
105
+ _o as Tabbar,
106
+ oe as Theme,
107
+ te as ThemeColor,
108
+ xo as ThemeDefaultIcon,
109
+ Ao as WarnIcon,
110
+ c as addClickOutside,
111
+ t as createTransition,
112
+ r as getPopoverOffsetX,
113
+ a as getPopoverOffsetY,
114
+ f as impactDetect,
115
+ s as initAttr,
116
+ u as parseAttrValue,
117
+ l as regist,
85
118
  I as removeClickOutside,
86
- d as setAttrs,
87
- l as tagAttr,
88
- x as tagAttrs,
89
- n as useId
119
+ m as setAttrs,
120
+ p as tagAttr,
121
+ d as tagAttrs,
122
+ x as useId
90
123
  };
@@ -13,6 +13,7 @@ import FormInner from "../form/form_inner";
13
13
  * @method focus - 输入框获取焦点
14
14
  */
15
15
  export default class Input extends FormInner {
16
+ #private;
16
17
  static baseName: string;
17
18
  /** 原生 input 的 type */
18
19
  type: string;
@@ -27,23 +28,23 @@ export default class Input extends FormInner {
27
28
  /** 宽度铺满 */
28
29
  block: boolean;
29
30
  error: boolean;
30
- private $input;
31
- constructor();
31
+ /** clearable */
32
+ clearable: boolean;
33
+ $inner?: HTMLInputElement;
32
34
  set value(value: any);
33
35
  get value(): any;
34
36
  static get observedAttributes(): string[];
35
37
  connectedCallback(): void;
36
38
  disconnectedCallback(): void;
37
39
  protected attributeChange(name: string, oldValue: string, newValue: string): void;
38
- render(): void;
40
+ render(): DocumentFragment;
39
41
  /**
40
42
  * 设置自定义的输入解析器
41
43
  * @param cb
42
44
  */
43
45
  setParser(cb: (value: string) => string): void;
44
- focus(): void;
45
46
  _input: (e: Event) => void;
46
- _changeDisabled(): void;
47
+ disabledChange(): void;
47
48
  private _numberInputParse;
48
49
  private _getStyleObj;
49
50
  private _isBlock;
@@ -1,9 +1,9 @@
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 {
1
+ import { $one as h, on as a, formatStyle as p, addClass as o, off as u, $ as d, $$ as n, removeClass as f } from "ph-utils/dom";
2
+ import { initAttr as c, parseAttrValue as m } from "../utils/index.js";
3
+ import b from "../form/form_inner.js";
4
+ import { add as g, remove as v } from "../utils/event.js";
5
+ import { i as C } from "../index-dwS1N2uN.js";
6
+ class y extends b {
7
7
  static baseName = "input";
8
8
  /** 原生 input 的 type */
9
9
  type = "text";
@@ -18,12 +18,11 @@ class S extends v {
18
18
  /** 宽度铺满 */
19
19
  block = !1;
20
20
  error = !1;
21
- $input = void 0;
22
- constructor() {
23
- super(), m(this);
24
- }
25
- set value(e) {
26
- this.setValue(e), this.$input != null && (this.$input.value = this.value);
21
+ /** clearable */
22
+ clearable = !1;
23
+ $inner;
24
+ set value(t) {
25
+ this.setValue(t), this.$inner && (this.$inner.value = t);
27
26
  }
28
27
  get value() {
29
28
  return this.getValue();
@@ -32,83 +31,132 @@ class S extends v {
32
31
  return ["disabled", "error"];
33
32
  }
34
33
  connectedCallback() {
35
- super.connectedCallback(), this.loadStyleText([_]);
34
+ c(this), this.loadStyleText([C]), super.connectedCallback(), this.$inner = h(".l-input__inner", this.root), a(this.$inner, "input", this._input), a(this.$inner, "change", this.#i), this.style.cssText = p(this._getStyleObj()) + this.getAttr("style", ""), this.error && o(this, "is-error"), this.getName() && this.formAttrs.id && g(this.formAttrs.id, "validateChange", this._validateChange);
36
35
  }
37
36
  disconnectedCallback() {
38
- super.disconnectedCallback(), this.formAttrs.id && $(this.formAttrs.id, "validateChange", this._validateChange), u(this.$input, "input", this._input), this.$input = void 0;
37
+ super.disconnectedCallback(), this.formAttrs.id && v(this.formAttrs.id, "validateChange", this._validateChange), u(this.$inner, "input", this._input);
39
38
  }
40
- attributeChange(e, s, t) {
41
- if (e === "error") {
42
- const i = g(t, !1, e);
43
- i !== this.error && (this.error = i, this._updateError());
39
+ attributeChange(t, i, e) {
40
+ if (t === "error") {
41
+ const s = m(e, !1, t);
42
+ s !== this.error && (this.error = s, this._updateError());
44
43
  }
45
44
  }
46
45
  render() {
47
- let e = n("value", this.value);
48
- const s = n("placeholder", this.placeholder), t = n("disabled", this.isDisabled()), i = o({
49
- "l-input": !0,
50
- "is-autosize": this.autosize,
51
- "is-error": this.error
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);
46
+ const t = document.createDocumentFragment();
47
+ if (d('[slot="prefix"]', this).length > 0) {
48
+ const r = n("slot", {
49
+ name: "prefix"
50
+ }), l = n("span", {
51
+ class: "l-input__prefix",
52
+ part: "prefix"
53
+ });
54
+ l.appendChild(r), t.appendChild(l);
55
+ }
56
+ const e = n("input", {
57
+ class: "l-input__inner",
58
+ value: this.value,
59
+ name: this.getName(),
60
+ placeholder: this.placeholder,
61
+ disabled: this.isDisabled(),
62
+ part: "default",
63
+ type: this.type
64
+ });
65
+ if (t.appendChild(e), d('[slot="suffix"]', this).length > 0) {
66
+ const r = n("slot", {
67
+ name: "suffix"
68
+ }), l = n("span", {
69
+ class: "l-input__suffix",
70
+ part: "suffix"
71
+ });
72
+ l.appendChild(r), t.appendChild(l);
73
+ }
74
+ return t;
54
75
  }
55
76
  /**
56
77
  * 设置自定义的输入解析器
57
78
  * @param cb
58
79
  */
59
- setParser(e) {
60
- this.parser = e;
80
+ setParser(t) {
81
+ this.parser = t;
61
82
  }
62
- focus() {
63
- this.$input?.focus();
64
- }
65
- _input = (e) => {
66
- const s = e.target;
67
- let t = s.value;
83
+ _input = (t) => {
84
+ const i = t.target;
85
+ let e = i.value;
68
86
  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, {
87
+ let s = this.allowInput.indexOf("."), r = s === -1 ? s : parseInt(this.allowInput.substring(s + 1));
88
+ e = this._numberInputParse(e, {
71
89
  integer: this.allowInput.includes("integer"),
72
90
  negative: this.allowInput.startsWith("-"),
73
91
  precition: r
74
- }), t = String(t), s.value = t;
92
+ }), e = String(e), i.value = e;
75
93
  }
76
- this.parser != null && (t = this.parser(t), s.value = t), this.setValue(t);
94
+ this.parser != null && (e = this.parser(e), i.value = e), this.setValue(e), this.#t();
77
95
  };
78
- _changeDisabled() {
79
- this.$input != null && (this.$input.disabled = this.isDisabled());
96
+ #t() {
97
+ if (this.clearable) {
98
+ let t = h(".l-clearable", this.root);
99
+ if (this.value.length > 0) {
100
+ if (t == null) {
101
+ t = n("span", {
102
+ class: "l-input__suffix l-clearable"
103
+ });
104
+ const i = n("l-close-filled-icon");
105
+ t.appendChild(i), this.root.appendChild(t), a(t, "click", this.#e);
106
+ }
107
+ } else
108
+ t && (u(t, "click", this.#e), t.remove());
109
+ }
80
110
  }
81
- _numberInputParse(e, s) {
82
- let t = e, i = s.negative ? "-?" : "";
83
- if (s.integer) {
84
- const a = t.match(new RegExp(`^(${i}\\d*)`));
85
- return a != null ? a[1] : t.substring(0, t.length - 1);
111
+ #e = () => {
112
+ this.value = "", this.dispatchEvent(
113
+ new CustomEvent("input", { bubbles: !0, detail: { value: this.value } })
114
+ ), this.#t();
115
+ };
116
+ disabledChange() {
117
+ this.isDisabled() ? this.classList.add("is-disabled") : this.classList.remove("is-disabled"), this.$inner && (this.$inner.disabled = this.isDisabled());
118
+ }
119
+ _numberInputParse(t, i) {
120
+ let e = t, s = i.negative ? "-?" : "";
121
+ if (i.integer) {
122
+ const l = e.match(new RegExp(`^(${s}\\d*)`));
123
+ return l != null ? l[1] : e.substring(0, e.length - 1);
86
124
  }
87
- const r = t.match(
125
+ const r = e.match(
88
126
  new RegExp(
89
- `(${i}\\d+\\.\\d{0,${s.precition}})|(${i}\\d*)`
127
+ `(${s}\\d+\\.\\d{0,${i.precition}})|(${s}\\d*)`
90
128
  )
91
129
  );
92
- return r != null ? t = r[1] || r[2] : t = "", r != null ? r[1] || r[2] : "";
130
+ return r != null ? e = r[1] || r[2] : e = "", r != null ? r[1] || r[2] : "";
93
131
  }
94
132
  _getStyleObj() {
95
- const e = {};
96
- return this._isBlock() && (e["--l-input-width"] = "100%"), this.width && (e["--l-input-width"] = this.width), e;
133
+ const t = {};
134
+ return this._isBlock() && (t["--l-input-width"] = "100%"), this.width && (t["--l-input-width"] = this.width), t;
97
135
  }
98
136
  _isBlock() {
99
- if (this.block === !0 || this.formItemAttrs.innerBlock === !0 || this.formAttrs.innerBlock === !0) return !0;
137
+ return this.block === !0 || this.formItemAttrs.innerBlock === !0 || this.formAttrs.innerBlock === !0;
100
138
  }
101
139
  _updateError() {
102
- this.$input && (this.error ? c(this.$input, "is-error") : f(this.$input, "is-error"));
140
+ this.error ? o(this, "is-error") : f(this, "is-error");
103
141
  }
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();
142
+ _validateChange = (t, i) => {
143
+ const e = this.getName();
144
+ if (e) {
145
+ const s = t === !0 ? !1 : t[e] != null;
146
+ (i == null || i === e && this.error != s) && (this.error = s, this._updateError()), Object.keys(t)[0] === e && this.focus();
109
147
  }
110
148
  };
149
+ #i = (t) => {
150
+ const i = t.target;
151
+ this.dispatchEvent(
152
+ new CustomEvent("change", {
153
+ bubbles: !0,
154
+ composed: !0,
155
+ detail: { value: i.value }
156
+ })
157
+ );
158
+ };
111
159
  }
112
160
  export {
113
- S as default
161
+ y as default
114
162
  };
@@ -6,14 +6,13 @@ export default class List extends BaseComponent {
6
6
  /** 是否显示无限加载模式 */
7
7
  infinite: boolean;
8
8
  private observer?;
9
- private loadMoreEmit;
10
9
  private $more?;
11
- constructor();
10
+ private _page;
12
11
  static get observedAttributes(): string[] | null | undefined;
13
12
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
14
13
  connectedCallback(): void;
15
14
  disconnectedCallback(): void;
16
15
  render(): string;
17
- _loadingText(): "已经到底啦!" | "加载中……";
16
+ _loadingText(): "加载中……" | "已经到底啦!";
18
17
  _finishChange(): void;
19
18
  }
package/lib/list/index.js CHANGED
@@ -1,8 +1,8 @@
1
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)}";
2
+ import { parseAttrValue as n } from "../utils/index.js";
3
+ import { $one as s } from "ph-utils/dom";
4
+ import { a as l } from "../animation-DttknHkX.js";
5
+ const a = ":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
6
  class b extends r {
7
7
  static baseName = "list";
8
8
  /** 是否已经全部加载完成 */
@@ -10,27 +10,27 @@ class b extends r {
10
10
  /** 是否显示无限加载模式 */
11
11
  infinite = !0;
12
12
  observer;
13
- loadMoreEmit;
14
13
  $more;
15
- constructor() {
16
- super(), n(this), this.loadMoreEmit = new CustomEvent("load-more");
17
- }
14
+ _page = 0;
18
15
  static get observedAttributes() {
19
- return ["finish"];
16
+ return ["finish", "infinite"];
20
17
  }
21
18
  attributeChangedCallback(i, t, o) {
22
19
  if (i === "finish") {
23
- const s = l(o, !1, i);
24
- this.finish !== s && (this.finish = s, this._finishChange());
20
+ const e = n(o, !1, i);
21
+ this.finish !== e && (this.finish = e, this._finishChange());
22
+ } else if (i === "infinite") {
23
+ const e = n(o, !0, i);
24
+ this.infinite !== e && (this.infinite = e);
25
25
  }
26
26
  }
27
27
  connectedCallback() {
28
- this.loadStyleText([h, a]), super.connectedCallback(), this.infinite && (this.observer = new IntersectionObserver((i) => {
29
- i[0].isIntersecting && !this.finish && this.dispatchEvent(this.loadMoreEmit);
30
- }), this.$more = e(".l-list-loadmore", this.root), !this.finish && this.$more && this.observer.observe(this.$more));
28
+ this.loadStyleText([a, l]), super.connectedCallback(), this.infinite && (this.observer = new IntersectionObserver((i) => {
29
+ i[0].isIntersecting && !this.finish && (this._page++, this.setAttribute("loading", ""), this.emit("load", { detail: { page: this._page } }));
30
+ }), this.$more = s(".l-list-loadmore", this.root), !this.finish && this.$more && this.observer.observe(this.$more));
31
31
  }
32
32
  disconnectedCallback() {
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;
33
+ super.disconnectedCallback(), this.observer && (this.$more && (this.observer.unobserve(this.$more), this.$more = void 0), this.observer.disconnect(), this.observer = void 0);
34
34
  }
35
35
  render() {
36
36
  const i = ["<slot></slot>"];
@@ -46,9 +46,9 @@ class b extends r {
46
46
  _finishChange() {
47
47
  if (this.$more) {
48
48
  this.observer && (this.finish ? this.observer.unobserve(this.$more) : this.observer.observe(this.$more));
49
- const i = e(".l-list-loadmore-text", this.$more);
49
+ const i = s(".l-list-loadmore-text", this.$more);
50
50
  i && (i.textContent = this._loadingText());
51
- let t = e(".l-list-icon", this.$more);
51
+ let t = s(".l-list-icon", this.$more);
52
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));
53
53
  }
54
54
  }