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
@@ -2,7 +2,7 @@ import e from "../base.js";
2
2
  import { kebabToCamel as t, parseAttrValue as n, tagAttr as r } from "../utils/index.js";
3
3
  import i from "./index.less_inline.js";
4
4
  import { $one as a, clsx as o, off as s, on as c, shouldEventNext as l } from "utilane/browser";
5
- //#region src/components/pagination/index.ts
5
+ // src/components/pagination/index.ts
6
6
  var u = class extends e {
7
7
  static baseName = "pagination";
8
8
  constructor() {
@@ -54,7 +54,7 @@ var u = class extends e {
54
54
  e && (this.#i(), e.innerHTML = this.#n(), this.#r());
55
55
  }
56
56
  render() {
57
- return `<div class="l-pagination">${this.#n()}</div>`;
57
+ return `<div class="l-pagination" role="navigation" aria-label="Pagination">${this.#n()}</div>`;
58
58
  }
59
59
  render_v2() {
60
60
  return {
@@ -87,10 +87,10 @@ var u = class extends e {
87
87
  if (this._state.pageCount <= 1) return "";
88
88
  let e = [];
89
89
  if (e.push(this.#c("l-button", {
90
- title: "上一页",
90
+ title: "Previous page",
91
91
  disabled: this._state.currentPage === 1,
92
- "data-page": this._state.currentPage - 1,
93
- innerHTML: "<l-arrow-left-icon></l-arrow-left-icon>",
92
+ "data-page": `${this._state.currentPage - 1}`,
93
+ innerHTML: "<l-arrow-left-icon></l-arrow-left-icon><span class=\"l-pagination-sr-only\">Previous page</span>",
94
94
  class: [
95
95
  "l-pagination-item",
96
96
  "l-pagination--btn",
@@ -100,6 +100,7 @@ var u = class extends e {
100
100
  class: ["l-pagination-item", "l-pagination-simple-layout"],
101
101
  innerHTML: [
102
102
  this.#c("l-input", {
103
+ title: "Page number",
103
104
  inputmode: "numeric",
104
105
  value: `${this._state.currentPage}`,
105
106
  class: ["l-pagination-simple-input"],
@@ -110,8 +111,9 @@ var u = class extends e {
110
111
  ]
111
112
  }));
112
113
  else {
113
- e.push(this.#c("a", {
114
- title: "1",
114
+ e.push(this.#c("button", {
115
+ title: "Page 1",
116
+ "aria-current": this._state.currentPage === 1 ? "page" : void 0,
115
117
  innerHTML: "1",
116
118
  class: [
117
119
  "l-pagination-item",
@@ -119,8 +121,8 @@ var u = class extends e {
119
121
  this._state.currentPage === 1 ? "active" : ""
120
122
  ],
121
123
  "data-page": "1"
122
- })), this._state.currentPage > 4 && e.push(this.#c("a", {
123
- title: "上5页",
124
+ })), this._state.currentPage > 4 && e.push(this.#c("button", {
125
+ title: "Previous 5 pages",
124
126
  innerHTML: ["<l-d-arrow-left-icon class='darrow-icon'></l-d-arrow-left-icon>", "<l-more-icon class='more-icon'></l-more-icon>"],
125
127
  class: ["l-pagination-item", "l-pagination--link"],
126
128
  "data-page": `${this._state.currentPage - 5}`
@@ -129,8 +131,9 @@ var u = class extends e {
129
131
  r < 4 && (n = Math.min(this._state.pageCount, n + (4 - r))), r = n - t, r < 4 && (t = Math.max(1, t - (4 - r)));
130
132
  for (let r = t; r <= n; r++) if (!(r <= 1)) {
131
133
  if (r >= this._state.pageCount) break;
132
- e.push(this.#c("a", {
133
- title: `${r}`,
134
+ e.push(this.#c("button", {
135
+ title: `Page ${r}`,
136
+ "aria-current": this._state.currentPage === r ? "page" : void 0,
134
137
  innerHTML: `${r}`,
135
138
  class: [
136
139
  "l-pagination-item",
@@ -140,13 +143,14 @@ var u = class extends e {
140
143
  "data-page": `${r}`
141
144
  }));
142
145
  }
143
- this._state.currentPage < this._state.pageCount - 3 && e.push(this.#c("a", {
144
- title: "下5页",
146
+ this._state.currentPage < this._state.pageCount - 3 && e.push(this.#c("button", {
147
+ title: "Next 5 pages",
145
148
  innerHTML: ["<l-d-arrow-right-icon class='darrow-icon'></l-d-arrow-right-icon>", "<l-more-icon class='more-icon'></l-more-icon>"],
146
149
  class: ["l-pagination-item", "l-pagination--link"],
147
150
  "data-page": `${this._state.currentPage + 5}`
148
- })), this._state.pageCount > 1 && e.push(this.#c("a", {
149
- title: `${this._state.pageCount}`,
151
+ })), this._state.pageCount > 1 && e.push(this.#c("button", {
152
+ title: `Page ${this._state.pageCount}`,
153
+ "aria-current": this._state.currentPage === this._state.pageCount ? "page" : void 0,
150
154
  innerHTML: `${this._state.pageCount}`,
151
155
  class: [
152
156
  "l-pagination-item",
@@ -157,8 +161,8 @@ var u = class extends e {
157
161
  }));
158
162
  }
159
163
  return e.push(this.#c("l-button", {
160
- title: `${this._state.currentPage + 1}`,
161
- innerHTML: "<l-arrow-right-icon></l-arrow-right-icon>",
164
+ title: "Next page",
165
+ innerHTML: "<l-arrow-right-icon></l-arrow-right-icon><span class=\"l-pagination-sr-only\">Next page</span>",
162
166
  class: [
163
167
  "l-pagination-item",
164
168
  "l-pagination--btn",
@@ -170,7 +174,7 @@ var u = class extends e {
170
174
  }
171
175
  #r() {
172
176
  let e = a(".l-pagination-simple-input", this.root);
173
- e && (e.setParser(this.#s), c(e, "keyup", this.#o), c(e, "blur", this.#a));
177
+ e && (e.setParser(this.#s), e.shadowRoot?.querySelector("input")?.setAttribute("aria-label", "Page number"), c(e, "keyup", this.#o), c(e, "blur", this.#a));
174
178
  }
175
179
  #i() {
176
180
  let e = a(".l-pagination-simple-input", this.root);
@@ -178,11 +182,7 @@ var u = class extends e {
178
182
  }
179
183
  #a = (e) => {
180
184
  let t = e.target, n = t.value;
181
- if (!n) {
182
- t.value = `${this._state.currentPage}`;
183
- return;
184
- }
185
- this._state.currentPage = Number(n), this.rerender();
185
+ n ? (this._state.currentPage = Number(n), this.rerender()) : t.value = `${this._state.currentPage}`;
186
186
  };
187
187
  #o = (e) => {
188
188
  if (e.key === "Enter") {
@@ -201,7 +201,9 @@ var u = class extends e {
201
201
  return e;
202
202
  };
203
203
  #c(e = "a", t) {
204
- let n = [], i = "";
204
+ let n = [];
205
+ e === "button" && n.push(r("type", "button")), t.title && t["aria-label"] == null && n.push(r("aria-label", t.title));
206
+ let i = "";
205
207
  for (let e in t) if (e === "innerHTML") i = t[e], Array.isArray(i) && (i = i.join(""));
206
208
  else if (e === "class") {
207
209
  let e = t.class;
@@ -210,5 +212,4 @@ var u = class extends e {
210
212
  return `<${e}${n.join("")}>${i}</${e}>`;
211
213
  }
212
214
  };
213
- //#endregion
214
215
  export { u as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/pagination/index.less?inline
2
- var e = ":host{white-space:nowrap;color:#333;font-size:14px;line-height:1}.l-pagination{align-items:center;justify-content:var(--l-pagination-justify-content,flex-start);display:flex}.l-pagination-item{box-sizing:border-box;width:30px;height:30px}.l-pagination-item+.l-pagination-item{margin-left:5px}.l-pagination--btn{--l-btn-padding:0}.l-pagination--link{color:#666;cursor:pointer;border:1px solid #0000;border-radius:3px;justify-content:center;align-items:center;text-decoration:none;transition:color .3s,border-color .3s;display:inline-flex}.l-pagination--link.active{color:var(--l-primary-color,#722ed1);border-color:var(--l-primary-color,#722ed1)}.darrow-icon{display:none}.more-icon{display:inline-block}.l-pagination--link:hover{color:var(--l-primary-color-light1,#9254de)}.l-pagination--link:hover .darrow-icon{display:inline-block}.l-pagination--link:hover .more-icon{display:none}.l-pagination--link:active{color:var(--l-primary-color-light1,#9254de)}.l-pagination-simple-layout{align-items:center;width:auto;display:inline-flex}.l-pagination-simple-input{--l-form-control-height:30px;box-sizing:border-box;text-align:center;width:60px}.l-pagination-simple-divide{margin:0 5px}";
3
- //#endregion
1
+ // src/components/pagination/index.less?inline
2
+ var e = ":host{white-space:nowrap;color:#333;font-size:14px;line-height:1}.l-pagination{align-items:center;justify-content:var(--l-pagination-justify-content,flex-start);display:flex}.l-pagination-item{box-sizing:border-box;width:30px;height:30px}.l-pagination-item+.l-pagination-item{margin-left:5px}.l-pagination--btn{--l-btn-padding:0}.l-pagination--link{font:inherit;color:#666;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:3px;justify-content:center;align-items:center;padding:0;text-decoration:none;transition:color .3s,border-color .3s;display:inline-flex}.l-pagination--link.active{color:var(--l-primary-color,#722ed1);border-color:var(--l-primary-color,#722ed1)}.darrow-icon{display:none}.more-icon{display:inline-block}.l-pagination--link:hover{color:var(--l-primary-color-light1,#9254de)}.l-pagination--link:hover .darrow-icon{display:inline-block}.l-pagination--link:hover .more-icon{display:none}.l-pagination--link:active{color:var(--l-primary-color-light1,#9254de)}.l-pagination-simple-layout{align-items:center;width:auto;display:inline-flex}.l-pagination-simple-input{--l-form-control-height:30px;box-sizing:border-box;text-align:center;width:60px}.l-pagination-simple-divide{margin:0 5px}.l-pagination-sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}";
4
3
  export { e as default };
@@ -2,7 +2,7 @@ import e from "../base.js";
2
2
  import { initAttr as t } from "../utils/index.js";
3
3
  import n from "./index.less_inline.js";
4
4
  import { formatClass as r, formatStyle as i } from "utilane/browser";
5
- //#region src/components/polygon/index.ts
5
+ // src/components/polygon/index.ts
6
6
  var a = class extends e {
7
7
  static baseName = "polygon";
8
8
  shape = "triangle-top";
@@ -17,5 +17,4 @@ var a = class extends e {
17
17
  return `<div part="default" class="${r(["l-polygon", this.shape ? `l-polygon-${this.shape}` : ""])}" style="${i([this.background ? `--l-polygen-background: ${this.background}` : ""])}"></div>`;
18
18
  }
19
19
  };
20
- //#endregion
21
20
  export { a as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/polygon/index.less?inline
1
+ // src/components/polygon/index.less?inline
2
2
  var e = ".l-polygon{--l-polygen-size:10px;--l-polygen-width:var(--l-polygen-size);--l-polygen-height:var(--l-polygen-size);--l-polygen-background:#666;width:var(--l-polygen-width);height:var(--l-polygen-height);background:var(--l-polygen-background);transition:background .3s ease-in-out;display:inline-block}.l-polygon-triangle-top{clip-path:polygon(calc(var(--l-polygen-width) / 2) 0, var(--l-polygen-width) var(--l-polygen-height), 0 var(--l-polygen-height))}.l-polygon-triangle-top-left{clip-path:polygon(0 0, var(--l-polygen-width) 0, 0 var(--l-polygen-height))}.l-polygon-triangle-top-right{clip-path:polygon(0 0, var(--l-polygen-width) 0, var(--l-polygen-width) var(--l-polygen-height))}.l-polygon-triangle-right{clip-path:polygon(0 0, var(--l-polygen-width) calc(var(--l-polygen-height) / 2), 0 var(--l-polygen-height))}.l-polygon-triangle-left{clip-path:polygon(var(--l-polygen-width) 0, var(--l-polygen-width) var(--l-polygen-height), 0 calc(var(--l-polygen-height) / 2))}.l-polygon-triangle-bottom{clip-path:polygon(0 0, var(--l-polygen-width) 0, calc(var(--l-polygen-width) / 2) var(--l-polygen-height))}.l-polygon-triangle-bottom-left{clip-path:polygon(0 0, 0 var(--l-polygen-height), var(--l-polygen-width) var(--l-polygen-height))}.l-polygon-triangle-bottom-right{clip-path:polygon(var(--l-polygen-width) 0, var(--l-polygen-width) var(--l-polygen-height), 0 var(--l-polygen-height))}";
3
- //#endregion
4
3
  export { e as default };
@@ -2,7 +2,7 @@ import e from "../base.js";
2
2
  import t from "./index.less_inline.js";
3
3
  import { $one as n } from "utilane/browser";
4
4
  import { QRCodeRender as r, renderToCanvas as i } from "qrcode-generator-es";
5
- //#region src/components/qrcode/index.ts
5
+ // src/components/qrcode/index.ts
6
6
  var a = class extends e {
7
7
  static baseName = "qrcode";
8
8
  _qrcode;
@@ -61,5 +61,4 @@ var a = class extends e {
61
61
  return "<canvas class='renderer-el'></canvas>";
62
62
  }
63
63
  };
64
- //#endregion
65
64
  export { a as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/qrcode/index.less?inline
1
+ // src/components/qrcode/index.less?inline
2
2
  var e = ":host,.renderer-el{display:inline-flex}";
3
- //#endregion
4
3
  export { e as default };
@@ -1,6 +1,7 @@
1
1
  import FormInner from "../form/form_inner";
2
2
  export type SelectOption = {
3
3
  class?: string;
4
+ disabled?: boolean;
4
5
  render?: (option: SelectOption, isSelect: boolean, selectedValues?: any | any[]) => HTMLElement | DocumentFragment;
5
6
  label?: string;
6
7
  value?: any;
@@ -28,6 +29,8 @@ type SelectState = {
28
29
  loading?: boolean;
29
30
  /** 是否展开下拉选择 */
30
31
  expanded?: boolean;
32
+ /** 无匹配选项时的提示文案 */
33
+ emptyText: string;
31
34
  };
32
35
  export default class Select extends FormInner<SelectState> {
33
36
  static baseName: string;
@@ -41,6 +44,9 @@ export default class Select extends FormInner<SelectState> {
41
44
  /** 下拉弹窗主体 */
42
45
  private _popover?;
43
46
  private _searchEl?;
47
+ private editingSearch;
48
+ private emptyOptionDefault;
49
+ private reflectingEmptyOptionDefault;
44
50
  constructor();
45
51
  setInputHandler(handler: (match: string) => void): void;
46
52
  setFilter(filter: (match: string, option: SelectOption) => boolean): void;
@@ -48,7 +54,20 @@ export default class Select extends FormInner<SelectState> {
48
54
  set loading(loading: boolean | undefined);
49
55
  setLoading(loading: boolean): void;
50
56
  setExpanded(value: boolean): void;
51
- setValue(value: string | string[] | number): void;
57
+ protected get intrinsicDefaultValue(): string | string[];
58
+ get defaultValue(): any;
59
+ set defaultValue(value: any);
60
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
61
+ protected parseDefaultValue(value: string | null): string | string[];
62
+ protected formatDefaultValue(value: any): string;
63
+ private normalizeValue;
64
+ setValue(value: any): void;
65
+ protected get nativeValueMissing(): boolean;
66
+ private get hasObjectValue();
67
+ protected get nativeSubmissionError(): string | undefined;
68
+ protected get nativeConstraintValues(): readonly unknown[];
69
+ protected get formStateRestorationEnabled(): boolean;
70
+ protected serializeFormValue(): string | FormData | null;
52
71
  private _updateSelectedLabels;
53
72
  static get observedAttributes(): string[];
54
73
  protected attributeChange(name: string, _oldValue: string, newValue: string): void;
@@ -57,7 +76,6 @@ export default class Select extends FormInner<SelectState> {
57
76
  set options(opts: SelectOption[] | undefined);
58
77
  setOptions(options: SelectOption[] | undefined): void;
59
78
  private _isOptionSelect;
60
- private _updateOptionSelect;
61
79
  private _renderOption;
62
80
  private _calculateOffset;
63
81
  isEmpty(): boolean;
@@ -67,6 +85,7 @@ export default class Select extends FormInner<SelectState> {
67
85
  private _togglePopover;
68
86
  private _updatePopoverContent;
69
87
  private _onRootTap;
88
+ private _commitSelection;
70
89
  private _onTap;
71
90
  private _onSearchBlur;
72
91
  private _onSearchInput;
@@ -1,10 +1,13 @@
1
1
  import { kebabToCamel as e, parseAttrValue as t, unitNumberStr as n } from "../utils/index.js";
2
- import r from "../form/form_inner.js";
3
- import i from "./index.less_inline.js";
2
+ import r from "./index.less_inline.js";
3
+ import i from "../form/form_inner.js";
4
4
  import { Popover as a } from "../utils/popover.js";
5
5
  import { $ as o, $$ as s, $one as c, debounce as l, iterate as u, off as d, on as f, shouldEventNext as p } from "utilane/browser";
6
- //#region src/components/select/index.ts
7
- var m = class extends r {
6
+ // src/components/select/index.ts
7
+ function m(e) {
8
+ return typeof e == "object" && !!e;
9
+ }
10
+ var h = class extends i {
8
11
  static baseName = "select";
9
12
  selectedLabels = [];
10
13
  filter;
@@ -13,10 +16,14 @@ var m = class extends r {
13
16
  inputHandler;
14
17
  _popover;
15
18
  _searchEl;
19
+ editingSearch = !1;
20
+ emptyOptionDefault = !1;
21
+ reflectingEmptyOptionDefault = !1;
16
22
  constructor() {
17
- super(!0, !1), this.version = 2, this._state = {
23
+ super(!1), this.version = 2, this._state = {
18
24
  filterable: !1,
19
25
  placeholder: "请选择",
26
+ emptyText: "暂无数据",
20
27
  labelField: "label",
21
28
  valueField: "value",
22
29
  multiple: !1,
@@ -45,19 +52,73 @@ var m = class extends r {
45
52
  setExpanded(e) {
46
53
  this._state.expanded = e, e ? (this.classList.add("l-select--expand"), this._searchEl && this._searchEl.focus()) : this.classList.remove("l-select--expand");
47
54
  }
55
+ get intrinsicDefaultValue() {
56
+ return this._state.multiple ? [] : "";
57
+ }
58
+ get defaultValue() {
59
+ return this._state.multiple && this.emptyOptionDefault ? [""] : super.defaultValue;
60
+ }
61
+ set defaultValue(e) {
62
+ this.reflectingEmptyOptionDefault = Array.isArray(e) && e.length === 1 && e[0] === "";
63
+ try {
64
+ super.defaultValue = e;
65
+ } finally {
66
+ this.reflectingEmptyOptionDefault = !1;
67
+ }
68
+ }
69
+ attributeChangedCallback(e, t, n) {
70
+ if (e === "value") {
71
+ let e = this.emptyOptionDefault;
72
+ this.emptyOptionDefault = n === "" && this.reflectingEmptyOptionDefault, this.reflectingEmptyOptionDefault = !1, t === n && e !== this.emptyOptionDefault && this.applyDefaultValue();
73
+ }
74
+ super.attributeChangedCallback(e, t, n);
75
+ }
76
+ parseDefaultValue(e) {
77
+ return e === null ? this.intrinsicDefaultValue : this.normalizeValue(e);
78
+ }
79
+ formatDefaultValue(e) {
80
+ return Array.isArray(e) ? e.join(",") : String(e ?? "");
81
+ }
82
+ normalizeValue(e) {
83
+ return this._state.multiple ? e == null || e === "" ? [] : Array.isArray(e) ? [...e] : typeof e == "string" ? e.split(",") : [e] : Array.isArray(e) ? e[0] ?? "" : e;
84
+ }
48
85
  setValue(e) {
49
- let t = e;
50
- typeof e == "string" && (t = e.split(",")), this._state.multiple ? Array.isArray(t) || (t = [t]) : Array.isArray(t) && (t = t[0]), super.setValue(t), this._updateSelectedLabels(), this._reRenderLabels();
86
+ super.setValue(this.normalizeValue(e)), this._updateSelectedLabels(), this._reRenderLabels(), this.isEmpty() && this._toggleClearable(!0), this._updatePopoverContent(), this.syncNativeValue();
87
+ }
88
+ get nativeValueMissing() {
89
+ return this.isEmpty();
90
+ }
91
+ get hasObjectValue() {
92
+ let e = this.getValue();
93
+ return this._state.multiple && Array.isArray(e) ? e.some(m) : m(e);
94
+ }
95
+ get nativeSubmissionError() {
96
+ if (this.name && this.hasObjectValue && this.serializeFormValue() === null) return "对象选项无法作为表单值提交,请使用选项标识。";
97
+ }
98
+ get nativeConstraintValues() {
99
+ return this.hasObjectValue ? [] : super.nativeConstraintValues;
100
+ }
101
+ get formStateRestorationEnabled() {
102
+ return !this.hasObjectValue;
103
+ }
104
+ serializeFormValue() {
105
+ if (this.hasObjectValue) return null;
106
+ let e = this.getValue();
107
+ if (!this._state.multiple) return e == null ? null : String(e);
108
+ let t = new FormData();
109
+ if (this.name) for (let n of Array.isArray(e) ? e : e == null || e === "" ? [] : [e]) t.append(this.name, String(n ?? ""));
110
+ return t;
51
111
  }
52
112
  _updateSelectedLabels() {
53
- if (this._options) {
54
- this.selectedLabels = this._options.filter((e) => this._isOptionSelect(e[this._state.valueField])).map((e) => e[this._state.labelField]);
55
- return;
56
- }
57
- this.selectedLabels = [];
113
+ let { labelField: e, valueField: t, multiple: n } = this._state, r = this._backOptions ?? this._options, i = this.value, a = i == null ? [] : n ? i : [i];
114
+ this.selectedLabels = a.flatMap((i) => {
115
+ let a = r?.find((e) => e[t] === i);
116
+ return !a && !n && i === "" ? [] : [String(a?.[e] ?? i ?? "")];
117
+ });
58
118
  }
59
119
  static get observedAttributes() {
60
- return [
120
+ return [.../* @__PURE__ */ new Set([
121
+ ...i.observedAttributes,
61
122
  "disabled",
62
123
  "value",
63
124
  "multiple",
@@ -69,8 +130,9 @@ var m = class extends r {
69
130
  "value-field",
70
131
  "width",
71
132
  "clearable",
72
- "remote"
73
- ];
133
+ "remote",
134
+ "empty-text"
135
+ ])];
74
136
  }
75
137
  attributeChange(r, i, a) {
76
138
  switch (r) {
@@ -79,10 +141,17 @@ var m = class extends r {
79
141
  break;
80
142
  case "label-field":
81
143
  case "value-field":
144
+ this._state[e(r)] = a ?? r.replace("-field", "");
145
+ break;
146
+ case "empty-text":
147
+ this._state.emptyText = a ?? "暂无数据";
148
+ break;
82
149
  case "placeholder":
83
- this._state[r] = a;
150
+ this._state.placeholder = a ?? "请选择";
84
151
  break;
85
152
  case "multiple":
153
+ this._state.multiple = t(a, !1, r), this.dirtyValue ? this.setValue(this.value ?? this.intrinsicDefaultValue) : this.applyDefaultValue();
154
+ break;
86
155
  case "clearable":
87
156
  case "filterable":
88
157
  case "collapse-tags":
@@ -93,7 +162,11 @@ var m = class extends r {
93
162
  }
94
163
  }
95
164
  updateDOM(e) {
96
- e.has("width") && (this._state.width ? this.style.setProperty("--l-select-width", this._state.width) : this.style.removeProperty("--l-select-width")), (e.has("label-field") || e.has("value-field")) && this._updatePopoverContent();
165
+ e.has("width") && (this._state.width ? this.style.setProperty("--l-select-width", this._state.width) : this.style.removeProperty("--l-select-width")), e.has("placeholder") && this._reRenderLabels(), (e.has("label-field") || e.has("value-field")) && (this._updateSelectedLabels(), this._reRenderLabels()), [
166
+ "label-field",
167
+ "value-field",
168
+ "empty-text"
169
+ ].some((t) => e.has(t)) && this._updatePopoverContent();
97
170
  }
98
171
  get options() {
99
172
  return this._options;
@@ -102,16 +175,12 @@ var m = class extends r {
102
175
  this.setOptions(e);
103
176
  }
104
177
  setOptions(e) {
105
- this._options = e, this._backOptions = [...e || []], this._popover && this._state.expanded && this._popover.updatePopoverContent();
178
+ this._options = e, this._backOptions = [...e || []], this._updateSelectedLabels(), this._reRenderLabels(this._state.remote && this.editingSearch), this._updatePopoverContent();
106
179
  }
107
180
  _isOptionSelect(e) {
108
181
  let t = !1;
109
182
  return e != null && this.value != null && (t = this._state.multiple ? this.value.includes(e) : e === this.value), t;
110
183
  }
111
- _updateOptionSelect(e, t) {
112
- let n = c(".l-select-icon", e);
113
- t ? (e.classList.add("l-select-option--selected"), n || (n = s("l-select-icon", { class: "l-select-icon" }), e.appendChild(n))) : (e.classList.remove("l-select-option--selected"), n && n.remove());
114
- }
115
184
  _renderOption() {
116
185
  let e = [];
117
186
  if (this._options) {
@@ -124,8 +193,13 @@ var m = class extends r {
124
193
  })];
125
194
  a && o.push(s("l-select-icon", { class: "l-select-icon" }));
126
195
  let c = s("li", {
127
- class: ["l-select-option", a ? "l-select-option--selected" : void 0],
128
- "data-action": `${n}`
196
+ class: [
197
+ "l-select-option",
198
+ a ? "l-select-option--selected" : void 0,
199
+ t.disabled ? "l-select-option--disabled" : void 0
200
+ ],
201
+ "aria-disabled": t.disabled ? "true" : void 0,
202
+ "data-action": t.disabled ? void 0 : `${n}`
129
203
  }, o);
130
204
  e.push(c.outerHTML);
131
205
  }
@@ -133,7 +207,7 @@ var m = class extends r {
133
207
  if (e.length === 0) {
134
208
  let t = s("li", {
135
209
  class: "l-select-option l-select-option--empty",
136
- textContent: "暂无数据"
210
+ textContent: this._state.emptyText
137
211
  });
138
212
  e.push(t.outerHTML);
139
213
  }
@@ -167,7 +241,7 @@ var m = class extends r {
167
241
  this._toggleClearable(!0);
168
242
  };
169
243
  _togglePopover() {
170
- if (this._popover) {
244
+ if (!this.isDisabled() && this._popover) {
171
245
  if (this._popover.isShow()) {
172
246
  this._popover.hide();
173
247
  return;
@@ -179,18 +253,23 @@ var m = class extends r {
179
253
  this._popover && this._state.expanded && this._popover.updatePopoverContent();
180
254
  }
181
255
  _onRootTap = (e) => {
256
+ if (this.isDisabled()) return;
182
257
  e.stopPropagation();
183
258
  let [t, n, r] = p(e, "data-action", e.currentTarget);
184
259
  if (t) {
185
- if (n === "clear") this.value = this._state.multiple ? [] : "", this.selectedLabels = [], this._toggleClearable(!0), this._reRenderLabels(), this._updatePopoverContent();
260
+ if (n === "clear") this.isEmpty() || this._commitSelection(this._state.multiple ? [] : ""), this._toggleClearable(!0);
186
261
  else {
187
- let e = Number(n);
188
- this.selectedLabels.splice(e, 1), this._value.splice(e, 1), this._updatePopoverContent(), this._reRenderLabels(), this._searchEl && this._searchEl.focus();
262
+ let e = Number(n), t = this.value;
263
+ Array.isArray(t) && Number.isInteger(e) && e >= 0 && e < t.length && (this._commitSelection(t.filter((t, n) => n !== e)), this._searchEl?.focus());
189
264
  }
190
- return;
191
- }
192
- this._togglePopover();
265
+ } else this._togglePopover();
193
266
  };
267
+ _commitSelection(e) {
268
+ this.setValue(e), this.validateInput(), this.emit("change", { detail: {
269
+ value: Array.isArray(this.value) ? [...this.value] : this.value,
270
+ labels: [...this.selectedLabels]
271
+ } });
272
+ }
194
273
  _onTap = () => {
195
274
  this._togglePopover();
196
275
  };
@@ -199,16 +278,13 @@ var m = class extends r {
199
278
  };
200
279
  _onSearchInput = (e) => {
201
280
  if (this.inputHandler && this._state.filterable) {
281
+ this.editingSearch = !0;
202
282
  let t = e.target.value;
203
283
  this.inputHandler(t);
204
284
  }
205
285
  };
206
286
  _handleFilte = (e) => {
207
- if (this._state.remote) {
208
- this.emit("search", { detail: { value: e } });
209
- return;
210
- }
211
- this._options = this._filteOption(e), this._popover && this._state.expanded && this._popover.updatePopoverContent();
287
+ this._state.remote ? this.emit("search", { detail: { value: e } }) : (this._options = this._filteOption(e), this._popover && this._state.expanded && this._popover.updatePopoverContent());
212
288
  };
213
289
  _filteOption(e) {
214
290
  let t = [];
@@ -237,54 +313,40 @@ var m = class extends r {
237
313
  onOutsideTap: (e, t, n) => {
238
314
  !n && !t && this._popover?.hide();
239
315
  },
240
- onPopoverAction: (e, t) => {
241
- if (e && this._options) {
242
- let n = Number(e), r = this._options[n], i = r[this._state.valueField], a = r[this._state.labelField], s = this.value, c = this.selectedLabels;
243
- if (this._state.multiple === !0) {
244
- if (!s) s = [i], c = [a];
245
- else if (Array.isArray(s)) {
246
- let e = s.indexOf(i);
247
- e === -1 ? (s.push(i), c.push(a)) : (s.splice(e, 1), c.splice(e, 1));
248
- } else s != i && (s = [s, i], c = [c, a]);
249
- } else s = i, c = [a];
250
- this._value != s && this.emit("change", { detail: {
251
- value: s,
252
- labels: c
253
- } }), this._value = s, this.selectedLabels = c;
254
- let l = this._isOptionSelect(i);
255
- if (!this._state.multiple) {
256
- let e = o(".l-select-option--selected", t.parentElement);
257
- u(e, (e) => {
258
- this._updateOptionSelect(e, !1);
259
- });
260
- }
261
- this._updateOptionSelect(t, l), this._reRenderLabels(), !this._state.multiple && this._popover && this._popover.hide(), this._searchEl && this._state.multiple && this._searchEl.focus();
262
- }
316
+ onPopoverAction: (e) => {
317
+ if (this.isDisabled() || e === "") return;
318
+ let t = this._options?.[Number(e)];
319
+ if (!t || t.disabled) return;
320
+ let n = t[this._state.valueField];
321
+ if (this._state.multiple) {
322
+ let e = this.value, t = e.includes(n) ? e.filter((e) => e !== n) : [...e, n];
323
+ this._commitSelection(t), this._searchEl?.focus();
324
+ } else this.value !== (n ?? "") && this._commitSelection(n), this._popover?.hide();
263
325
  }
264
326
  });
265
327
  }
266
328
  beforeDestroy() {
267
- if (d(this, "mouseenter", this._onMouseEnter), d(this, "mouseleave", this._onMouseLeave), d(this.root, "click", this._onRootTap), d(this, "click", this._onTap), this._options = void 0, this._popover &&= (this._popover.destroy(), void 0), this._searchEl) {
329
+ if (d(this, "mouseenter", this._onMouseEnter), d(this, "mouseleave", this._onMouseLeave), d(this.root, "click", this._onRootTap), d(this, "click", this._onTap), this._popover &&= (this._popover.destroy(), void 0), this._searchEl) {
268
330
  if (d(this._searchEl, "blur", this._onSearchBlur), d(this._searchEl, "input", this._onSearchInput), this.inputHandler) {
269
331
  try {
270
332
  this.inputHandler.cancel();
271
333
  } catch {}
272
334
  this.inputHandler = void 0;
273
335
  }
274
- this._searchEl = void 0;
336
+ this._searchEl = void 0, this.editingSearch = !1;
275
337
  }
276
338
  this.filter = void 0;
277
339
  }
278
340
  render_v2() {
279
341
  return {
280
342
  template: this.render(),
281
- style: [i]
343
+ style: [r]
282
344
  };
283
345
  }
284
346
  render() {
285
347
  let e = document.createDocumentFragment(), t = s("div", { class: "l-select-main" }), n = this._renderSelectedLabels();
286
348
  if (t.appendChild(n), this._state.filterable) {
287
- let e = this._state.placeholder || "请选择", n = "";
349
+ let e = this._state.placeholder, n = "";
288
350
  this.selectedLabels.length > 0 && (this._state.multiple ? e = "" : (e = this.selectedLabels[0], n = this.selectedLabels[0])), t.appendChild(s("input", {
289
351
  class: "l-select-filter",
290
352
  placeholder: e,
@@ -298,7 +360,7 @@ var m = class extends r {
298
360
  disabledChange() {
299
361
  if (!this.rendered) return;
300
362
  let e = this.isDisabled();
301
- this._popover && this._popover.setOption("disabled", e), e ? this.classList.add("l-select--disabled") : this.classList.remove("l-select--disabled"), this._searchEl && (this._searchEl.disabled = e);
363
+ this._popover && this._popover.setOption("disabled", e), e ? (this._popover?.hide(), this.classList.add("l-select--disabled")) : this.classList.remove("l-select--disabled"), this._searchEl && (this._searchEl.disabled = e);
302
364
  }
303
365
  _renderTag(e, t = 0, n = !0) {
304
366
  let r = s("l-tag", {
@@ -317,22 +379,22 @@ var m = class extends r {
317
379
  }
318
380
  return r;
319
381
  }
320
- _reRenderLabels() {
321
- let e = c(".l-select-main", this.root);
322
- if (e) {
323
- let t = o(".l-selected-item", e);
324
- t.length > 0 && u(t, (e) => {
382
+ _reRenderLabels(e = !1) {
383
+ let t = c(".l-select-main", this.root);
384
+ if (t) {
385
+ let e = o(".l-selected-item", t);
386
+ e.length > 0 && u(e, (e) => {
325
387
  e && e != this._searchEl && e.remove();
326
388
  });
327
389
  let n = this._renderSelectedLabels();
328
- this._searchEl ? e.insertBefore(n, this._searchEl) : e.appendChild(n);
390
+ this._searchEl ? t.insertBefore(n, this._searchEl) : t.appendChild(n);
329
391
  }
330
- this._updateSearchValue();
392
+ this._updateSearchValue(e);
331
393
  }
332
- _updateSearchValue() {
394
+ _updateSearchValue(e = !1) {
333
395
  if (this._searchEl) {
334
- let e = this._state.placeholder || "请选择", t = "";
335
- this.selectedLabels.length > 0 && (this._state.multiple ? e = "" : (e = this.selectedLabels[0], t = this.selectedLabels[0])), this._searchEl.placeholder = e, this._searchEl.value = t;
396
+ let t = this._state.placeholder, n = "";
397
+ this.selectedLabels.length > 0 && (this._state.multiple ? t = "" : (t = this.selectedLabels[0], n = this.selectedLabels[0])), this._searchEl.placeholder = t, e || (this._searchEl.value = n, this.editingSearch = !1);
336
398
  }
337
399
  }
338
400
  _renderSelectedLabels() {
@@ -351,5 +413,4 @@ var m = class extends r {
351
413
  return e;
352
414
  }
353
415
  };
354
- //#endregion
355
- export { m as default };
416
+ export { h as default };
@@ -1,4 +1,3 @@
1
- //#region src/components/select/index.less?inline
1
+ // src/components/select/index.less?inline
2
2
  var e = ":host{--l-select-width:100%;min-height:var(--l-form-control-height,32px);width:var(--l-select-width);border:1px solid var(--l-border-color,#d9d9d9);cursor:pointer;box-sizing:border-box;border-radius:4px;justify-content:space-between;align-items:center;gap:5px;padding:4px 10px;font-size:14px;line-height:1;transition:border-color .3s;display:inline-flex;position:relative}:host(:hover){border-color:silver}:host(.l-select--disabled){background-color:var(--l-disabled-color,#f5f7fa);cursor:not-allowed}:host(.l-select--expand),:host(.l-select--active){border-color:var(--l-primary-color,#722ed1)}:host(.l-select--expand) .l-select-arrow{transform:rotate(180deg)}:host(.l-select--loading) .l-select-arrow{opacity:.2}:host(.l-select--clearable) .l-select-arrow{opacity:0}.l-select-main{box-sizing:border-box;flex-flow:wrap;flex-grow:1;gap:5px;display:flex;overflow:hidden}.l-selected-item{flex-shrink:0}.l-select-placeholder{flex-grow:1}.l-select-placeholder,.l-select-arrow{color:#a8abb2}.l-select-filter{background-color:#0000;border:none;outline:none;flex-grow:1;flex-shrink:0;width:0;min-width:15px;max-width:100%}.l-select-filter::placeholder{color:#a8abb2}.l-select-arrow{flex-shrink:0;transition:transform .3s,opacity .3s;transform:rotate(0)}.l-select-tag-close{box-sizing:border-box;cursor:pointer;border-radius:50%;justify-content:center;align-items:center;width:14px;height:14px;margin-left:3px;font-size:12px;transition:color .3s,background-color .3s;display:inline-flex}.l-select-tag-close:hover{color:#fff;background-color:#999}.l-select-clear,.l-select-loading{position:absolute;top:50%;right:10px;transform:translateY(-50%)}.l-select-loading{color:var(--l-primary-color,#722ed1);z-index:2;animation:1.5s linear infinite l-select-loading}.l-select-clear{color:#afafaf;z-index:1}@keyframes l-select-loading{0%{transform:translateY(-50%)rotate(0)}to{transform:translateY(-50%)rotate(360deg)}}";
3
- //#endregion
4
3
  export { e as default };