litos-ui 0.23.0 → 0.24.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 (312) hide show
  1. package/README.md +2 -2
  2. package/README.zh-CN.md +2 -2
  3. package/lib/base.d.ts +3 -2
  4. package/lib/base.js +11 -8
  5. package/lib/button/index.d.ts +21 -5
  6. package/lib/button/index.js +115 -62
  7. package/lib/button/index.less_inline.js +2 -3
  8. package/lib/button/style.js +1 -2
  9. package/lib/calendar/index.d.ts +1 -0
  10. package/lib/calendar/index.js +19 -17
  11. package/lib/calendar/index.less_inline.js +1 -2
  12. package/lib/calendar/langs.js +21 -11
  13. package/lib/card/index.js +8 -9
  14. package/lib/card/index.less_inline.js +1 -2
  15. package/lib/carousel/index.js +10 -11
  16. package/lib/carousel/index.less_inline.js +1 -2
  17. package/lib/carousel/item.js +1 -2
  18. package/lib/carousel/item.less_inline.js +1 -2
  19. package/lib/carousel/timer.js +1 -2
  20. package/lib/check/check.d.ts +40 -8
  21. package/lib/check/check.js +200 -65
  22. package/lib/check/check.less_inline.js +2 -3
  23. package/lib/check/checkbox.js +2 -3
  24. package/lib/check/checkbox.less_inline.js +2 -3
  25. package/lib/check/checkbox_group.js +1 -2
  26. package/lib/check/index.d.ts +28 -8
  27. package/lib/check/index.js +151 -46
  28. package/lib/check/index.less_inline.js +1 -2
  29. package/lib/check/radio.js +2 -3
  30. package/lib/check/radio.less_inline.js +1 -2
  31. package/lib/check/radio_group.js +2 -3
  32. package/lib/collapse/index.d.ts +12 -4
  33. package/lib/collapse/index.js +80 -46
  34. package/lib/collapse/index.less_inline.js +2 -3
  35. package/lib/collapse/item.d.ts +35 -9
  36. package/lib/collapse/item.js +219 -57
  37. package/lib/collapse/item.less_inline.js +2 -3
  38. package/lib/collapse/types.d.ts +17 -3
  39. package/lib/color_picker/index.d.ts +4 -2
  40. package/lib/color_picker/index.js +26 -17
  41. package/lib/color_picker/index.less_inline.js +1 -2
  42. package/lib/date_picker/index.d.ts +5 -1
  43. package/lib/date_picker/index.js +39 -23
  44. package/lib/date_picker/index.less_inline.js +1 -2
  45. package/lib/date_picker_ori/index.d.ts +7 -2
  46. package/lib/date_picker_ori/index.js +123 -47
  47. package/lib/date_picker_ori/index.less_inline.js +1 -2
  48. package/lib/description_panel/index.js +2 -10
  49. package/lib/description_panel/index.less_inline.js +1 -2
  50. package/lib/dialog/dialog_box.js +28 -29
  51. package/lib/dialog/dialog_container.css_inline.js +1 -2
  52. package/lib/dialog/dialog_container.js +13 -14
  53. package/lib/dialog/dialog_container_style.js +1 -2
  54. package/lib/dialog/index.d.ts +2 -0
  55. package/lib/dialog/index.js +11 -9
  56. package/lib/dropdown/index.d.ts +39 -0
  57. package/lib/dropdown/index.js +98 -0
  58. package/lib/entries/base.js +1 -2
  59. package/lib/entries/button.js +5 -6
  60. package/lib/entries/calendar.js +5 -6
  61. package/lib/entries/card.js +5 -6
  62. package/lib/entries/carousel-item.js +5 -6
  63. package/lib/entries/carousel.js +5 -6
  64. package/lib/entries/checkbox-group.js +5 -6
  65. package/lib/entries/checkbox.js +5 -6
  66. package/lib/entries/collapse-item.d.ts +0 -1
  67. package/lib/entries/collapse-item.js +6 -6
  68. package/lib/entries/collapse.d.ts +0 -1
  69. package/lib/entries/collapse.js +11 -6
  70. package/lib/entries/color-picker.js +5 -6
  71. package/lib/entries/date-picker-ori.js +5 -6
  72. package/lib/entries/date-picker.js +5 -6
  73. package/lib/entries/description-panel.js +5 -6
  74. package/lib/entries/dialog-box.js +1 -2
  75. package/lib/entries/dialog-container.js +5 -6
  76. package/lib/entries/dialog.js +1 -2
  77. package/lib/entries/dropdown.d.ts +2 -0
  78. package/lib/entries/dropdown.js +1 -0
  79. package/lib/entries/form-item.js +5 -6
  80. package/lib/entries/form.js +5 -6
  81. package/lib/entries/icon-arrow-down.js +5 -6
  82. package/lib/entries/icon-arrow-left.js +5 -6
  83. package/lib/entries/icon-arrow-right.js +5 -6
  84. package/lib/entries/icon-arrow-up.js +5 -6
  85. package/lib/entries/icon-base.js +5 -6
  86. package/lib/entries/icon-calendar.js +5 -6
  87. package/lib/entries/icon-caret-bottom.js +5 -6
  88. package/lib/entries/icon-caret-top.js +5 -6
  89. package/lib/entries/icon-close-filled.js +5 -6
  90. package/lib/entries/icon-close.js +5 -6
  91. package/lib/entries/icon-copy.js +5 -6
  92. package/lib/entries/icon-d-arrow-left.js +5 -6
  93. package/lib/entries/icon-d-arrow-right.js +5 -6
  94. package/lib/entries/icon-delete.js +5 -6
  95. package/lib/entries/icon-eye-outline.js +5 -6
  96. package/lib/entries/icon-font-icon.js +5 -6
  97. package/lib/entries/icon-info.js +5 -6
  98. package/lib/entries/icon-loading.js +5 -6
  99. package/lib/entries/icon-minus.js +5 -6
  100. package/lib/entries/icon-moon.js +5 -6
  101. package/lib/entries/icon-more.js +5 -6
  102. package/lib/entries/icon-picture.js +5 -6
  103. package/lib/entries/icon-plus.js +5 -6
  104. package/lib/entries/icon-reduction.js +5 -6
  105. package/lib/entries/icon-refresh-left.js +5 -6
  106. package/lib/entries/icon-refresh-right.js +5 -6
  107. package/lib/entries/icon-refresh.js +5 -6
  108. package/lib/entries/icon-search.js +5 -6
  109. package/lib/entries/icon-select.js +5 -6
  110. package/lib/entries/icon-sort.js +5 -6
  111. package/lib/entries/icon-success.js +5 -6
  112. package/lib/entries/icon-sun.js +5 -6
  113. package/lib/entries/icon-theme-default.js +5 -6
  114. package/lib/entries/icon-warn.js +5 -6
  115. package/lib/entries/icon-zoom-in.js +5 -6
  116. package/lib/entries/icon-zoom-out.js +5 -6
  117. package/lib/entries/image-preview.js +5 -6
  118. package/lib/entries/image.js +5 -6
  119. package/lib/entries/input-number.js +5 -6
  120. package/lib/entries/input.js +5 -6
  121. package/lib/entries/list.js +5 -6
  122. package/lib/entries/loading.js +1 -2
  123. package/lib/entries/mask.js +5 -6
  124. package/lib/entries/md-input.js +5 -6
  125. package/lib/entries/menu.js +5 -6
  126. package/lib/entries/message.js +1 -2
  127. package/lib/entries/modal-box.js +1 -2
  128. package/lib/entries/modal.js +5 -6
  129. package/lib/entries/notification-box.js +1 -2
  130. package/lib/entries/notification.js +1 -2
  131. package/lib/entries/page-header.js +5 -6
  132. package/lib/entries/pagination.js +5 -6
  133. package/lib/entries/polygon.js +5 -6
  134. package/lib/entries/popconfirm.js +1 -2
  135. package/lib/entries/popover.js +1 -2
  136. package/lib/entries/qrcode.js +5 -6
  137. package/lib/entries/radio-group.js +5 -6
  138. package/lib/entries/radio.js +5 -6
  139. package/lib/entries/select-ori.js +5 -6
  140. package/lib/entries/select.js +5 -6
  141. package/lib/entries/space.js +5 -6
  142. package/lib/entries/switch.js +5 -6
  143. package/lib/entries/tabbar-item.js +5 -6
  144. package/lib/entries/tabbar.js +5 -6
  145. package/lib/entries/table.js +5 -6
  146. package/lib/entries/tabs.js +1 -2
  147. package/lib/entries/tag.js +5 -6
  148. package/lib/entries/theme-color.js +5 -6
  149. package/lib/entries/theme.js +5 -6
  150. package/lib/entries/transition.js +1 -2
  151. package/lib/entries/upload.js +5 -6
  152. package/lib/entries/utils.js +1 -2
  153. package/lib/form/accessibility.d.ts +15 -0
  154. package/lib/form/accessibility.js +56 -0
  155. package/lib/form/autocomplete.d.ts +21 -0
  156. package/lib/form/autocomplete.js +59 -0
  157. package/lib/form/context.d.ts +157 -0
  158. package/lib/form/context.js +88 -0
  159. package/lib/form/form_inner.d.ts +99 -24
  160. package/lib/form/form_inner.js +424 -72
  161. package/lib/form/form_item.d.ts +35 -11
  162. package/lib/form/form_item.js +210 -78
  163. package/lib/form/form_item.less_inline.js +2 -3
  164. package/lib/form/form_item_style.d.ts +3 -0
  165. package/lib/form/form_item_style.js +7 -0
  166. package/lib/form/index.d.ts +69 -15
  167. package/lib/form/index.js +501 -101
  168. package/lib/form/index.less_inline.js +1 -2
  169. package/lib/form/owner.d.ts +78 -0
  170. package/lib/form/owner.js +138 -0
  171. package/lib/form/style.d.ts +3 -0
  172. package/lib/form/style.js +7 -0
  173. package/lib/icon/arrow_down.js +1 -2
  174. package/lib/icon/arrow_left.js +1 -2
  175. package/lib/icon/arrow_right.js +1 -2
  176. package/lib/icon/arrow_up.js +1 -2
  177. package/lib/icon/base.js +1 -2
  178. package/lib/icon/calendar.js +1 -2
  179. package/lib/icon/caret_bottom.js +1 -2
  180. package/lib/icon/caret_top.js +1 -2
  181. package/lib/icon/close.js +1 -2
  182. package/lib/icon/close_filled.js +1 -2
  183. package/lib/icon/copy.js +1 -2
  184. package/lib/icon/d_arrow_left.js +1 -2
  185. package/lib/icon/d_arrow_right.js +1 -2
  186. package/lib/icon/delete.js +1 -2
  187. package/lib/icon/eye_outline.js +1 -2
  188. package/lib/icon/font_icon.js +1 -2
  189. package/lib/icon/icon_style.js +1 -2
  190. package/lib/icon/index.less_inline.js +1 -2
  191. package/lib/icon/info.js +1 -2
  192. package/lib/icon/loading.js +1 -2
  193. package/lib/icon/minus.js +1 -2
  194. package/lib/icon/moon.js +1 -2
  195. package/lib/icon/more.js +1 -2
  196. package/lib/icon/picture.js +1 -2
  197. package/lib/icon/plus.js +1 -2
  198. package/lib/icon/reduction.js +1 -2
  199. package/lib/icon/refresh.js +1 -2
  200. package/lib/icon/refresh_left.js +1 -2
  201. package/lib/icon/refresh_right.js +1 -2
  202. package/lib/icon/search.js +1 -2
  203. package/lib/icon/select.js +1 -2
  204. package/lib/icon/sort.js +1 -2
  205. package/lib/icon/success.js +1 -2
  206. package/lib/icon/sun.js +1 -2
  207. package/lib/icon/theme_default.js +1 -2
  208. package/lib/icon/warn.js +1 -2
  209. package/lib/icon/zoom_in.js +1 -2
  210. package/lib/icon/zoom_out.js +1 -2
  211. package/lib/image/image_preview.js +1 -2
  212. package/lib/image/image_preview.less_inline.js +1 -2
  213. package/lib/image/index.js +1 -2
  214. package/lib/image/index.less_inline.js +1 -2
  215. package/lib/index.d.ts +2 -1
  216. package/lib/index.js +88 -87
  217. package/lib/input/index.d.ts +18 -1
  218. package/lib/input/index.js +151 -48
  219. package/lib/input/index.less_inline.js +2 -3
  220. package/lib/input/input_inner.less_inline.js +1 -2
  221. package/lib/input/style.d.ts +3 -0
  222. package/lib/input/style.js +7 -0
  223. package/lib/input_number/index.d.ts +7 -0
  224. package/lib/input_number/index.js +70 -48
  225. package/lib/input_number/index.less_inline.js +1 -2
  226. package/lib/input_number/style.js +1 -2
  227. package/lib/list/index.js +4 -5
  228. package/lib/list/index.less_inline.js +1 -2
  229. package/lib/loading/index.js +1 -2
  230. package/lib/mask/index.js +2 -7
  231. package/lib/mask/index.less_inline.js +1 -2
  232. package/lib/md_input/index.d.ts +11 -2
  233. package/lib/md_input/index.js +63 -27
  234. package/lib/md_input/index.less_inline.js +2 -3
  235. package/lib/menu/index.js +2 -7
  236. package/lib/menu/index.less_inline.js +1 -2
  237. package/lib/message/index.js +1 -2
  238. package/lib/modal/index.js +15 -16
  239. package/lib/modal/index.less_inline.js +1 -2
  240. package/lib/modal/modal_box.js +24 -25
  241. package/lib/notification/index.js +15 -29
  242. package/lib/notification/index.less_inline.js +1 -2
  243. package/lib/notification/notification_box.js +2 -3
  244. package/lib/notification/placement.js +1 -2
  245. package/lib/notification/style.js +1 -2
  246. package/lib/page_header/index.js +1 -2
  247. package/lib/page_header/index.less_inline.js +1 -2
  248. package/lib/pagination/index.js +26 -25
  249. package/lib/pagination/index.less_inline.js +2 -3
  250. package/lib/polygon/index.js +1 -2
  251. package/lib/polygon/index.less_inline.js +1 -2
  252. package/lib/qrcode/index.js +1 -2
  253. package/lib/qrcode/index.less_inline.js +1 -2
  254. package/lib/select/index.d.ts +21 -2
  255. package/lib/select/index.js +138 -77
  256. package/lib/select/index.less_inline.js +1 -2
  257. package/lib/select_ori/index.d.ts +9 -1
  258. package/lib/select_ori/index.js +36 -24
  259. package/lib/select_ori/index.less_inline.js +1 -2
  260. package/lib/space/index.js +1 -2
  261. package/lib/space/index.less_inline.js +1 -2
  262. package/lib/styles/animation/index.css_inline.js +1 -2
  263. package/lib/styles/animation/index.js +1 -2
  264. package/lib/styles/mask/index.css_inline.js +1 -2
  265. package/lib/styles/mask/index.js +1 -2
  266. package/lib/switch/index.d.ts +6 -0
  267. package/lib/switch/index.js +31 -16
  268. package/lib/switch/index.less_inline.js +1 -2
  269. package/lib/tabbar/index.js +1 -2
  270. package/lib/tabbar/index.less_inline.js +1 -2
  271. package/lib/tabbar/item.js +1 -2
  272. package/lib/tabbar/item.less_inline.js +1 -2
  273. package/lib/table/index.d.ts +2 -0
  274. package/lib/table/index.js +12 -4
  275. package/lib/table/index.less_inline.js +1 -2
  276. package/lib/tabs/index.js +1 -2
  277. package/lib/tag/index.d.ts +11 -3
  278. package/lib/tag/index.js +25 -24
  279. package/lib/tag/index.less_inline.js +2 -3
  280. package/lib/theme/appearance.d.ts +5 -0
  281. package/lib/theme/appearance.js +34 -0
  282. package/lib/theme/index.js +83 -39
  283. package/lib/theme/index.less_inline.js +1 -2
  284. package/lib/theme/theme_color.js +1 -2
  285. package/lib/upload/index.js +28 -41
  286. package/lib/upload/index.less_inline.js +2 -3
  287. package/lib/upload/style.js +1 -2
  288. package/lib/utils/clickoutside.js +1 -2
  289. package/lib/utils/event.js +1 -2
  290. package/lib/utils/index.d.ts +27 -5
  291. package/lib/utils/index.js +43 -22
  292. package/lib/utils/popover.js +7 -16
  293. package/lib/utils/transition.js +1 -2
  294. package/package.json +16 -13
  295. package/styles/dark.css +10 -2
  296. package/styles/dropdown.css +46 -0
  297. package/styles/reset.css +0 -1
  298. package/styles/select.css +5 -0
  299. package/styles/themes/apple.css +47 -0
  300. package/styles/{theme-coral.css → themes/coral.css} +5 -3
  301. package/styles/themes/deep-sea-blue.css +12 -0
  302. package/styles/themes/gamboge.css +15 -0
  303. package/styles/{theme-jade.css → themes/jade.css} +5 -3
  304. package/styles/themes/lotus-seed.css +12 -0
  305. package/styles/{theme-tangerine.css → themes/tangerine.css} +5 -3
  306. package/styles/themes.css +8 -0
  307. package/styles/vars.css +8 -2
  308. package/types/preact.d.ts +43 -0
  309. package/lib/form/types.d.ts +0 -7
  310. package/lib/utils/context_provide.d.ts +0 -10
  311. package/lib/utils/context_provide.js +0 -22
  312. package/lib/utils/signal_types.d.ts +0 -5
