litos-ui 0.23.1 → 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 (309) hide show
  1. package/lib/base.d.ts +3 -2
  2. package/lib/base.js +11 -8
  3. package/lib/button/index.d.ts +21 -5
  4. package/lib/button/index.js +115 -62
  5. package/lib/button/index.less_inline.js +2 -3
  6. package/lib/button/style.js +1 -2
  7. package/lib/calendar/index.js +22 -24
  8. package/lib/calendar/index.less_inline.js +1 -2
  9. package/lib/calendar/langs.js +1 -2
  10. package/lib/card/index.js +8 -9
  11. package/lib/card/index.less_inline.js +1 -2
  12. package/lib/carousel/index.js +10 -11
  13. package/lib/carousel/index.less_inline.js +1 -2
  14. package/lib/carousel/item.js +1 -2
  15. package/lib/carousel/item.less_inline.js +1 -2
  16. package/lib/carousel/timer.js +1 -2
  17. package/lib/check/check.d.ts +40 -8
  18. package/lib/check/check.js +200 -65
  19. package/lib/check/check.less_inline.js +2 -3
  20. package/lib/check/checkbox.js +2 -3
  21. package/lib/check/checkbox.less_inline.js +2 -3
  22. package/lib/check/checkbox_group.js +1 -2
  23. package/lib/check/index.d.ts +28 -8
  24. package/lib/check/index.js +151 -46
  25. package/lib/check/index.less_inline.js +1 -2
  26. package/lib/check/radio.js +2 -3
  27. package/lib/check/radio.less_inline.js +1 -2
  28. package/lib/check/radio_group.js +2 -3
  29. package/lib/collapse/index.d.ts +12 -4
  30. package/lib/collapse/index.js +80 -46
  31. package/lib/collapse/index.less_inline.js +2 -3
  32. package/lib/collapse/item.d.ts +35 -9
  33. package/lib/collapse/item.js +219 -57
  34. package/lib/collapse/item.less_inline.js +2 -3
  35. package/lib/collapse/types.d.ts +17 -3
  36. package/lib/color_picker/index.d.ts +4 -2
  37. package/lib/color_picker/index.js +26 -17
  38. package/lib/color_picker/index.less_inline.js +1 -2
  39. package/lib/date_picker/index.d.ts +5 -1
  40. package/lib/date_picker/index.js +39 -23
  41. package/lib/date_picker/index.less_inline.js +1 -2
  42. package/lib/date_picker_ori/index.d.ts +7 -2
  43. package/lib/date_picker_ori/index.js +123 -47
  44. package/lib/date_picker_ori/index.less_inline.js +1 -2
  45. package/lib/description_panel/index.js +2 -10
  46. package/lib/description_panel/index.less_inline.js +1 -2
  47. package/lib/dialog/dialog_box.js +28 -29
  48. package/lib/dialog/dialog_container.css_inline.js +1 -2
  49. package/lib/dialog/dialog_container.js +13 -14
  50. package/lib/dialog/dialog_container_style.js +1 -2
  51. package/lib/dialog/index.js +1 -2
  52. package/lib/dropdown/index.d.ts +39 -0
  53. package/lib/dropdown/index.js +98 -0
  54. package/lib/entries/base.js +1 -2
  55. package/lib/entries/button.js +5 -6
  56. package/lib/entries/calendar.js +5 -6
  57. package/lib/entries/card.js +5 -6
  58. package/lib/entries/carousel-item.js +5 -6
  59. package/lib/entries/carousel.js +5 -6
  60. package/lib/entries/checkbox-group.js +5 -6
  61. package/lib/entries/checkbox.js +5 -6
  62. package/lib/entries/collapse-item.d.ts +0 -1
  63. package/lib/entries/collapse-item.js +6 -6
  64. package/lib/entries/collapse.d.ts +0 -1
  65. package/lib/entries/collapse.js +11 -6
  66. package/lib/entries/color-picker.js +5 -6
  67. package/lib/entries/date-picker-ori.js +5 -6
  68. package/lib/entries/date-picker.js +5 -6
  69. package/lib/entries/description-panel.js +5 -6
  70. package/lib/entries/dialog-box.js +1 -2
  71. package/lib/entries/dialog-container.js +5 -6
  72. package/lib/entries/dialog.js +1 -2
  73. package/lib/entries/dropdown.d.ts +2 -0
  74. package/lib/entries/dropdown.js +1 -0
  75. package/lib/entries/form-item.js +5 -6
  76. package/lib/entries/form.js +5 -6
  77. package/lib/entries/icon-arrow-down.js +5 -6
  78. package/lib/entries/icon-arrow-left.js +5 -6
  79. package/lib/entries/icon-arrow-right.js +5 -6
  80. package/lib/entries/icon-arrow-up.js +5 -6
  81. package/lib/entries/icon-base.js +5 -6
  82. package/lib/entries/icon-calendar.js +5 -6
  83. package/lib/entries/icon-caret-bottom.js +5 -6
  84. package/lib/entries/icon-caret-top.js +5 -6
  85. package/lib/entries/icon-close-filled.js +5 -6
  86. package/lib/entries/icon-close.js +5 -6
  87. package/lib/entries/icon-copy.js +5 -6
  88. package/lib/entries/icon-d-arrow-left.js +5 -6
  89. package/lib/entries/icon-d-arrow-right.js +5 -6
  90. package/lib/entries/icon-delete.js +5 -6
  91. package/lib/entries/icon-eye-outline.js +5 -6
  92. package/lib/entries/icon-font-icon.js +5 -6
  93. package/lib/entries/icon-info.js +5 -6
  94. package/lib/entries/icon-loading.js +5 -6
  95. package/lib/entries/icon-minus.js +5 -6
  96. package/lib/entries/icon-moon.js +5 -6
  97. package/lib/entries/icon-more.js +5 -6
  98. package/lib/entries/icon-picture.js +5 -6
  99. package/lib/entries/icon-plus.js +5 -6
  100. package/lib/entries/icon-reduction.js +5 -6
  101. package/lib/entries/icon-refresh-left.js +5 -6
  102. package/lib/entries/icon-refresh-right.js +5 -6
  103. package/lib/entries/icon-refresh.js +5 -6
  104. package/lib/entries/icon-search.js +5 -6
  105. package/lib/entries/icon-select.js +5 -6
  106. package/lib/entries/icon-sort.js +5 -6
  107. package/lib/entries/icon-success.js +5 -6
  108. package/lib/entries/icon-sun.js +5 -6
  109. package/lib/entries/icon-theme-default.js +5 -6
  110. package/lib/entries/icon-warn.js +5 -6
  111. package/lib/entries/icon-zoom-in.js +5 -6
  112. package/lib/entries/icon-zoom-out.js +5 -6
  113. package/lib/entries/image-preview.js +5 -6
  114. package/lib/entries/image.js +5 -6
  115. package/lib/entries/input-number.js +5 -6
  116. package/lib/entries/input.js +5 -6
  117. package/lib/entries/list.js +5 -6
  118. package/lib/entries/loading.js +1 -2
  119. package/lib/entries/mask.js +5 -6
  120. package/lib/entries/md-input.js +5 -6
  121. package/lib/entries/menu.js +5 -6
  122. package/lib/entries/message.js +1 -2
  123. package/lib/entries/modal-box.js +1 -2
  124. package/lib/entries/modal.js +5 -6
  125. package/lib/entries/notification-box.js +1 -2
  126. package/lib/entries/notification.js +1 -2
  127. package/lib/entries/page-header.js +5 -6
  128. package/lib/entries/pagination.js +5 -6
  129. package/lib/entries/polygon.js +5 -6
  130. package/lib/entries/popconfirm.js +1 -2
  131. package/lib/entries/popover.js +1 -2
  132. package/lib/entries/qrcode.js +5 -6
  133. package/lib/entries/radio-group.js +5 -6
  134. package/lib/entries/radio.js +5 -6
  135. package/lib/entries/select-ori.js +5 -6
  136. package/lib/entries/select.js +5 -6
  137. package/lib/entries/space.js +5 -6
  138. package/lib/entries/switch.js +5 -6
  139. package/lib/entries/tabbar-item.js +5 -6
  140. package/lib/entries/tabbar.js +5 -6
  141. package/lib/entries/table.js +5 -6
  142. package/lib/entries/tabs.js +1 -2
  143. package/lib/entries/tag.js +5 -6
  144. package/lib/entries/theme-color.js +5 -6
  145. package/lib/entries/theme.js +5 -6
  146. package/lib/entries/transition.js +1 -2
  147. package/lib/entries/upload.js +5 -6
  148. package/lib/entries/utils.js +1 -3
  149. package/lib/form/accessibility.d.ts +15 -0
  150. package/lib/form/accessibility.js +56 -0
  151. package/lib/form/autocomplete.d.ts +21 -0
  152. package/lib/form/autocomplete.js +59 -0
  153. package/lib/form/context.d.ts +157 -0
  154. package/lib/form/context.js +88 -0
  155. package/lib/form/form_inner.d.ts +99 -24
  156. package/lib/form/form_inner.js +424 -72
  157. package/lib/form/form_item.d.ts +35 -11
  158. package/lib/form/form_item.js +210 -78
  159. package/lib/form/form_item.less_inline.js +2 -3
  160. package/lib/form/form_item_style.d.ts +3 -0
  161. package/lib/form/form_item_style.js +7 -0
  162. package/lib/form/index.d.ts +69 -15
  163. package/lib/form/index.js +501 -101
  164. package/lib/form/index.less_inline.js +1 -2
  165. package/lib/form/owner.d.ts +78 -0
  166. package/lib/form/owner.js +138 -0
  167. package/lib/form/style.d.ts +3 -0
  168. package/lib/form/style.js +7 -0
  169. package/lib/icon/arrow_down.js +1 -2
  170. package/lib/icon/arrow_left.js +1 -2
  171. package/lib/icon/arrow_right.js +1 -2
  172. package/lib/icon/arrow_up.js +1 -2
  173. package/lib/icon/base.js +1 -2
  174. package/lib/icon/calendar.js +1 -2
  175. package/lib/icon/caret_bottom.js +1 -2
  176. package/lib/icon/caret_top.js +1 -2
  177. package/lib/icon/close.js +1 -2
  178. package/lib/icon/close_filled.js +1 -2
  179. package/lib/icon/copy.js +1 -2
  180. package/lib/icon/d_arrow_left.js +1 -2
  181. package/lib/icon/d_arrow_right.js +1 -2
  182. package/lib/icon/delete.js +1 -2
  183. package/lib/icon/eye_outline.js +1 -2
  184. package/lib/icon/font_icon.js +1 -2
  185. package/lib/icon/icon_style.js +1 -2
  186. package/lib/icon/index.less_inline.js +1 -2
  187. package/lib/icon/info.js +1 -2
  188. package/lib/icon/loading.js +1 -2
  189. package/lib/icon/minus.js +1 -2
  190. package/lib/icon/moon.js +1 -2
  191. package/lib/icon/more.js +1 -2
  192. package/lib/icon/picture.js +1 -2
  193. package/lib/icon/plus.js +1 -2
  194. package/lib/icon/reduction.js +1 -2
  195. package/lib/icon/refresh.js +1 -2
  196. package/lib/icon/refresh_left.js +1 -2
  197. package/lib/icon/refresh_right.js +1 -2
  198. package/lib/icon/search.js +1 -2
  199. package/lib/icon/select.js +1 -2
  200. package/lib/icon/sort.js +1 -2
  201. package/lib/icon/success.js +1 -2
  202. package/lib/icon/sun.js +1 -2
  203. package/lib/icon/theme_default.js +1 -2
  204. package/lib/icon/warn.js +1 -2
  205. package/lib/icon/zoom_in.js +1 -2
  206. package/lib/icon/zoom_out.js +1 -2
  207. package/lib/image/image_preview.js +1 -2
  208. package/lib/image/image_preview.less_inline.js +1 -2
  209. package/lib/image/index.js +1 -2
  210. package/lib/image/index.less_inline.js +1 -2
  211. package/lib/index.d.ts +2 -1
  212. package/lib/index.js +91 -91
  213. package/lib/input/index.d.ts +14 -0
  214. package/lib/input/index.js +126 -31
  215. package/lib/input/index.less_inline.js +2 -3
  216. package/lib/input/input_inner.less_inline.js +1 -2
  217. package/lib/input/style.d.ts +1 -0
  218. package/lib/input/style.js +5 -7
  219. package/lib/input_number/index.d.ts +7 -0
  220. package/lib/input_number/index.js +70 -48
  221. package/lib/input_number/index.less_inline.js +1 -2
  222. package/lib/input_number/style.js +1 -2
  223. package/lib/list/index.js +4 -5
  224. package/lib/list/index.less_inline.js +1 -2
  225. package/lib/loading/index.js +1 -2
  226. package/lib/mask/index.js +2 -7
  227. package/lib/mask/index.less_inline.js +1 -2
  228. package/lib/md_input/index.d.ts +11 -2
  229. package/lib/md_input/index.js +63 -27
  230. package/lib/md_input/index.less_inline.js +2 -3
  231. package/lib/menu/index.js +2 -7
  232. package/lib/menu/index.less_inline.js +1 -2
  233. package/lib/message/index.js +1 -2
  234. package/lib/modal/index.js +15 -16
  235. package/lib/modal/index.less_inline.js +1 -2
  236. package/lib/modal/modal_box.js +24 -25
  237. package/lib/notification/index.js +15 -29
  238. package/lib/notification/index.less_inline.js +1 -2
  239. package/lib/notification/notification_box.js +2 -3
  240. package/lib/notification/placement.js +1 -2
  241. package/lib/notification/style.js +1 -2
  242. package/lib/page_header/index.js +1 -2
  243. package/lib/page_header/index.less_inline.js +1 -2
  244. package/lib/pagination/index.js +2 -7
  245. package/lib/pagination/index.less_inline.js +1 -2
  246. package/lib/polygon/index.js +1 -2
  247. package/lib/polygon/index.less_inline.js +1 -2
  248. package/lib/qrcode/index.js +1 -2
  249. package/lib/qrcode/index.less_inline.js +1 -2
  250. package/lib/select/index.d.ts +19 -2
  251. package/lib/select/index.js +128 -74
  252. package/lib/select/index.less_inline.js +1 -2
  253. package/lib/select_ori/index.d.ts +9 -1
  254. package/lib/select_ori/index.js +36 -24
  255. package/lib/select_ori/index.less_inline.js +1 -2
  256. package/lib/space/index.js +1 -2
  257. package/lib/space/index.less_inline.js +1 -2
  258. package/lib/styles/animation/index.css_inline.js +1 -2
  259. package/lib/styles/animation/index.js +1 -2
  260. package/lib/styles/mask/index.css_inline.js +1 -2
  261. package/lib/styles/mask/index.js +1 -2
  262. package/lib/switch/index.d.ts +6 -0
  263. package/lib/switch/index.js +31 -16
  264. package/lib/switch/index.less_inline.js +1 -2
  265. package/lib/tabbar/index.js +1 -2
  266. package/lib/tabbar/index.less_inline.js +1 -2
  267. package/lib/tabbar/item.js +1 -2
  268. package/lib/tabbar/item.less_inline.js +1 -2
  269. package/lib/table/index.js +1 -2
  270. package/lib/table/index.less_inline.js +1 -2
  271. package/lib/tabs/index.js +1 -2
  272. package/lib/tag/index.d.ts +11 -3
  273. package/lib/tag/index.js +25 -24
  274. package/lib/tag/index.less_inline.js +2 -3
  275. package/lib/theme/appearance.d.ts +5 -0
  276. package/lib/theme/appearance.js +34 -0
  277. package/lib/theme/index.js +83 -39
  278. package/lib/theme/index.less_inline.js +1 -2
  279. package/lib/theme/theme_color.js +1 -2
  280. package/lib/upload/index.js +28 -41
  281. package/lib/upload/index.less_inline.js +2 -3
  282. package/lib/upload/style.js +1 -2
  283. package/lib/utils/clickoutside.js +1 -2
  284. package/lib/utils/event.js +1 -2
  285. package/lib/utils/index.d.ts +27 -6
  286. package/lib/utils/index.js +26 -6
  287. package/lib/utils/popover.js +7 -16
  288. package/lib/utils/transition.js +1 -2
  289. package/package.json +16 -13
  290. package/styles/dark.css +10 -2
  291. package/styles/dropdown.css +46 -0
  292. package/styles/reset.css +0 -1
  293. package/styles/select.css +5 -0
  294. package/styles/themes/apple.css +47 -0
  295. package/styles/{theme-coral.css → themes/coral.css} +5 -3
  296. package/styles/themes/deep-sea-blue.css +12 -0
  297. package/styles/themes/gamboge.css +15 -0
  298. package/styles/{theme-jade.css → themes/jade.css} +5 -3
  299. package/styles/themes/lotus-seed.css +12 -0
  300. package/styles/{theme-tangerine.css → themes/tangerine.css} +5 -3
  301. package/styles/themes.css +8 -0
  302. package/styles/vars.css +8 -2
  303. package/types/preact.d.ts +42 -0
  304. package/lib/form/types.d.ts +0 -7
  305. package/lib/utils/context_provide.d.ts +0 -10
  306. package/lib/utils/context_provide.js +0 -22
  307. package/lib/utils/locale.d.ts +0 -6
  308. package/lib/utils/locale.js +0 -34
  309. package/lib/utils/signal_types.d.ts +0 -5