@@ -1,13 +1,57 @@
1
1
  import { parseAttrValue as e, unitNumberStr as t } from "../utils/index.js";
2
2
  import n from "../form/form_inner.js";
3
- import r from "./index.less_inline.js";
4
- import i from "./input_inner.less_inline.js";
5
- import { $ as a, $$ as o, $one as s, addClass as c, formatStyle as l, off as u, on as d, removeClass as f } from "utilane/browser";
6
- //#region src/components/input/index.ts
7
- var p = class extends n {
3
+ import r from "./style.js";
4
+ import { $ as i, $$ as a, $one as o, addClass as s, formatStyle as c, off as l, on as u, removeClass as d } from "utilane/browser";
5
+ // src/components/input/index.ts
6
+ var f = class extends n {
8
7
  static baseName = "input";
9
8
  parser;
10
9
  $inner;
10
+ formInnerBlock = !1;
11
+ userBadInput = !1;
12
+ get formStateRestorationEnabled() {
13
+ return (this.getAttribute("type") || "text").toLowerCase() !== "password";
14
+ }
15
+ get acceptsAutocompleteText() {
16
+ return !0;
17
+ }
18
+ get nativeBadInput() {
19
+ return this.userBadInput;
20
+ }
21
+ syncInputAttributes() {
22
+ if (this.$inner) {
23
+ this.$inner.type = this.getAttribute("type") || "text";
24
+ for (let e of [
25
+ "pattern",
26
+ "min",
27
+ "max",
28
+ "step",
29
+ "minlength",
30
+ "maxlength",
31
+ "inputmode"
32
+ ]) {
33
+ let t = this.getAttribute(e);
34
+ t === null ? this.$inner.removeAttribute(e) : this.$inner.setAttribute(e, t);
35
+ }
36
+ this.$inner.readOnly = this.readOnly, this.$inner.disabled = this.isDisabled();
37
+ }
38
+ }
39
+ configurationApplied() {
40
+ this.syncInputAttributes();
41
+ }
42
+ attributeChanged(e, t, n) {
43
+ if (super.attributeChanged(e, t, n), this.syncInputAttributes(), e === "type" && this.$inner) {
44
+ let e = this.dirtyValue;
45
+ this.setValue(this.$inner.value), this.dirtyValue = e;
46
+ }
47
+ this.rendered && ["readonly", "clearable"].includes(e) && this.#t();
48
+ }
49
+ focus(e) {
50
+ this.isDisabled() || this.$inner?.focus(e);
51
+ }
52
+ blur() {
53
+ this.$inner?.blur();
54
+ }
11
55
  constructor() {
12
56
  super(), this.version = 2, this._state = {
13
57
  type: "text",
@@ -15,18 +59,40 @@ var p = class extends n {
15
59
  autosize: !1,
16
60
  allowInput: void 0,
17
61
  block: !1,
18
- clearable: !1
62
+ clearable: !1,
63
+ readonly: !1
19
64
  };
20
65
  }
66
+ get nativeValueEnabled() {
67
+ return !0;
68
+ }
69
+ serializeFormValue() {
70
+ return String(this.getValue() ?? "");
71
+ }
72
+ setValue(e) {
73
+ this.userBadInput = !1;
74
+ let t = this.$inner ?? this.ownerDocument.createElement("input");
75
+ t.type = this.getAttribute("type") || "text";
76
+ let n = String(e ?? "");
77
+ t.value = n, super.setValue(t.value === n ? e : t.value), this.$inner && this.#t(), this.syncNativeValue();
78
+ }
21
79
  set value(e) {
22
- this.setValue(e), this.$inner && (this.$inner.value = e);
80
+ this.setValue(e);
23
81
  }
24
82
  get value() {
25
83
  return this.getValue();
26
84
  }
85
+ get readOnly() {
86
+ return this._state.readonly;
87
+ }
88
+ set readOnly(e) {
89
+ e ? this.setAttribute("readonly", "") : this.removeAttribute("readonly");
90
+ }
27
91
  static get observedAttributes() {
28
- return [
92
+ return [.../* @__PURE__ */ new Set([
93
+ ...n.observedAttributes,
29
94
  "disabled",
95
+ "readonly",
30
96
  "value",
31
97
  "name",
32
98
  "inner-block",
@@ -38,15 +104,34 @@ var p = class extends n {
38
104
  "type",
39
105
  "placeholder",
40
106
  "width",
41
- "block"
42
- ];
107
+ "block",
108
+ "autocomplete"
109
+ ])];
43
110
  }
44
111
  afterInit() {
45
- this.$inner = s(".l-input__inner", this.root), d(this.$inner, "input", this._input), d(this.$inner, "change", this.#n), this.style.cssText = l(this._getStyleObj()) + this.getAttr("style", "");
112
+ this.$inner = o(".l-input__inner", this.root), this.$inner.value = String(this.getValue() ?? ""), this.#t(), this.syncInputAttributes(), this.$inner.addEventListener("keydown", this.#e), u(this.$inner, "input", this._input), u(this.$inner, "change", this.#r), this.style.cssText = c(this._getStyleObj()) + this.getAttr("style", "");
46
113
  }
47
114
  beforeDestroy() {
48
- u(this.$inner, "input", this._input);
115
+ this.$inner?.removeEventListener("keydown", this.#e), l(this.$inner, "input", this._input), l(this.$inner, "change", this.#r);
116
+ let e = o(".l-clearable", this.root);
117
+ e && l(e, "click", this.#n);
49
118
  }
119
+ #e = (e) => {
120
+ let t = this.$inner, n = this.form;
121
+ if (!t || !n || t.form || this.isDisabled() || e.defaultPrevented || e.key !== "Enter" || e.isComposing || e.keyCode === 229 || e.repeat || ![
122
+ "text",
123
+ "search",
124
+ "tel",
125
+ "url",
126
+ "email",
127
+ "password",
128
+ "number"
129
+ ].includes(t.type)) return;
130
+ let r = this.closest("l-form"), i = r && n.contains(r) ? r : n.getRootNode(), a = (e) => e.form === n ? e instanceof HTMLButtonElement || e instanceof HTMLInputElement ? e.type === "submit" || e.type === "image" : e.getAttribute("html-type") === "submit" : !1, o = Array.from(i.querySelectorAll("button, input, l-button[html-type=\"submit\"]")).find(a);
131
+ o && setTimeout(() => {
132
+ e.defaultPrevented || !this.isConnected || this.$inner !== t || this.isDisabled() || this.form === n && a(o) && o.click();
133
+ }, 0);
134
+ };
50
135
  attributeChange(n, r, i) {
51
136
  switch (n) {
52
137
  case "error":
@@ -58,6 +143,7 @@ var p = class extends n {
58
143
  this._state[n] = i;
59
144
  break;
60
145
  case "clearable":
146
+ case "readonly":
61
147
  case "block":
62
148
  let r = e(i, !1, n);
63
149
  this._state[n] = r;
@@ -66,7 +152,7 @@ var p = class extends n {
66
152
  }
67
153
  }
68
154
  updateDOM(e) {
69
- e.has("clearable") && (this._state.clearable ? c(this, "l-input--clearable") : f(this, "l-input--clearable")), e.has("error") && this._updateError(this._state.error != null), e.has("maxlength") && this._updateAttr("maxlength", this._state.maxlength), e.has("minlength") && this._updateAttr("minlength", this._state.minlength), e.has("inputmode") && this._updateAttr("inputmode", this._state.inputmode), e.has("block") && this.innerBlockChange(this._state.block), e.has("placeholder") && this.$inner && (this.$inner.placeholder = this._state.placeholder);
155
+ e.has("readonly") && this.$inner && (this.$inner.readOnly = this._state.readonly), (e.has("readonly") || e.has("clearable")) && this.#t(), e.has("clearable") && (this._state.clearable ? s(this, "l-input--clearable") : d(this, "l-input--clearable")), e.has("error") && this._updateError(this._state.error != null || this.$inner?.getAttribute("aria-invalid") === "true"), e.has("maxlength") && this._updateAttr("maxlength", this._state.maxlength), e.has("minlength") && this._updateAttr("minlength", this._state.minlength), e.has("inputmode") && this._updateAttr("inputmode", this._state.inputmode), e.has("block") && this.updateBlock(), e.has("placeholder") && this.$inner && (this.$inner.placeholder = this._state.placeholder);
70
156
  }
71
157
  _updateAttr(e, t) {
72
158
  this.$inner && (t ? this.$inner.setAttribute(e, t) : this.$inner.removeAttribute(e));
@@ -74,22 +160,21 @@ var p = class extends n {
74
160
  render_v2() {
75
161
  return {
76
162
  template: this.render(),
77
- style: [r, i]
163
+ styleSheets: [r]
78
164
  };
79
165
  }
80
166
  render() {
81
167
  let e = document.createDocumentFragment();
82
- if (a("[slot=\"prefix\"]", this).length > 0) {
83
- let t = o("slot", { name: "prefix" }), n = o("span", {
168
+ if (i("[slot=\"prefix\"]", this).length > 0) {
169
+ let t = a("slot", { name: "prefix" }), n = a("span", {
84
170
  class: "l-input__prefix",
85
171
  part: "prefix"
86
172
  });
87
173
  n.appendChild(t), e.appendChild(n);
88
174
  }
89
- let t = o("input", {
175
+ let t = a("input", {
90
176
  class: "l-input__inner",
91
177
  value: this.value,
92
- name: this.getName(),
93
178
  placeholder: this._state.placeholder,
94
179
  part: "default",
95
180
  type: this._state.type,
@@ -98,8 +183,8 @@ var p = class extends n {
98
183
  minlength: this._state.minlength,
99
184
  disabled: this.isDisabled() ? !0 : void 0
100
185
  });
101
- if (e.appendChild(t), a("[slot=\"suffix\"]", this).length > 0) {
102
- let t = o("slot", { name: "suffix" }), n = o("span", {
186
+ if (t.readOnly = this._state.readonly, e.appendChild(t), i("[slot=\"suffix\"]", this).length > 0) {
187
+ let t = a("slot", { name: "suffix" }), n = a("span", {
103
188
  class: "l-input__suffix",
104
189
  part: "suffix"
105
190
  });
@@ -112,46 +197,61 @@ var p = class extends n {
112
197
  }
113
198
  _calcCurosorPosition(e, t) {
114
199
  let n = e.selectionStart || 0, r = e.selectionEnd || 0, i = e.value, a = n, o = r;
115
- t.length < i.length ? (a = Math.max(0, n - (i.length - t.length)), o = a) : t.length > i.length ? (a = Math.min(t.length, n + (t.length - i.length)), o = a) : (a = Math.min(t.length, n), o = a), e.value = t, e.setSelectionRange(a, o);
200
+ t.length < i.length ? (a = Math.max(0, n - (i.length - t.length)), o = a) : t.length > i.length ? (a = Math.min(t.length, n + (t.length - i.length)), o = a) : (a = Math.min(t.length, n), o = a), e.value = t, [
201
+ "text",
202
+ "search",
203
+ "url",
204
+ "tel",
205
+ "password"
206
+ ].includes(e.type) && e.setSelectionRange(a, o);
116
207
  }
117
208
  _input = (e) => {
118
- let t = e.target, n = t.value, r = n;
209
+ let t = e.target;
210
+ if (this.readOnly || this.isDisabled()) {
211
+ t.value = String(this.getValue() ?? ""), e.stopImmediatePropagation();
212
+ return;
213
+ }
214
+ let n = t.validity.badInput, r = t.value, i = r;
119
215
  if (this._state.allowInput != null) {
120
216
  let e = this._state.allowInput.indexOf("."), t = e === -1 ? e : parseInt(this._state.allowInput.substring(e + 1));
121
- r = this._numberInputParse(n, {
217
+ i = this._numberInputParse(r, {
122
218
  integer: this._state.allowInput.includes("integer"),
123
219
  negative: this._state.allowInput.startsWith("-"),
124
220
  precision: t
125
- }), r = String(r);
221
+ }), i = String(i);
126
222
  }
127
- this.parser != null && (r = this.parser(r));
223
+ this.parser != null && (i = this.parser(i));
128
224
  try {
129
- this._calcCurosorPosition(t, r);
225
+ this._calcCurosorPosition(t, i);
130
226
  } catch (e) {
131
227
  console.warn(e);
132
228
  }
133
- this.setValue(r), this.#e();
229
+ this.setValue(i), this.userBadInput = n, this.syncNativeValue(), this.#t(), this.validateInput();
134
230
  };
135
- #e() {
136
- if (this._state.clearable) {
137
- let e = s(".l-clearable", this.root);
138
- if (this.value.length > 0) {
139
- if (e == null) {
140
- e = o("span", { class: "l-input__suffix l-clearable" });
141
- let t = o("l-close-filled-icon");
142
- e.appendChild(t), this.root.appendChild(e), d(e, "click", this.#t);
143
- }
144
- } else e && (u(e, "click", this.#t), e.remove());
145
- }
231
+ #t() {
232
+ let e = o(".l-clearable", this.root);
233
+ if (this._state.clearable && !this.readOnly && !this.isDisabled() && String(this.value ?? "").length > 0) {
234
+ if (e == null) {
235
+ e = a("button", {
236
+ class: "l-input__suffix l-clearable",
237
+ type: "button",
238
+ "aria-label": "清空输入",
239
+ part: "clear"
240
+ });
241
+ let t = a("l-close-filled-icon", { "aria-hidden": "true" });
242
+ e.appendChild(t), this.root.appendChild(e), u(e, "click", this.#n);
243
+ }
244
+ } else e && (l(e, "click", this.#n), e.remove());
146
245
  }
147
- #t = () => {
148
- this.value = "", this.dispatchEvent(new CustomEvent("input", {
246
+ #n = () => {
247
+ this.readOnly || this.isDisabled() || (this.value = "", this.validateInput(), this.focus(), this.dispatchEvent(new CustomEvent("input", {
149
248
  bubbles: !0,
249
+ composed: !0,
150
250
  detail: { value: this.value }
151
- })), this.#e();
251
+ })), this.#t());
152
252
  };
153
253
  disabledChange() {
154
- this.isDisabled() ? this.classList.add("is-disabled") : this.classList.remove("is-disabled"), this.$inner && (this.$inner.disabled = this.isDisabled());
254
+ this.isDisabled() ? this.classList.add("is-disabled") : this.classList.remove("is-disabled"), this.$inner && (this.$inner.disabled = this.isDisabled(), this.#t());
155
255
  }
156
256
  _numberInputParse(e, t) {
157
257
  let n = e.trim();
@@ -165,19 +265,23 @@ var p = class extends n {
165
265
  return n.length > 1 && (n = n.replace(/^0+(\d)/, "$1")), r ? "-" + n : n;
166
266
  }
167
267
  innerBlockChange(e) {
168
- e ? c(this, "is-block") : f(this, "is-block");
268
+ this.formInnerBlock = e, this.updateBlock();
269
+ }
270
+ updateBlock() {
271
+ this.classList.toggle("is-block", this._state.block || this.formInnerBlock);
169
272
  }
170
273
  _getStyleObj() {
171
274
  let e = {};
172
275
  return this._state.width && (e["--l-input-width"] = this._state.width), e;
173
276
  }
174
277
  _updateError(e = !1) {
175
- e ? c(this, "is-error") : f(this, "is-error");
278
+ e ? s(this, "is-error") : d(this, "is-error");
176
279
  }
177
280
  validResult(e) {
178
- this._updateError(e != null);
281
+ super.validResult(e), this._updateError(!!e || !!this._state.error);
179
282
  }
180
- #n = (e) => {
283
+ #r = (e) => {
284
+ if (e.stopPropagation(), this.readOnly || this.isDisabled()) return;
181
285
  let t = e.target;
182
286
  this.dispatchEvent(new CustomEvent("change", {
183
287
  bubbles: !0,
@@ -189,5 +293,4 @@ var p = class extends n {
189
293
  }));
190
294
  };
191
295
  };
192
- //#endregion
193
- export { p as default };
296
+ export { f as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/input/index.less?inline
2
- var e = ":host{--l-input-border-color:var(--l-border-color,#dedede);width:var(--l-input-width,170px);height:var(--l-form-control-height,32px);border:1px solid var(--l-input-border-color,#dedede);border-radius:var(--l-border-radius,3px);vertical-align:middle;box-sizing:border-box;background-color:#0000;align-items:center;padding:0 7px;transition:border-color .3s,box-shadow .3s;display:inline-flex}:host(:focus){--l-input-border-color:var(--l-primary-color,#722ed1);box-shadow:0 0 0 3px var(--l-primary-color-light5)}:host(.is-block){width:100%}:host(.is-disabled){background-color:var(--l-disabled-color,#f5f7fa)}:host(.is-error){--l-input-border-color:var(--l-error-color)}:host(.is-error:focus){box-shadow:0 0 0 3px var(--l-error-color-light5)}.l-input__prefix,.l-input__suffix{color:#a8abb2;flex-shrink:0;font-size:14px;display:inline-flex}.l-input__prefix{margin-right:5px}.l-input__suffix{margin-left:5px}.l-clearable{cursor:pointer}.l-clearable:hover{color:#999}";
3
- //#endregion
1
+ // src/components/input/index.less?inline
2
+ var e = ".l-input__inner{box-sizing:border-box;width:100%;max-width:100%;height:100%;text-align:inherit;font-size:inherit;background-color:#0000;border:none;outline:none;flex-grow:1}.l-input__inner:disabled{background-color:#0000}:host{--l-input-border-color:var(--l-border-color,#dedede);width:var(--l-input-width,170px);height:var(--l-form-control-height,32px);border:1px solid var(--l-input-border-color,#dedede);border-radius:var(--l-border-radius,3px);vertical-align:middle;box-sizing:border-box;background-color:#0000;align-items:center;padding:0 7px;transition:border-color .3s,box-shadow .3s;display:inline-flex}:host(:focus){--l-input-border-color:var(--l-primary-color,#722ed1);box-shadow:0 0 0 3px var(--l-primary-color-light5)}:host(.is-block){width:100%}:host(.is-disabled){background-color:var(--l-disabled-color,#f5f7fa)}:host(.is-error){--l-input-border-color:var(--l-error-color)}:host(.is-error:focus){box-shadow:0 0 0 3px var(--l-error-color-light5)}.l-input__prefix,.l-input__suffix{color:#a8abb2;flex-shrink:0;font-size:14px;display:inline-flex}.l-input__prefix{margin-right:5px}.l-input__suffix{margin-left:5px}.l-clearable{cursor:pointer;font:inherit;background:0 0;border:0;padding:0}.l-clearable:focus-visible{outline:2px solid var(--l-primary-color,#722ed1);outline-offset:2px}.l-clearable:hover{color:#999}";
4
3
  export { e as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/input/input_inner.less?inline
1
+ // src/components/input/input_inner.less?inline
2
2
  var e = ".l-input__inner{box-sizing:border-box;width:100%;max-width:100%;height:100%;text-align:inherit;font-size:inherit;background-color:#0000;border:none;outline:none;flex-grow:1}.l-input__inner:disabled{background-color:#0000}";
3
- //#endregion
4
3
  export { e as default };
@@ -0,0 +1,3 @@
1
+ /** 与 Button 一致:模块级构造一次,由所有 Input 的 ShadowRoot 共享。 */
2
+ declare const inputSheet: CSSStyleSheet;
3
+ export default inputSheet;
@@ -0,0 +1,7 @@
1
+ import e from "./index.less_inline.js";
2
+ // src/components/input/style.ts
3
+ var t = /* @__PURE__ */ (() => {
4
+ let t = new CSSStyleSheet();
5
+ return t.replaceSync(e), t;
6
+ })();
7
+ export { t as default };
@@ -33,12 +33,18 @@ export default class InputNumber extends FormInner<InputNumberState> {
33
33
  render(): DocumentFragment;
34
34
  afterInit(): void;
35
35
  beforeDestroy(): void;
36
+ protected get intrinsicDefaultValue(): undefined;
37
+ protected parseDefaultValue(value: string | null): number | undefined;
38
+ protected serializeFormValue(): string;
39
+ protected get nativeConstraintValues(): readonly unknown[];
40
+ setValue(value: any): void;
36
41
  set value(value: any);
37
42
  get value(): any;
38
43
  disabledChange(): void;
39
44
  focus(): void;
40
45
  /** 将值限制在 min/max 范围内并格式化精度 */
41
46
  private _clamp;
47
+ private _parseNumber;
42
48
  private _formatValue;
43
49
  private _getCurrentNum;
44
50
  private _commitValue;
@@ -50,6 +56,7 @@ export default class InputNumber extends FormInner<InputNumberState> {
50
56
  private _handlePlus;
51
57
  private _stepUp;
52
58
  private _stepDown;
59
+ private _step;
53
60
  private _updateBtnState;
54
61
  private _updateWidth;
55
62
  private _updateControls;
@@ -2,7 +2,7 @@ import { parseAttrValue as e, unitNumberStr as t } from "../utils/index.js";
2
2
  import n from "../form/form_inner.js";
3
3
  import r from "./style.js";
4
4
  import { $$ as i, $one as a, addClass as o, off as s, on as c, removeClass as l } from "utilane/browser";
5
- //#region src/components/input_number/index.ts
5
+ // src/components/input_number/index.ts
6
6
  var u = class extends n {
7
7
  static baseName = "input-number";
8
8
  $input;
@@ -17,7 +17,8 @@ var u = class extends n {
17
17
  };
18
18
  }
19
19
  static get observedAttributes() {
20
- return [
20
+ return [.../* @__PURE__ */ new Set([
21
+ ...n.observedAttributes,
21
22
  "disabled",
22
23
  "value",
23
24
  "name",
@@ -30,23 +31,25 @@ var u = class extends n {
30
31
  "size",
31
32
  "width",
32
33
  "controls-disabled"
33
- ];
34
+ ])];
34
35
  }
35
36
  attributeChange(n, r, i) {
36
37
  switch (n) {
37
38
  case "min":
38
39
  case "max":
40
+ this._state[n] = this._parseNumber(i);
41
+ break;
39
42
  case "precision":
40
- let r = Number(i);
41
- this._state[n] = Number.isFinite(r) ? r : void 0;
43
+ let r = this._parseNumber(i);
44
+ this._state.precision = r != null && Number.isInteger(r) && r >= 0 && r <= 100 ? r : void 0;
42
45
  break;
43
46
  case "step":
44
47
  let a = Number(i);
45
- this._state.step = Number.isFinite(a) ? a : 1;
48
+ this._state.step = Number.isFinite(a) && a > 0 ? a : 1;
46
49
  break;
47
50
  case "placeholder":
48
51
  case "size":
49
- this._state[n] = i.trim();
52
+ this._state[n] = (i ?? "").trim();
50
53
  break;
51
54
  case "width":
52
55
  this._state.width = t(i);
@@ -55,7 +58,12 @@ var u = class extends n {
55
58
  }
56
59
  }
57
60
  updateDOM(e) {
58
- e.has("placeholder") && this.$input && (this.$input.placeholder = this._state.placeholder), e.has("width") && this._updateWidth(), e.has("controls-disabled") && this._updateControls(), (e.has("step") || e.has("min") || e.has("max")) && this._updateBtnState();
61
+ e.has("placeholder") && this.$input && (this.$input.placeholder = this._state.placeholder), e.has("width") && this._updateWidth(), e.has("controls-disabled") && this._updateControls(), e.has("precision") && this.$input && (this.$input.value = this._formatValue(this.value), this.$input.inputMode = this._state.precision == null ? "numeric" : "decimal"), [
62
+ "step",
63
+ "min",
64
+ "max",
65
+ "readonly"
66
+ ].some((t) => e.has(t)) && this._updateBtnState();
59
67
  }
60
68
  render_v2() {
61
69
  return {
@@ -73,7 +81,6 @@ var u = class extends n {
73
81
  let n = i("input", {
74
82
  class: "l-input-number__inner",
75
83
  value: this._formatValue(this.value),
76
- name: this.getName(),
77
84
  placeholder: this._state.placeholder,
78
85
  part: "default",
79
86
  type: "text",
@@ -94,39 +101,55 @@ var u = class extends n {
94
101
  beforeDestroy() {
95
102
  this.$input && (s(this.$input, "input", this._handleInput), s(this.$input, "change", this._handleChange), s(this.$input, "blur", this._handleBlur), s(this.$input, "keydown", this._handleKeydown)), this.$minusBtn && s(this.$minusBtn, "click", this._handleMinus), this.$plusBtn && s(this.$plusBtn, "click", this._handlePlus), this.$input = void 0, this.$minusBtn = void 0, this.$plusBtn = void 0;
96
103
  }
104
+ get intrinsicDefaultValue() {}
105
+ parseDefaultValue(e) {
106
+ return this._parseNumber(e);
107
+ }
108
+ serializeFormValue() {
109
+ return String(this._parseNumber(this.value) ?? "");
110
+ }
111
+ get nativeConstraintValues() {
112
+ return [this._parseNumber(this.value)];
113
+ }
114
+ setValue(e) {
115
+ let t = this._parseNumber(e), n = t != null && typeof e == "string" ? e.trim() : t;
116
+ super.setValue(n), this.$input && (this.$input.value = this._formatValue(n)), this._updateBtnState(), this.syncNativeValue();
117
+ }
97
118
  set value(e) {
98
- this.setValue(e), this.$input && (this.$input.value = this._formatValue(e)), this._updateBtnState();
119
+ this.setValue(e);
99
120
  }
100
121
  get value() {
101
122
  return this.getValue();
102
123
  }
103
124
  disabledChange() {
104
- this.isDisabled() ? o(this, "is-disabled") : l(this, "is-disabled"), this.$input && (this.$input.disabled = this.isDisabled()), this.$minusBtn && (this.$minusBtn.disabled = this.isDisabled()), this.$plusBtn && (this.$plusBtn.disabled = this.isDisabled());
125
+ this.isDisabled() ? o(this, "is-disabled") : l(this, "is-disabled"), this.$input && (this.$input.disabled = this.isDisabled()), this.$minusBtn && (this.$minusBtn.disabled = this.isDisabled()), this.$plusBtn && (this.$plusBtn.disabled = this.isDisabled()), this._updateBtnState();
105
126
  }
106
127
  focus() {
107
128
  this.$input?.focus();
108
129
  }
109
130
  _clamp(e) {
110
131
  let { min: t, max: n, precision: r } = this._state;
111
- return t != null && e < t && (e = t), n != null && e > n && (e = n), r != null && (e = parseFloat(e.toFixed(r))), e;
132
+ return r != null && (e = Number(e.toFixed(r))), t != null && e < t && (e = t), n != null && e > n && (e = n), e;
112
133
  }
113
- _formatValue(e) {
114
- if (e == null || e === "") return "";
134
+ _parseNumber(e) {
135
+ if (typeof e == "string" && !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(e.trim()) || typeof e != "number" && typeof e != "string") return;
115
136
  let t = Number(e);
116
- if (isNaN(t)) return "";
137
+ return Number.isFinite(t) ? t : void 0;
138
+ }
139
+ _formatValue(e) {
140
+ let t = this._parseNumber(e);
141
+ if (t == null) return "";
117
142
  let { precision: n } = this._state;
118
143
  return n == null ? String(t) : t.toFixed(n);
119
144
  }
120
145
  _getCurrentNum() {
121
- let e = this.$input?.value ?? this.value;
122
- if (e == null || e === "") return 0;
123
- let t = Number(e);
124
- return isNaN(t) ? 0 : t;
146
+ return this._parseNumber(this.$input?.value ?? this.value) ?? 0;
125
147
  }
126
148
  _commitValue(e) {
127
149
  let t = this._clamp(e);
128
- this.value = t, this.$input && (this.$input.value = this._formatValue(t)), this.emit("input", {
150
+ this.value = t, this.validateInput(), this.emit("input", {
129
151
  bubbles: !0,
152
+ composed: !0,
130
153
  detail: {
131
154
  value: t,
132
155
  name: this.getName()
@@ -134,11 +157,11 @@ var u = class extends n {
134
157
  }), this._updateBtnState();
135
158
  }
136
159
  _handleInput = (e) => {
137
- let t = e.target.value;
138
- if (t === "-" || t === "." || t === "-.") return;
139
- let n = Number(t);
140
- Number.isFinite(n) && (this.setValue(n), this.emit("input", {
160
+ e.stopPropagation();
161
+ let t = e.target.value, n = this._parseNumber(t);
162
+ (n != null || t.trim() === "") && (super.setValue(n), this._updateBtnState(), this.validateInput(), this.emit("input", {
141
163
  bubbles: !0,
164
+ composed: !0,
142
165
  detail: {
143
166
  value: n,
144
167
  name: this.getName()
@@ -146,45 +169,45 @@ var u = class extends n {
146
169
  }));
147
170
  };
148
171
  _handleChange = (e) => {
149
- let t = e.target, n = Number(t.value);
150
- if (Number.isFinite(n)) {
151
- let e = this._clamp(n);
152
- this.value = e, this.$input && (this.$input.value = this._formatValue(e)), this.emit("change", { detail: {
153
- value: e,
154
- name: this.getName()
155
- } });
156
- }
172
+ e.stopPropagation();
173
+ let t = e.target, n = this._parseNumber(t.value), r = this.value;
174
+ this.value = n == null ? void 0 : this._clamp(n), Object.is(r, this.value) || this.validateInput(), n != null && this.emit("change", { detail: {
175
+ value: this.value,
176
+ name: this.getName()
177
+ } });
157
178
  };
158
179
  _handleBlur = () => {
159
180
  if (this.$input) {
160
- let e = this.$input.value, t = parseFloat(e);
161
- if (Number.isFinite(t)) {
162
- let e = this._clamp(t);
163
- this.value = e, this.$input.value = this._formatValue(e);
164
- } else this.value = void 0, this.$input.value = "";
181
+ let e = this._parseNumber(this.$input.value), t = this.value;
182
+ this.value = e == null ? void 0 : this._clamp(e), Object.is(t, this.value) || this.validateInput();
165
183
  }
166
184
  };
167
185
  _handleKeydown = (e) => {
168
186
  let t = e;
169
- this.isDisabled() || (t.key === "ArrowUp" ? (t.preventDefault(), this._stepUp()) : t.key === "ArrowDown" && (t.preventDefault(), this._stepDown()));
187
+ this.isDisabled() || this.$input?.readOnly || (t.key === "ArrowUp" ? (t.preventDefault(), this._stepUp()) : t.key === "ArrowDown" && (t.preventDefault(), this._stepDown()));
170
188
  };
171
189
  _handleMinus = () => {
172
- this.isDisabled() || (this._stepDown(), this.focus());
190
+ this.isDisabled() || this.$input?.readOnly || (this._stepDown(), this.focus());
173
191
  };
174
192
  _handlePlus = () => {
175
- this.isDisabled() || (this._stepUp(), this.focus());
193
+ this.isDisabled() || this.$input?.readOnly || (this._stepUp(), this.focus());
176
194
  };
177
195
  _stepUp() {
178
- let e = this._getCurrentNum();
179
- this._commitValue(e + this._state.step);
196
+ this._step(1);
180
197
  }
181
198
  _stepDown() {
182
- let e = this._getCurrentNum();
183
- this._commitValue(e - this._state.step);
199
+ this._step(-1);
200
+ }
201
+ _step(e) {
202
+ let t = this._getCurrentNum(), n = this._state.step, r = (e) => {
203
+ let [t, n = "0"] = String(e).split("e");
204
+ return (t.split(".")[1]?.length ?? 0) - Number(n);
205
+ }, i = Math.max(0, r(t), r(n)), a = t + e * n;
206
+ Number.isFinite(a) && this._commitValue(Number(a.toFixed(Math.min(i, 100))));
184
207
  }
185
208
  _updateBtnState() {
186
- let e = this._getCurrentNum(), { min: t, max: n } = this._state;
187
- this.$minusBtn && t != null && (this.$minusBtn.disabled = this.isDisabled() || e <= t), this.$plusBtn && n != null && (this.$plusBtn.disabled = this.isDisabled() || e >= n);
209
+ let e = this._getCurrentNum(), { min: t, max: n } = this._state, r = this.isDisabled() || !!this.$input?.readOnly;
210
+ this.$minusBtn && (this.$minusBtn.disabled = r || t != null && e <= t), this.$plusBtn && (this.$plusBtn.disabled = r || n != null && e >= n);
188
211
  }
189
212
  _updateWidth() {
190
213
  this._state.width ? this.style.setProperty("--l-input-number-width", this._state.width) : this.style.removeProperty("--l-input-number-width");
@@ -196,8 +219,7 @@ var u = class extends n {
196
219
  e ? o(this, "is-block") : l(this, "is-block");
197
220
  }
198
221
  validResult(e) {
199
- e == null ? l(this, "is-error") : o(this, "is-error");
222
+ super.validResult(e), e == null ? l(this, "is-error") : o(this, "is-error");
200
223
  }
201
224
  };
202
- //#endregion
203
225
  export { u as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/input_number/index.less?inline
1
+ // src/components/input_number/index.less?inline
2
2
  var e = ":host{--l-input-number-border-color:var(--l-border-color,#d9d9d9);--l-input-number-btn-color:#606266;--l-input-number-btn-hover-color:var(--l-primary-color,#722ed1);--l-input-number-btn-disabled-color:#c0c4cc;--l-input-number-bg:#fff;--l-input-number-btn-bg:#f5f7fa;--l-input-number-btn-hover-bg:var(--l-primary-color-light5,#f3e8ff);--l-input-number-width:170px;width:var(--l-input-number-width);height:var(--l-form-control-height,32px);border:1px solid var(--l-input-number-border-color);border-radius:var(--l-border-radius,3px);box-sizing:border-box;vertical-align:middle;background-color:var(--l-input-number-bg);align-items:center;transition:border-color .3s,box-shadow .3s;display:inline-flex;overflow:hidden}:host(:focus-within){--l-input-number-border-color:var(--l-primary-color,#722ed1);box-shadow:0 0 0 3px var(--l-primary-color-light5)}:host(.is-block){width:100%}:host(.is-disabled){background-color:var(--l-disabled-color,#f5f7fa);cursor:not-allowed}:host(.is-disabled) .l-input-number__btn{color:var(--l-input-number-btn-disabled-color);cursor:not-allowed}:host(.is-disabled) .l-input-number__btn:hover{background-color:var(--l-input-number-btn-bg)}:host(.is-error){--l-input-number-border-color:var(--l-error-color)}:host(.is-error:focus-within){box-shadow:0 0 0 3px var(--l-error-color-light5)}:host(.l-input-number--small){--l-form-control-height:24px;font-size:12px}:host(.l-input-number--large){--l-form-control-height:40px;--l-border-radius:6px;font-size:16px}.l-input-number__btn{background:var(--l-input-number-btn-bg);width:32px;height:100%;color:var(--l-input-number-btn-color);cursor:pointer;-webkit-user-select:none;user-select:none;font-size:inherit;border:none;outline:none;flex-shrink:0;justify-content:center;align-items:center;padding:0;transition:background-color .25s,color .25s;display:inline-flex}.l-input-number__btn:hover:not(:disabled){background:var(--l-input-number-btn-hover-bg);color:var(--l-input-number-btn-hover-color)}.l-input-number__btn:active:not(:disabled){background:var(--l-primary-color-light4,#e2d3fa);color:var(--l-primary-color-dark1,#531dab)}.l-input-number__btn:disabled{color:var(--l-input-number-btn-disabled-color);cursor:not-allowed}:host(.l-input-number--no-controls) .l-input-number__inner{text-align:left}.l-input-number__inner{text-align:center;width:100%;height:100%;font-size:inherit;color:var(--l-input-number-btn-color);box-sizing:border-box;-moz-appearance:textfield;background:0 0;border:none;outline:none;flex:1;padding:0 8px}.l-input-number__inner::-webkit-outer-spin-button,.l-input-number__inner::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.l-input-number__inner::placeholder{color:#c0c4cc}html.dark :host{--l-input-number-bg:#ffffff0f;--l-input-number-btn-bg:#ffffff14;--l-input-number-btn-color:#ffffffa6;--l-input-number-btn-hover-bg:var(--l-primary-color-light5);--l-input-number-btn-disabled-color:#ffffff40}html.dark :host(.is-disabled){background-color:#ffffff14}html.dark .l-input-number__inner::placeholder{color:#ffffff4d}";
3
- //#endregion
4
3
  export { e as default };
@@ -1,8 +1,7 @@
1
1
  import e from "./index.less_inline.js";
2
- //#region src/components/input_number/style.ts
2
+ // src/components/input_number/style.ts
3
3
  var t = /* @__PURE__ */ (() => {
4
4
  let t = new CSSStyleSheet();
5
5
  return t.replaceSync(e), t;
6
6
  })();
7
- //#endregion
8
7
  export { t as default };
package/lib/list/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import e from "../base.js";
2
2
  import { parseAttrValue as t } from "../utils/index.js";
3
- import n from "../styles/animation/index.js";
4
- import r from "./index.less_inline.js";
3
+ import n from "./index.less_inline.js";
4
+ import r from "../styles/animation/index.js";
5
5
  import { $one as i } from "utilane/browser";
6
- //#region src/components/list/index.ts
6
+ // src/components/list/index.ts
7
7
  var a = class extends e {
8
8
  static baseName = "list";
9
9
  finish = !1;
@@ -24,7 +24,7 @@ var a = class extends e {
24
24
  }
25
25
  }
26
26
  connectedCallback() {
27
- this.loadStyleText([r]), this.root.adoptedStyleSheets = [n], super.connectedCallback(), this.infinite && (this.observer = new IntersectionObserver((e) => {
27
+ this.loadStyleText([n]), this.root.adoptedStyleSheets = [r], super.connectedCallback(), this.infinite && (this.observer = new IntersectionObserver((e) => {
28
28
  e[0].isIntersecting && !this.finish && (this._page++, this.setAttribute("loading", ""), this.emit("load", { detail: { page: this._page } }));
29
29
  }), this.$more = i(".l-list-loadmore", this.root), !this.finish && this.$more && this.observer.observe(this.$more));
30
30
  }
@@ -48,5 +48,4 @@ var a = class extends e {
48
48
  }
49
49
  }
50
50
  };
51
- //#endregion
52
51
  export { a as default };