@@ -1,15 +1,27 @@
1
1
  import e from "../base.js";
2
- import { kebabToCamel as t, parseAttrValue as n, stopSignal as r } from "../utils/index.js";
3
- import i from "./item.less_inline.js";
4
- import { $$ as a, $one as o, off as s, on as c, queryHideNodeSize as l } from "utilane/browser";
5
- import { effect as u } from "alien-signals";
6
- //#region src/components/collapse/item.ts
7
- var d = class extends e {
2
+ import { parseAttrValue as t } from "../utils/index.js";
3
+ import n from "./item.less_inline.js";
4
+ import { $$ as r, off as i, on as a } from "utilane/browser";
5
+ // src/components/collapse/item.ts
6
+ var o = "a[href],button,input,select,textarea,label,summary,audio[controls],video[controls],[contenteditable]:not([contenteditable=\"false\"]),[tabindex],[role=\"button\"],[role=\"link\"],[role=\"checkbox\"],[role=\"radio\"],[role=\"switch\"]", s = `${o},[hidden],[aria-hidden="true"],script,style,template`, c = "collapse-panel", l = "collapse-toggle", u = 150;
7
+ function d(e) {
8
+ return e.nodeType === Node.TEXT_NODE ? e.textContent ?? "" : !(e instanceof Element) || e.matches(s) ? "" : Array.from(e.childNodes, d).join("");
9
+ }
10
+ var f = class extends e {
8
11
  static baseName = "collapse-item";
9
12
  $header;
13
+ $toggle;
14
+ $titleSlot;
15
+ _captionObserver;
10
16
  context;
11
- _ctxStop;
12
- _expandStop;
17
+ _pendingExpand;
18
+ _pendingGroup;
19
+ _setGroupExpand;
20
+ _unregisterGroupItem;
21
+ _visualExpanded = !1;
22
+ _expandFrame;
23
+ _expandAnimation;
24
+ _stopWatchingExpansion;
13
25
  expands;
14
26
  constructor() {
15
27
  super(), this.version = 2, this._state = {
@@ -19,100 +31,250 @@ var d = class extends e {
19
31
  };
20
32
  }
21
33
  updateDOM(e) {
22
- e.has("expand") && (this._setStyleAndClass(), this._handleExpand());
34
+ e.has("header-text") && this._updateHeaderText(), e.has("toggle-label") && this._updateToggleLabel(), e.has("heading-level") && this.$toggle?.parentElement?.setAttribute("aria-level", this._headingLevel());
23
35
  }
24
36
  _setStyleAndClass() {
25
- this._state.expand ? this.classList.add("l-collapse-expand") : this.classList.remove("l-collapse-expand");
37
+ this._state.expand ? this.classList.add("l-collapse-expand") : this.classList.remove("l-collapse-expand"), this.$toggle?.setAttribute("aria-expanded", String(this._state.expand));
26
38
  }
27
39
  static get observedAttributes() {
28
40
  return [
29
41
  "prop",
30
42
  "header-text",
31
- "expand"
43
+ "expand",
44
+ "heading-level",
45
+ "toggle-label"
32
46
  ];
33
47
  }
34
- attributeChanged(e, r, i) {
48
+ attributeChanged(e, n, r) {
35
49
  switch (e) {
36
50
  case "prop":
51
+ this._state.prop = r ?? "";
52
+ break;
37
53
  case "header-text":
38
- this._state[t(e)] = i;
54
+ this._state.headerText = r ?? "";
39
55
  break;
40
56
  case "expand":
41
- let r = n(i, !1, "expand");
42
- r !== this._state.expand && (this._state.expand = r);
57
+ let e = t(r, !1, "expand");
58
+ this.rendered && this._applyAttributeExpand(e), (!this.rendered || this._pendingGroup) && (this._pendingExpand = e);
43
59
  }
44
60
  }
45
61
  render_v2() {
46
- this._state.expand && this._emitChange();
47
- let e = document.createDocumentFragment(), t = a("div", {
62
+ let e = document.createDocumentFragment(), t = r("div", {
48
63
  class: "l-collapse-item__header",
49
64
  part: "header"
50
- }), n = a("l-arrow-right-icon", { class: "l-collapse-arrow-icon" });
51
- if (t.appendChild(n), this._state.headerText) {
52
- let e = a("span", {
53
- part: "header-text",
54
- textContent: `${this._state.headerText}`
55
- });
56
- t.appendChild(e);
57
- } else t.appendChild(a("slot", { name: "header-text" }));
58
- return e.appendChild(t), this._state.expand && e.appendChild(this._createContentElement(!1)), {
65
+ }), i = r("div", {
66
+ class: "l-collapse-item__heading",
67
+ role: "heading",
68
+ "aria-level": this._headingLevel()
69
+ }), a = r("button", {
70
+ class: "l-collapse-item__toggle",
71
+ id: l,
72
+ type: "button",
73
+ "aria-expanded": String(this._state.expand),
74
+ "aria-controls": c
75
+ });
76
+ a.append(r("l-arrow-right-icon", {
77
+ class: "l-collapse-arrow-icon",
78
+ "aria-hidden": "true"
79
+ })), i.append(a), t.append(i);
80
+ let o = this._state.headerText;
81
+ o ? a.append(this._createHeaderText(o)) : t.append(r("slot", { name: "header-text" }));
82
+ let s = this._createContentElement(!this._state.expand);
83
+ return s.id = c, s.inert = !this._state.expand, s.setAttribute("role", "group"), s.setAttribute("aria-labelledby", l), e.append(t, s), {
59
84
  template: e,
60
- style: i
85
+ style: n
61
86
  };
62
87
  }
88
+ _headingLevel() {
89
+ let e = this.getAttribute("heading-level") ?? "";
90
+ return /^[1-6]$/.test(e) ? e : "3";
91
+ }
92
+ _createHeaderText(e) {
93
+ return r("span", {
94
+ part: "header-text",
95
+ textContent: e
96
+ });
97
+ }
98
+ _updateHeaderText() {
99
+ if (!this.$header || !this.$toggle) return;
100
+ let e = this.$toggle.querySelector("[part=\"header-text\"]"), t = this._state.headerText;
101
+ if (t) e ? e.textContent = t : this.$toggle.append(this._createHeaderText(t)), this.$titleSlot ? (this.$titleSlot.remove(), this._setTitleSlot()) : this._updateToggleLabel();
102
+ else if (!this.$titleSlot) {
103
+ e?.remove();
104
+ let t = r("slot", { name: "header-text" });
105
+ this.$header.append(t), this._setTitleSlot(t);
106
+ }
107
+ }
108
+ _setTitleSlot(e) {
109
+ this.$titleSlot?.removeEventListener("slotchange", this._observeTitleCaption), this.$titleSlot = e, e?.addEventListener("slotchange", this._observeTitleCaption), this._observeTitleCaption();
110
+ }
111
+ _observeTitleCaption = () => {
112
+ this._captionObserver?.disconnect();
113
+ for (let e of this.$titleSlot?.assignedElements() ?? []) this._captionObserver ??= new MutationObserver(this._updateToggleLabel), this._captionObserver.observe(e, {
114
+ subtree: !0,
115
+ childList: !0,
116
+ characterData: !0,
117
+ attributes: !0,
118
+ attributeFilter: [
119
+ "hidden",
120
+ "aria-hidden",
121
+ "href",
122
+ "controls",
123
+ "contenteditable",
124
+ "tabindex",
125
+ "role"
126
+ ]
127
+ });
128
+ this._updateToggleLabel();
129
+ };
130
+ _updateToggleLabel = () => {
131
+ if (!this.$toggle) return;
132
+ let e = this.getAttribute("toggle-label")?.trim();
133
+ if (e) this.$toggle.setAttribute("aria-label", e);
134
+ else if (this._state.headerText.trim()) this.$toggle.removeAttribute("aria-label");
135
+ else {
136
+ let e = this.$titleSlot?.assignedElements().map(d).join(" ").trim();
137
+ this.$toggle.setAttribute("aria-label", e || "Toggle panel");
138
+ }
139
+ };
63
140
  afterInit() {
64
- this._setStyleAndClass(), this.$header = o(".l-collapse-item__header", this.root), this.emitInject("collapse-context-request", this.contextInject), this._ctxStop = u(this._updateLayout), this._expandStop = u(this._handleExpandsChange), this.$header && c(this.$header, "click", this._handleHeaderTap);
141
+ this._visualExpanded = this._state.expand, this.$header = this.root.querySelector(".l-collapse-item__header") ?? void 0, this.$toggle = this.$header?.querySelector("button") ?? void 0, this._setTitleSlot(this.$header?.querySelector("slot") ?? void 0), this._setStyleAndClass(), this._pendingExpand === !1 && !this._state.expand && (this._pendingExpand = void 0), this._connectGroup() || (this._pendingGroup = this.closest("l-collapse") ?? void 0, this._pendingGroup?.addEventListener("collapse-context-ready", this._handleGroupReady, { once: !0 }), this._pendingExpand !== void 0 && this._applyExpand(this._pendingExpand), this._pendingGroup || (this._pendingExpand = void 0)), this.$header && a(this.$header, "click", this._handleHeaderTap);
142
+ }
143
+ _connectGroup() {
144
+ if (this.emitInject("collapse-context-request", this._receiveGroupContext), !this.context) return !1;
145
+ let e = this._pendingExpand;
146
+ return this._pendingExpand = void 0, e !== void 0 && this._applyAttributeExpand(e), this._unregisterGroupItem || this._updateLayout(), this._handleExpandsChange(), !0;
65
147
  }
148
+ _receiveGroupContext = (e, t, n, r) => {
149
+ this.contextInject(e, t, n), this._unregisterGroupItem?.(), this._unregisterGroupItem = r?.({
150
+ getProp: () => this._state.prop,
151
+ applyExpand: (e) => this._applyExpand(e)
152
+ });
153
+ };
154
+ _handleGroupReady = () => {
155
+ this._pendingGroup = void 0, this._connectGroup();
156
+ };
66
157
  beforeDestroy() {
67
- this._ctxStop = r(this._ctxStop), this._expandStop = r(this._expandStop), this.$header && s(this.$header, "click", this._handleHeaderTap), this.$header = void 0;
158
+ this._expandFrame !== void 0 && (cancelAnimationFrame(this._expandFrame), this._expandFrame = void 0), this._cancelExpandAnimation(), this._pendingGroup?.removeEventListener("collapse-context-ready", this._handleGroupReady), this._pendingGroup = void 0, this._pendingExpand = void 0, this._unregisterGroupItem?.(), this._unregisterGroupItem = void 0, this.context && this.classList.remove("background", "space"), this.context = void 0, this.expands = void 0, this._setGroupExpand = void 0, this.$header && i(this.$header, "click", this._handleHeaderTap), this.$header = void 0, this.$toggle = void 0, this._setTitleSlot();
68
159
  }
69
160
  _handleExpandsChange = () => {
70
- this.expands && this.expands().includes(this._state.prop) !== this._state.expand && this._handleHeaderTap();
161
+ this.expands && this._applyExpand(this.expands().includes(this._state.prop));
71
162
  };
72
- _handleHeaderTap = () => {
73
- this._state.expand = !this._state.expand, this._setStyleAndClass(), this._handleExpand();
163
+ _handleHeaderTap = (e) => {
164
+ if (e?.defaultPrevented) return;
165
+ for (let t of e?.composedPath() ?? []) {
166
+ if (t === this.$header || t === this.$toggle) break;
167
+ if (t instanceof Element && t.matches(o)) return;
168
+ }
169
+ let t = {
170
+ prop: this._state.prop,
171
+ expand: !this._state.expand
172
+ };
173
+ this._applyExpand(t.expand), this._pendingGroup && (this._pendingExpand = t.expand), this._setGroupExpand?.(t, !0), this._emitChange(t);
74
174
  };
175
+ _applyExpand(e) {
176
+ e !== this._state.expand && (this._state.expand = e, this._handleExpand());
177
+ }
178
+ _applyAttributeExpand(e) {
179
+ this._applyExpand(e), this._setGroupExpand?.({
180
+ prop: this._state.prop,
181
+ expand: e
182
+ });
183
+ }
75
184
  _updateLayout = () => {
76
185
  if (!this.context) return;
77
186
  let e = this.context();
78
187
  this.$header && (e.arrowPlacement === "right" ? this.$header.classList.add("arrow-right") : this.$header.classList.remove("arrow-right"), e.headerJustify === "space-between" ? this.$header.classList.add("space-between") : this.$header.classList.remove("space-between")), e.background ? this.classList.add("background") : this.classList.remove("background"), e.gap ? this.classList.add("space") : this.classList.remove("space");
79
188
  };
80
- contextInject = (e, t) => {
81
- this.context = e, this.expands = t;
189
+ contextInject = (e, t, n) => {
190
+ this.context = e, this.expands = t, this._setGroupExpand = n;
82
191
  };
83
192
  _handleExpand() {
84
193
  if (!this.rendered) return;
85
- let e = o(".l-collapse-content", this.root), t = 0;
86
- if (this._state.expand) {
87
- this.classList.add("l-collapse-expand"), e || (e = this._createContentElement(!0), this.root.appendChild(e));
88
- let n = l(e, null);
89
- e.style.height = `${n.height}px`, e.style.display = "block", t = n.height;
90
- } else this.classList.remove("l-collapse-expand"), e && (t = e.getBoundingClientRect().height);
91
- if (e) {
92
- let n = [{ height: "0px" }, { height: `${t}px` }];
93
- this._state.expand || n.reverse();
94
- let r = e.animate(n, { duration: 150 });
95
- r.onfinish = () => {
96
- this._state.expand || (e.style.display = "none"), r.onfinish = null, r = null;
97
- };
194
+ this._setStyleAndClass();
195
+ let e = this.root.getElementById(c);
196
+ e && (!this._state.expand && e.matches(":focus-within") && this.$toggle?.focus({ preventScroll: !0 }), e.inert = !this._state.expand, this.rendered && this._expandFrame === void 0 && this._visualExpanded !== this._state.expand && (this._expandFrame = requestAnimationFrame(() => {
197
+ this._expandFrame = void 0, this._commitExpansion();
198
+ })));
199
+ }
200
+ _commitExpansion() {
201
+ let e = this.root.getElementById(c);
202
+ if (!this.rendered || !e) return;
203
+ let t = this._state.expand;
204
+ if (t === this._visualExpanded) {
205
+ this._expandAnimation?.playState === "finished" && this._settleExpansion(e, t);
206
+ return;
98
207
  }
99
- this._emitChange();
208
+ this._visualExpanded = t;
209
+ let n = this.ownerDocument.defaultView?.matchMedia("(prefers-reduced-motion: reduce)");
210
+ if (n?.matches || typeof e.animate != "function") {
211
+ this._settleExpansion(e, t);
212
+ return;
213
+ }
214
+ let r = e.style.display === "none" ? 0 : parseFloat(getComputedStyle(e).height) || 0;
215
+ this._cancelExpandAnimation(), t && (e.style.display = "block");
216
+ let i = t ? this._expandedHeight(e) : 0;
217
+ r === i ? this._settleExpansion(e, t) : (this._playHeightAnimation(e, t, r, i, u), this._watchExpansion(e, t, n, i));
100
218
  }
101
- _emitChange = () => {
102
- this.emit("expand-change", { detail: {
103
- prop: this._state.prop,
104
- expand: this._state.expand
105
- } });
219
+ _expandedHeight(e) {
220
+ let t = e.firstElementChild;
221
+ if (!t) return 0;
222
+ let n = getComputedStyle(e), r = parseFloat(getComputedStyle(t).height);
223
+ return Number.isFinite(r) ? r + parseFloat(n.borderTopWidth) + parseFloat(n.borderBottomWidth) : 0;
224
+ }
225
+ _playHeightAnimation(e, t, n, r, i) {
226
+ this._cancelHeightAnimation();
227
+ let a = e.animate([{ height: `${n}px` }, { height: `${r}px` }], {
228
+ duration: i,
229
+ fill: "both"
230
+ });
231
+ this._expandAnimation = a, a.onfinish = () => {
232
+ this._expandAnimation === a && this._state.expand === t && this._settleExpansion(e, t);
233
+ };
234
+ }
235
+ _watchExpansion(e, t, n, r) {
236
+ let i, a = () => {
237
+ i?.disconnect(), n?.removeEventListener("change", o);
238
+ }, o = (t) => {
239
+ t.matches && this._stopWatchingExpansion === a && this._settleExpansion(e, this._state.expand);
240
+ };
241
+ this._stopWatchingExpansion = a, n?.addEventListener("change", o);
242
+ let s = e.firstElementChild;
243
+ t && s && typeof ResizeObserver < "u" && (i = new ResizeObserver(() => {
244
+ let t = this._expandAnimation;
245
+ if (!t || this._stopWatchingExpansion !== a || !this._state.expand) return;
246
+ let n = Number(t.effect?.getComputedTiming().endTime ?? 0) - Number(t.currentTime);
247
+ if (n <= 0) return;
248
+ let i = this._expandedHeight(e);
249
+ if (Math.abs(i - r) < .5) return;
250
+ let o = parseFloat(getComputedStyle(e).height) || 0;
251
+ r = i, this._playHeightAnimation(e, !0, o, i, n);
252
+ }), i.observe(s, { box: "border-box" }));
253
+ }
254
+ _settleExpansion(e, t) {
255
+ this._cancelExpandAnimation(), this._visualExpanded = t, e.style.display = t ? "block" : "none";
256
+ }
257
+ _cancelExpandAnimation() {
258
+ this._stopWatchingExpansion?.(), this._stopWatchingExpansion = void 0, this._cancelHeightAnimation();
259
+ }
260
+ _cancelHeightAnimation() {
261
+ let e = this._expandAnimation;
262
+ e && (this._expandAnimation = void 0, e.onfinish = null, e.cancel());
263
+ }
264
+ _emitChange = (e = {
265
+ prop: this._state.prop,
266
+ expand: this._state.expand
267
+ }) => {
268
+ this.emit("expand-change", { detail: e });
106
269
  };
107
270
  _createContentElement(e = !0) {
108
- return a("div", {
271
+ return r("div", {
109
272
  class: "l-collapse-content",
110
273
  style: e ? "display: none;" : ""
111
- }, [a("div", {
274
+ }, [r("div", {
112
275
  class: "l-collapse-content-box",
113
276
  innerHTML: "<slot></slot>"
114
277
  })]);
115
278
  }
116
279
  };
117
- //#endregion
118
- export { d as default };
280
+ export { f as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/collapse/item.less?inline
2
- var e = ":host{box-sizing:border-box;border-bottom:1px solid var(--l-collapse-border-color);color:#333;font-size:14px;display:block}.l-collapse-item__header{cursor:pointer;justify-content:flex-start;align-items:center;gap:5px;padding:10px 0;display:flex}.l-collapse-item__header.arrow-right{flex-direction:row-reverse;justify-content:flex-end}.l-collapse-item__header.space-between{justify-content:space-between}.l-collapse-arrow-icon{transition:transform .3s;transform:rotate(0)}.l-collapse-content{box-sizing:border-box;transition:height .3s;overflow-y:hidden}.l-collapse-content-box{padding-bottom:15px}:host(.l-collapse-expand) .l-collapse-arrow-icon{transform:rotate(90deg)}:host(.background){border-left:1px solid var(--l-collapse-border-color);border-right:1px solid var(--l-collapse-border-color);background-color:#00000005}:host(.background:first-child),:host(.background.space){border-top:1px solid var(--l-collapse-border-color)}:host(.background) .l-collapse-item__header{padding:10px 15px}:host(.background) .l-collapse-content{border-top:1px solid var(--l-collapse-border-color);background:#fff}:host(.background) .l-collapse-content-box{padding:15px}:host(:first-child){border-top-left-radius:var(--l-collapse-border-radius,0px);border-top-right-radius:var(--l-collapse-border-radius,0px)}:host(:last-child){border-bottom-left-radius:var(--l-collapse-border-radius,0px);border-bottom-right-radius:var(--l-collapse-border-radius,0px)}:host(.space){border-radius:var(--l-collapse-border-radius,0px)}";
3
- //#endregion
1
+ // src/components/collapse/item.less?inline
2
+ var e = ":host{box-sizing:border-box;border-bottom:1px solid var(--l-collapse-border-color);border-left:var(--l-collapse-frame-width,0px) solid var(--l-collapse-border-color);border-right:var(--l-collapse-frame-width,0px) solid var(--l-collapse-border-color);border-top:var(--l-collapse-spaced-border-width,0px) solid var(--l-collapse-border-color);border-radius:var(--l-collapse-spaced-radius,revert-layer);background-color:var(--l-collapse-item-background,transparent);color:var(--l-text-color,#333);font-size:14px;display:block}.l-collapse-item__header{padding:var(--l-collapse-header-padding,10px 0);cursor:pointer;flex-direction:var(--l-collapse-header-direction,row);align-items:center;justify-content:var(--l-collapse-header-justify,flex-start);gap:5px;display:flex}.l-collapse-item__header.arrow-right{flex-direction:row-reverse;justify-content:flex-end}.l-collapse-item__header.space-between{justify-content:space-between}.l-collapse-item__heading,.l-collapse-item__toggle{flex-direction:inherit;justify-content:inherit;gap:inherit;min-width:0;display:flex}.l-collapse-item__heading:only-child{flex:1}.l-collapse-item__toggle{appearance:none;width:100%;color:inherit;font:inherit;text-align:start;cursor:inherit;background:0 0;border:0;align-items:center;padding:0}.l-collapse-item__toggle:focus-visible{outline-offset:2px;box-shadow:0 0 0 2px var(--l-primary-color,#007bff);outline:2px solid}.l-collapse-arrow-icon{transition:transform .3s;transform:rotate(0)}@media (prefers-reduced-motion:reduce){.l-collapse-arrow-icon{transition:none}}.l-collapse-content{box-sizing:border-box;border-top:var(--l-collapse-frame-width,0px) solid var(--l-collapse-border-color);background:var(--l-collapse-content-background,transparent);overflow-y:hidden}.l-collapse-content-box{box-sizing:border-box;padding:var(--l-collapse-content-padding,0 0 15px);display:flow-root}:host(.l-collapse-expand) .l-collapse-arrow-icon{transform:rotate(90deg)}:host(:first-child){border-top-width:var(--l-collapse-frame-width,0px)}:host(.background){border-left:1px solid var(--l-collapse-border-color);border-right:1px solid var(--l-collapse-border-color);background-color:var(--_l-collapse-header-fill,#00000005)}:host(.background:first-child),:host(.background.space){border-top:1px solid var(--l-collapse-border-color)}:host(.background) .l-collapse-item__header{padding:10px 15px}:host(.background) .l-collapse-content{border-top:1px solid var(--l-collapse-border-color);background:var(--_l-collapse-panel-fill,#fff)}:host(.background) .l-collapse-content-box{padding:15px}@layer collapse-joined-corners{:host(:first-child){border-top-left-radius:var(--l-collapse-border-radius,0px);border-top-right-radius:var(--l-collapse-border-radius,0px)}:host(:last-child){border-bottom-left-radius:var(--l-collapse-border-radius,0px);border-bottom-right-radius:var(--l-collapse-border-radius,0px)}}:host(.space){border-radius:var(--l-collapse-border-radius,0px)}";
4
3
  export { e as default };
@@ -1,8 +1,22 @@
1
- import type { Signal } from "../utils/signal_types";
2
- export type CollapseContext = Signal<{
1
+ export type CollapseAccessor<T> = {
2
+ (): T;
3
+ (value: T): void;
4
+ };
5
+ export type CollapseExpandChange = {
6
+ prop: string;
7
+ expand: boolean;
8
+ };
9
+ export type SetCollapseItemExpand = (detail: CollapseExpandChange, notify?: boolean) => void;
10
+ export type CollapseItemBinding = {
11
+ getProp: () => string;
12
+ applyExpand: (expand: boolean) => void;
13
+ };
14
+ export type RegisterCollapseItem = (item: CollapseItemBinding) => () => void;
15
+ export type CollapseLayout = {
3
16
  arrowPlacement: "left" | "right";
4
17
  headerJustify: "flex-start" | "flex-end" | "space-between";
5
18
  /** 是否带有背景边框 */
6
19
  background: boolean;
7
20
  gap?: string;
8
- }>;
21
+ };
22
+ export type CollapseContext = CollapseAccessor<CollapseLayout>;
@@ -1,9 +1,11 @@
1
1
  import FormInner from "../form/form_inner";
2
2
  export default class ColorPicker extends FormInner {
3
3
  static baseName: string;
4
+ static get observedAttributes(): string[];
4
5
  $picker?: HTMLInputElement;
5
- _value: string;
6
- constructor();
6
+ protected get intrinsicDefaultValue(): string;
7
+ protected parseDefaultValue(value: string | null): string;
8
+ private normalizeColor;
7
9
  setValue(value: any): void;
8
10
  connectedCallback(): void;
9
11
  disconnectedCallback(): void;
@@ -1,31 +1,40 @@
1
- import { initAttr as e, setAttrs as t } from "../utils/index.js";
2
- import n from "../form/form_inner.js";
3
- import r from "../input/index.less_inline.js";
4
- import i from "./index.less_inline.js";
5
- import { $one as a, off as o, on as s } from "utilane/browser";
6
- //#region src/components/color_picker/index.ts
7
- var c = class extends n {
1
+ import e from "../form/form_inner.js";
2
+ import { setAttrs as t } from "../utils/index.js";
3
+ import n from "../input/index.less_inline.js";
4
+ import r from "./index.less_inline.js";
5
+ import { $one as i, off as a, on as o } from "utilane/browser";
6
+ // src/components/color_picker/index.ts
7
+ var s = class extends e {
8
8
  static baseName = "color-picker";
9
+ static get observedAttributes() {
10
+ return [...new Set(e.observedAttributes)];
11
+ }
9
12
  $picker;
10
- _value = "#000000";
11
- constructor() {
12
- super(), e(this);
13
+ get intrinsicDefaultValue() {
14
+ return "#000000";
15
+ }
16
+ parseDefaultValue(e) {
17
+ return this.normalizeColor(e);
18
+ }
19
+ normalizeColor(e) {
20
+ let t = typeof e == "string" ? e.trim() : "";
21
+ return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : this.intrinsicDefaultValue;
13
22
  }
14
23
  setValue(e) {
15
- super.setValue(e), this.$picker && (this.$picker.value = e);
24
+ let t = this.normalizeColor(e);
25
+ this.$picker && (this.$picker.value = t), super.setValue(t);
16
26
  }
17
27
  connectedCallback() {
18
- this.loadStyleText([r, i]), super.connectedCallback(), this.$picker = a("input", this.root), s(this.$picker, "change", this._handleChange);
28
+ this.loadStyleText([n, r]), super.connectedCallback(), this.$picker = i("input", this.root), this.syncNativeValue(), o(this.$picker, "change", this._handleChange);
19
29
  }
20
30
  disconnectedCallback() {
21
- super.disconnectedCallback(), this.$picker &&= (o(this.$picker, "change", this._handleChange), void 0);
31
+ super.disconnectedCallback(), this.$picker &&= (a(this.$picker, "change", this._handleChange), void 0);
22
32
  }
23
33
  render() {
24
34
  let e = document.createElement("input");
25
35
  return t(e, [
26
36
  ["value", this.value],
27
37
  ["disabled", this.isDisabled()],
28
- ["name", this.getName()],
29
38
  ["type", "color"],
30
39
  ["class", "l-input l-color-picker"]
31
40
  ]), e;
@@ -34,9 +43,9 @@ var c = class extends n {
34
43
  this.$picker && (this.$picker.disabled = this.isDisabled());
35
44
  }
36
45
  _handleChange = (e) => {
46
+ e.stopPropagation();
37
47
  let t = e.target.value;
38
- super.setValue(t), this.emit("change", { detail: t });
48
+ this.setValue(t), this.validateInput(), this.emit("change", { detail: t });
39
49
  };
40
50
  };
41
- //#endregion
42
- export { c as default };
51
+ export { s as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/color_picker/index.less?inline
1
+ // src/components/color_picker/index.less?inline
2
2
  var e = ":host{--l-input-width:60px}";
3
- //#endregion
4
3
  export { e as default };
@@ -4,8 +4,9 @@ type DatePickerState = {
4
4
  };
5
5
  export default class DatePicker extends FormInner<DatePickerState> {
6
6
  static baseName: string;
7
- private _popover;
7
+ private _popover?;
8
8
  constructor();
9
+ private _createPopover;
9
10
  afterInit(): void;
10
11
  beforeDestroy(): void;
11
12
  static get observedAttributes(): string[];
@@ -17,6 +18,9 @@ export default class DatePicker extends FormInner<DatePickerState> {
17
18
  };
18
19
  private _popoverContentRender;
19
20
  private _updateWidth;
21
+ setValue(value: any): void;
22
+ protected disabledChange(): void;
23
+ private _handleInput;
20
24
  private _handleTap;
21
25
  private _onOuterTap;
22
26
  }
@@ -1,15 +1,18 @@
1
- import { unitNumberStr as e } from "../utils/index.js";
2
- import t from "../form/form_inner.js";
1
+ import e from "../form/form_inner.js";
2
+ import t from "./index.less_inline.js";
3
3
  import n from "../input/input_inner.less_inline.js";
4
- import { Popover as r } from "../utils/popover.js";
5
- import i from "./index.less_inline.js";
6
- import { $$ as a, on as o } from "utilane/browser";
7
- //#region src/components/date_picker/index.ts
8
- var s = class extends t {
4
+ import { unitNumberStr as r } from "../utils/index.js";
5
+ import { Popover as i } from "../utils/popover.js";
6
+ import { $$ as a, $one as o, off as s, on as c } from "utilane/browser";
7
+ // src/components/date_picker/index.ts
8
+ var l = class extends e {
9
9
  static baseName = "date-picker";
10
10
  _popover;
11
11
  constructor() {
12
- super(), this.version = 2, this._state = {}, this._popover = new r({
12
+ super(), this.version = 2, this._state = {};
13
+ }
14
+ _createPopover() {
15
+ this._popover = new i({
13
16
  trigger: "manual",
14
17
  reference: this,
15
18
  placement: "bottom-start",
@@ -21,29 +24,30 @@ var s = class extends t {
21
24
  });
22
25
  }
23
26
  afterInit() {
24
- this._updateWidth(), o(this, "click", this._handleTap);
27
+ this._updateWidth(), this._createPopover(), this.syncNativeValue(), this.disabledChange(), c(this.root, "input", this._handleInput), c(this, "click", this._handleTap);
25
28
  }
26
29
  beforeDestroy() {
27
- this._popover.destroy(), o(this, "off", this._handleTap), this._popover = void 0;
30
+ this._popover?.destroy(), s(this, "click", this._handleTap), s(this.root, "input", this._handleInput), this._popover = void 0;
28
31
  }
29
32
  static get observedAttributes() {
30
- return ["width"];
33
+ return [.../* @__PURE__ */ new Set([...e.observedAttributes, "width"])];
31
34
  }
32
- attributeChange(t, n, r) {
33
- t === "width" && (this._state.width = e(r));
35
+ attributeChange(e, t, n) {
36
+ e === "width" && (this._state.width = r(n));
34
37
  }
35
38
  updateDOM(e) {
36
39
  e.has("width") && this._updateWidth();
37
40
  }
38
41
  render_v2() {
39
- let e = document.createDocumentFragment(), t = a("input", {
42
+ let e = document.createDocumentFragment(), r = a("input", {
40
43
  class: "l-input__inner",
41
- placeholder: "请选择日期"
44
+ placeholder: "请选择日期",
45
+ value: this.value ?? ""
42
46
  });
43
- e.appendChild(t);
44
- let r = a("l-calendar-icon", { class: "icon" });
45
- return e.appendChild(r), {
46
- style: [i, n],
47
+ e.appendChild(r);
48
+ let i = a("l-calendar-icon", { class: "icon" });
49
+ return e.appendChild(i), {
50
+ style: [t, n],
47
51
  template: e
48
52
  };
49
53
  }
@@ -63,6 +67,7 @@ var s = class extends t {
63
67
  });
64
68
  t.appendChild(r);
65
69
  let i = a("button", {
70
+ type: "button",
66
71
  class: "l-date-picker-header-btn l-date-picker-year-month",
67
72
  textContent: "2026-04"
68
73
  });
@@ -89,12 +94,23 @@ var s = class extends t {
89
94
  _updateWidth() {
90
95
  this._state.width ? this.style.setProperty("--l-date-picker-width", this._state.width) : this.style.removeProperty("--l-date-picker-width");
91
96
  }
97
+ setValue(e) {
98
+ super.setValue(e);
99
+ let t = o("input", this.root);
100
+ t && (t.value = e ?? ""), this.syncNativeValue();
101
+ }
102
+ disabledChange() {
103
+ let e = o("input", this.root);
104
+ e && (e.disabled = this.isDisabled()), this.isDisabled() && this._popover?.hide();
105
+ }
106
+ _handleInput = (e) => {
107
+ this.isDisabled() || (this.setValue(e.target.value), this.validateInput());
108
+ };
92
109
  _handleTap = () => {
93
- this._popover.isShow() || this._popover.show(this);
110
+ this.isDisabled() || this._popover && !this._popover.isShow() && this._popover.show(this);
94
111
  };
95
112
  _onOuterTap = (e, t, n) => {
96
- t || n || this._popover.hide();
113
+ t || n || this._popover?.hide();
97
114
  };
98
115
  };
99
- //#endregion
100
- export { s as default };
116
+ export { l as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/date_picker/index.less?inline
1
+ // src/components/date_picker/index.less?inline
2
2
  var e = ":host{height:var(--l-form-control-height,32px);border:1px solid var(--l-border-color,#dedede);border-radius:var(--l-border-radius,3px);width:var(--l-date-picker-width,140px);align-items:center;gap:8px;padding:0 8px;transition:border-color .3s;display:inline-flex}:host(:hover){border-color:var(--l-primary-color-light2,#66b3ff)}.icon{color:#00000059;flex-shrink:0;min-width:0}";
3
- //#endregion
4
3
  export { e as default };
@@ -3,7 +3,7 @@ type DateInputType = "date" | "datetime-local" | "time" | "month" | "week";
3
3
  type DatePickerOriState = {
4
4
  /** 是否显示日期范围选择 */
5
5
  range: boolean;
6
- /** 范围选择器时,为了性能考虑, 立即改变一个日期后,会延迟 300ms 通知, 以响应其它选择器, 0 - 立即触发 */
6
+ /** 区间 change 的延时,0 表示在下一个定时器任务派发。 */
7
7
  delay: number;
8
8
  type: DateInputType;
9
9
  width?: string;
@@ -17,7 +17,12 @@ export default class DatePicker extends FormInner {
17
17
  static baseName: string;
18
18
  _state: DatePickerOriState;
19
19
  constructor();
20
- setValue(v: string): void;
20
+ protected parseDefaultValue(value: string | null): string;
21
+ setValue(value: string | null | undefined): void;
22
+ /** 范围业务值仍是逗号串,原生日期约束分别校验两个端点。 */
23
+ protected get nativeConstraintValues(): readonly unknown[];
24
+ protected get nativeBadInput(): boolean;
25
+ protected disabledChange(): void;
21
26
  static get observedAttributes(): string[];
22
27
  connectedCallback(): void;
23
28
  afterInit(): void;