dou-ui 0.1.0-alpha.2 → 0.1.0-alpha.3

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 (386) hide show
  1. package/dist/components/button/button.js.map +1 -1
  2. package/dist/components/button/button.vue_vue_type_script_setup_true_lang.js +2 -1
  3. package/dist/components/button/button.vue_vue_type_script_setup_true_lang.js.map +1 -1
  4. package/dist/components/calendar-view/calendar-view.js.map +1 -1
  5. package/dist/components/calendar-view/calendar-view.vue_vue_type_script_setup_true_lang.js +7 -2
  6. package/dist/components/calendar-view/calendar-view.vue_vue_type_script_setup_true_lang.js.map +1 -1
  7. package/dist/components/cascader/cascader.js.map +1 -1
  8. package/dist/components/cascader/cascader.vue_vue_type_script_setup_true_lang.js +3 -3
  9. package/dist/components/cascader/cascader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  10. package/dist/components/chat-artifact/chat-artifact.js.map +1 -1
  11. package/dist/components/chat-artifact/chat-artifact.vue_vue_type_script_setup_true_lang.js +8 -2
  12. package/dist/components/chat-artifact/chat-artifact.vue_vue_type_script_setup_true_lang.js.map +1 -1
  13. package/dist/components/chat-attachments/chat-attachments.js.map +1 -1
  14. package/dist/components/chat-attachments/chat-attachments.vue_vue_type_script_setup_true_lang.js +11 -2
  15. package/dist/components/chat-attachments/chat-attachments.vue_vue_type_script_setup_true_lang.js.map +1 -1
  16. package/dist/components/chat-attachments/chat-attachments2.js.map +1 -1
  17. package/dist/components/chat-confirm/chat-confirm.js.map +1 -1
  18. package/dist/components/chat-confirm/chat-confirm.vue_vue_type_script_setup_true_lang.js +38 -14
  19. package/dist/components/chat-confirm/chat-confirm.vue_vue_type_script_setup_true_lang.js.map +1 -1
  20. package/dist/components/chat-context-meter/chat-context-meter.vue_vue_type_script_setup_true_lang.js +2 -2
  21. package/dist/components/chat-context-meter/chat-context-meter.vue_vue_type_script_setup_true_lang.js.map +1 -1
  22. package/dist/components/chat-context-meter/chat-context-meter2.js.map +1 -1
  23. package/dist/components/chat-message/chat-message.js.map +1 -1
  24. package/dist/components/chat-message/chat-message.vue_vue_type_script_setup_true_lang.js +88 -33
  25. package/dist/components/chat-message/chat-message.vue_vue_type_script_setup_true_lang.js.map +1 -1
  26. package/dist/components/chat-message/chat-message2.js.map +1 -1
  27. package/dist/components/chat-message/style.js +5 -0
  28. package/dist/components/chat-plan/chat-plan.js +9 -4
  29. package/dist/components/chat-plan/chat-plan.js.map +1 -1
  30. package/dist/components/chat-plan/chat-plan.vue_vue_type_script_setup_true_lang.js +64 -32
  31. package/dist/components/chat-plan/chat-plan.vue_vue_type_script_setup_true_lang.js.map +1 -1
  32. package/dist/components/chat-plan/chat-plan2.js +6 -0
  33. package/dist/components/chat-plan/chat-plan2.js.map +1 -0
  34. package/dist/components/chat-plan/index.js +1 -1
  35. package/dist/components/chat-plan/style.js +1 -0
  36. package/dist/components/chat-reasoning/chat-reasoning.js.map +1 -1
  37. package/dist/components/chat-reasoning/chat-reasoning.vue_vue_type_script_setup_true_lang.js +4 -4
  38. package/dist/components/chat-reasoning/chat-reasoning.vue_vue_type_script_setup_true_lang.js.map +1 -1
  39. package/dist/components/chat-sources/chat-citation.js.map +1 -1
  40. package/dist/components/chat-sources/chat-citation.vue_vue_type_script_setup_true_lang.js +52 -14
  41. package/dist/components/chat-sources/chat-citation.vue_vue_type_script_setup_true_lang.js.map +1 -1
  42. package/dist/components/chat-sources/chat-sources.js.map +1 -1
  43. package/dist/components/chat-sources/chat-sources.vue_vue_type_script_setup_true_lang.js +6 -4
  44. package/dist/components/chat-sources/chat-sources.vue_vue_type_script_setup_true_lang.js.map +1 -1
  45. package/dist/components/chat-sources/chat-sources2.js.map +1 -1
  46. package/dist/components/chat-sources/index.js +1 -1
  47. package/dist/components/chat-steps/chat-steps.js +9 -4
  48. package/dist/components/chat-steps/chat-steps.js.map +1 -1
  49. package/dist/components/chat-steps/chat-steps.vue_vue_type_script_setup_true_lang.js +20 -13
  50. package/dist/components/chat-steps/chat-steps.vue_vue_type_script_setup_true_lang.js.map +1 -1
  51. package/dist/components/chat-steps/chat-steps2.js +6 -0
  52. package/dist/components/chat-steps/chat-steps2.js.map +1 -0
  53. package/dist/components/chat-steps/index.js +1 -1
  54. package/dist/components/chat-steps/style.js +1 -0
  55. package/dist/components/chat-tool-call/chat-tool-call.js.map +1 -1
  56. package/dist/components/chat-tool-call/chat-tool-call.vue_vue_type_script_setup_true_lang.js +38 -12
  57. package/dist/components/chat-tool-call/chat-tool-call.vue_vue_type_script_setup_true_lang.js.map +1 -1
  58. package/dist/components/chat-tool-call/chat-tool-call2.js.map +1 -1
  59. package/dist/components/chat-tool-call/style.js +1 -0
  60. package/dist/components/code-block/code-block.js.map +1 -1
  61. package/dist/components/code-block/code-block.vue_vue_type_script_setup_true_lang.js +37 -5
  62. package/dist/components/code-block/code-block.vue_vue_type_script_setup_true_lang.js.map +1 -1
  63. package/dist/components/collapse/collapse-item.js.map +1 -1
  64. package/dist/components/collapse/collapse-item.vue_vue_type_script_setup_true_lang.js +2 -2
  65. package/dist/components/collapse/collapse-item.vue_vue_type_script_setup_true_lang.js.map +1 -1
  66. package/dist/components/collapse/collapse-transition.js +3 -1
  67. package/dist/components/collapse/collapse-transition.js.map +1 -1
  68. package/dist/components/collapse/index.js +1 -2
  69. package/dist/components/collapse/index.js.map +1 -1
  70. package/dist/components/color-mode/color-mode-button.js.map +1 -1
  71. package/dist/components/color-mode/color-mode-button.vue_vue_type_script_setup_true_lang.js +2 -2
  72. package/dist/components/color-mode/color-mode-button.vue_vue_type_script_setup_true_lang.js.map +1 -1
  73. package/dist/components/color-mode/color-mode-select.js.map +1 -1
  74. package/dist/components/color-mode/color-mode-select.vue_vue_type_script_setup_true_lang.js +2 -2
  75. package/dist/components/color-mode/color-mode-select.vue_vue_type_script_setup_true_lang.js.map +1 -1
  76. package/dist/components/color-mode/color-mode-switch.js.map +1 -1
  77. package/dist/components/color-mode/color-mode-switch.vue_vue_type_script_setup_true_lang.js +2 -2
  78. package/dist/components/color-mode/color-mode-switch.vue_vue_type_script_setup_true_lang.js.map +1 -1
  79. package/dist/components/color-panel/color-panel.js.map +1 -1
  80. package/dist/components/color-panel/color-panel.vue_vue_type_script_setup_true_lang.js +5 -5
  81. package/dist/components/color-panel/color-panel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  82. package/dist/components/color-picker/color-picker.js.map +1 -1
  83. package/dist/components/color-picker/color-picker.vue_vue_type_script_setup_true_lang.js +2 -2
  84. package/dist/components/color-picker/color-picker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  85. package/dist/components/comment-thread/comment-thread.js.map +1 -1
  86. package/dist/components/comment-thread/comment-thread.vue_vue_type_script_setup_true_lang.js +15 -15
  87. package/dist/components/comment-thread/comment-thread.vue_vue_type_script_setup_true_lang.js.map +1 -1
  88. package/dist/components/comment-thread/style.js +2 -0
  89. package/dist/components/context-menu/context-menu.js.map +1 -1
  90. package/dist/components/context-menu/context-menu.vue_vue_type_script_setup_true_lang.js +26 -11
  91. package/dist/components/context-menu/context-menu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  92. package/dist/components/context-menu/index.js +2 -0
  93. package/dist/components/context-menu/index.js.map +1 -1
  94. package/dist/components/copy-button/copy-button.vue_vue_type_script_setup_true_lang.js +1 -1
  95. package/dist/components/descriptions/descriptions.js.map +1 -1
  96. package/dist/components/descriptions/descriptions.vue_vue_type_script_setup_true_lang.js +3 -1
  97. package/dist/components/descriptions/descriptions.vue_vue_type_script_setup_true_lang.js.map +1 -1
  98. package/dist/components/descriptions/descriptions2.js.map +1 -1
  99. package/dist/components/dropdown/dropdown-button.js.map +1 -1
  100. package/dist/components/dropdown/dropdown-button.vue_vue_type_script_setup_true_lang.js +5 -5
  101. package/dist/components/dropdown/dropdown-button.vue_vue_type_script_setup_true_lang.js.map +1 -1
  102. package/dist/components/dropdown/dropdown-group.js +6 -0
  103. package/dist/components/dropdown/dropdown-group.js.map +1 -0
  104. package/dist/components/dropdown/dropdown-group.vue_vue_type_script_setup_true_lang.js +42 -0
  105. package/dist/components/dropdown/dropdown-group.vue_vue_type_script_setup_true_lang.js.map +1 -0
  106. package/dist/components/dropdown/dropdown-item.js.map +1 -1
  107. package/dist/components/dropdown/dropdown-item.vue_vue_type_script_setup_true_lang.js +31 -9
  108. package/dist/components/dropdown/dropdown-item.vue_vue_type_script_setup_true_lang.js.map +1 -1
  109. package/dist/components/dropdown/dropdown-items.js.map +1 -1
  110. package/dist/components/dropdown/dropdown-items.vue_vue_type_script_setup_true_lang.js +77 -52
  111. package/dist/components/dropdown/dropdown-items.vue_vue_type_script_setup_true_lang.js.map +1 -1
  112. package/dist/components/dropdown/dropdown-radio-group.js.map +1 -1
  113. package/dist/components/dropdown/dropdown-radio-group.vue_vue_type_script_setup_true_lang.js +23 -5
  114. package/dist/components/dropdown/dropdown-radio-group.vue_vue_type_script_setup_true_lang.js.map +1 -1
  115. package/dist/components/dropdown/dropdown-sub.js.map +1 -1
  116. package/dist/components/dropdown/dropdown-sub.vue_vue_type_script_setup_true_lang.js +5 -4
  117. package/dist/components/dropdown/dropdown-sub.vue_vue_type_script_setup_true_lang.js.map +1 -1
  118. package/dist/components/dropdown/dropdown.js.map +1 -1
  119. package/dist/components/dropdown/dropdown.vue_vue_type_script_setup_true_lang.js +2 -1
  120. package/dist/components/dropdown/dropdown.vue_vue_type_script_setup_true_lang.js.map +1 -1
  121. package/dist/components/dropdown/dropdown2.js.map +1 -1
  122. package/dist/components/dropdown/index.js +4 -5
  123. package/dist/components/dropdown/index.js.map +1 -1
  124. package/dist/components/dropdown/item-components.js +11 -0
  125. package/dist/components/dropdown/item-components.js.map +1 -0
  126. package/dist/components/dropdown/menu-entries.js +14 -0
  127. package/dist/components/dropdown/menu-entries.js.map +1 -0
  128. package/dist/components/dropdown/menu-keys.js +1 -1
  129. package/dist/components/dropdown/menu-keys.js.map +1 -1
  130. package/dist/components/ellipsis/ellipsis.js.map +1 -1
  131. package/dist/components/ellipsis/ellipsis.vue_vue_type_script_setup_true_lang.js +2 -2
  132. package/dist/components/ellipsis/ellipsis.vue_vue_type_script_setup_true_lang.js.map +1 -1
  133. package/dist/components/image-cropper/image-cropper.js.map +1 -1
  134. package/dist/components/image-cropper/image-cropper.vue_vue_type_script_setup_true_lang.js +10 -10
  135. package/dist/components/image-cropper/image-cropper.vue_vue_type_script_setup_true_lang.js.map +1 -1
  136. package/dist/components/infinite-scroll/infinite-scroll.js.map +1 -1
  137. package/dist/components/infinite-scroll/infinite-scroll.vue_vue_type_script_setup_true_lang.js +2 -2
  138. package/dist/components/infinite-scroll/infinite-scroll.vue_vue_type_script_setup_true_lang.js.map +1 -1
  139. package/dist/components/input-date/segment-field.js.map +1 -1
  140. package/dist/components/input-date/segment-field.vue_vue_type_script_setup_true_lang.js +2 -2
  141. package/dist/components/input-date/segment-field.vue_vue_type_script_setup_true_lang.js.map +1 -1
  142. package/dist/components/input-date/style.js +1 -0
  143. package/dist/components/input-time/style.js +1 -0
  144. package/dist/components/layout/layout-aside-trigger.js.map +1 -1
  145. package/dist/components/layout/layout-aside-trigger.vue_vue_type_script_setup_true_lang.js +2 -2
  146. package/dist/components/layout/layout-aside-trigger.vue_vue_type_script_setup_true_lang.js.map +1 -1
  147. package/dist/components/layout/layout-aside.js.map +1 -1
  148. package/dist/components/layout/layout-aside.vue_vue_type_script_setup_true_lang.js +3 -3
  149. package/dist/components/layout/layout-aside.vue_vue_type_script_setup_true_lang.js.map +1 -1
  150. package/dist/components/layout/layout-footer.js.map +1 -1
  151. package/dist/components/layout/layout-footer.vue_vue_type_script_setup_true_lang.js +5 -1
  152. package/dist/components/layout/layout-footer.vue_vue_type_script_setup_true_lang.js.map +1 -1
  153. package/dist/components/layout/layout.js.map +1 -1
  154. package/dist/components/markdown/index.js +9 -0
  155. package/dist/components/markdown/index.js.map +1 -0
  156. package/dist/components/markdown/markdown.js +6 -0
  157. package/dist/components/markdown/markdown.js.map +1 -0
  158. package/dist/components/markdown/markdown.vue_vue_type_script_setup_true_lang.js +225 -0
  159. package/dist/components/markdown/markdown.vue_vue_type_script_setup_true_lang.js.map +1 -0
  160. package/dist/components/markdown/parse-block.js +577 -0
  161. package/dist/components/markdown/parse-block.js.map +1 -0
  162. package/dist/components/markdown/parse-inline.js +626 -0
  163. package/dist/components/markdown/parse-inline.js.map +1 -0
  164. package/dist/components/markdown/parser.js +308 -0
  165. package/dist/components/markdown/parser.js.map +1 -0
  166. package/dist/components/markdown/render.js +424 -0
  167. package/dist/components/markdown/render.js.map +1 -0
  168. package/dist/components/markdown/style.d.ts +1 -0
  169. package/dist/components/markdown/style.js +10 -0
  170. package/dist/components/markdown/url.js +16 -0
  171. package/dist/components/markdown/url.js.map +1 -0
  172. package/dist/components/menu/menu-item.js.map +1 -1
  173. package/dist/components/menu/menu-item.vue_vue_type_script_setup_true_lang.js +3 -2
  174. package/dist/components/menu/menu-item.vue_vue_type_script_setup_true_lang.js.map +1 -1
  175. package/dist/components/menu/menu-list.js.map +1 -1
  176. package/dist/components/menu/menu-list.vue_vue_type_script_setup_true_lang.js +2 -2
  177. package/dist/components/menu/menu-list.vue_vue_type_script_setup_true_lang.js.map +1 -1
  178. package/dist/components/menu/menu-popup.js.map +1 -1
  179. package/dist/components/menu/menu-popup.vue_vue_type_script_setup_true_lang.js +33 -21
  180. package/dist/components/menu/menu-popup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  181. package/dist/components/menu/menu.js +16 -13
  182. package/dist/components/menu/menu.js.map +1 -1
  183. package/dist/components/menu/menu.vue_vue_type_script_setup_true_lang.js +4 -1
  184. package/dist/components/menu/menu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  185. package/dist/components/menu/menu2.js.map +1 -1
  186. package/dist/components/menubar/menubar.js.map +1 -1
  187. package/dist/components/node-graph/layout.js +136 -31
  188. package/dist/components/node-graph/layout.js.map +1 -1
  189. package/dist/components/node-graph/node-graph-legend.js.map +1 -1
  190. package/dist/components/node-graph/node-graph-legend.vue_vue_type_script_setup_true_lang.js +5 -5
  191. package/dist/components/node-graph/node-graph-legend.vue_vue_type_script_setup_true_lang.js.map +1 -1
  192. package/dist/components/node-graph/node-graph.js.map +1 -1
  193. package/dist/components/node-graph/node-graph.vue_vue_type_script_setup_true_lang.js +3 -3
  194. package/dist/components/node-graph/node-graph.vue_vue_type_script_setup_true_lang.js.map +1 -1
  195. package/dist/components/pagination/pagination-gap.js.map +1 -1
  196. package/dist/components/pagination/pagination-gap.vue_vue_type_script_setup_true_lang.js +2 -2
  197. package/dist/components/pagination/pagination-gap.vue_vue_type_script_setup_true_lang.js.map +1 -1
  198. package/dist/components/pagination/pagination.js.map +1 -1
  199. package/dist/components/pagination/pagination.vue_vue_type_script_setup_true_lang.js +7 -7
  200. package/dist/components/pagination/pagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  201. package/dist/components/popconfirm/index.js +2 -0
  202. package/dist/components/popconfirm/index.js.map +1 -1
  203. package/dist/components/popconfirm/popconfirm.js.map +1 -1
  204. package/dist/components/popconfirm/popconfirm.vue_vue_type_script_setup_true_lang.js +6 -2
  205. package/dist/components/popconfirm/popconfirm.vue_vue_type_script_setup_true_lang.js.map +1 -1
  206. package/dist/components/popover/index.js +2 -0
  207. package/dist/components/popover/index.js.map +1 -1
  208. package/dist/components/popover/popover.js.map +1 -1
  209. package/dist/components/popover/popover.vue_vue_type_script_setup_true_lang.js +12 -5
  210. package/dist/components/popover/popover.vue_vue_type_script_setup_true_lang.js.map +1 -1
  211. package/dist/components/progress-group/progress-group.js.map +1 -1
  212. package/dist/components/progress-group/progress-group.vue_vue_type_script_setup_true_lang.js +11 -4
  213. package/dist/components/progress-group/progress-group.vue_vue_type_script_setup_true_lang.js.map +1 -1
  214. package/dist/components/qrcode/qrcode.js.map +1 -1
  215. package/dist/components/qrcode/qrcode.vue_vue_type_script_setup_true_lang.js +10 -2
  216. package/dist/components/qrcode/qrcode.vue_vue_type_script_setup_true_lang.js.map +1 -1
  217. package/dist/components/select/select.js.map +1 -1
  218. package/dist/components/select/select.vue_vue_type_script_setup_true_lang.js +2 -2
  219. package/dist/components/select/select.vue_vue_type_script_setup_true_lang.js.map +1 -1
  220. package/dist/components/slider/slider.js.map +1 -1
  221. package/dist/components/slider/slider.vue_vue_type_script_setup_true_lang.js +2 -2
  222. package/dist/components/slider/slider.vue_vue_type_script_setup_true_lang.js.map +1 -1
  223. package/dist/components/status-dot/index.js +7 -0
  224. package/dist/components/status-dot/index.js.map +1 -0
  225. package/dist/components/status-dot/status-dot.js +26 -0
  226. package/dist/components/status-dot/status-dot.js.map +1 -0
  227. package/dist/components/status-dot/status-dot.vue_vue_type_script_lang.js +43 -0
  228. package/dist/components/status-dot/status-dot.vue_vue_type_script_lang.js.map +1 -0
  229. package/dist/components/status-dot/status-dot2.js +6 -0
  230. package/dist/components/status-dot/status-dot2.js.map +1 -0
  231. package/dist/components/status-dot/style.d.ts +1 -0
  232. package/dist/components/status-dot/style.js +2 -0
  233. package/dist/components/steps/steps.js.map +1 -1
  234. package/dist/components/steps/steps.vue_vue_type_script_setup_true_lang.js +6 -6
  235. package/dist/components/steps/steps.vue_vue_type_script_setup_true_lang.js.map +1 -1
  236. package/dist/components/table/table.js.map +1 -1
  237. package/dist/components/table/table.vue_vue_type_script_setup_true_lang.js +19 -14
  238. package/dist/components/table/table.vue_vue_type_script_setup_true_lang.js.map +1 -1
  239. package/dist/components/tabs/tab-panel.vue_vue_type_script_setup_true_lang.js +1 -0
  240. package/dist/components/tabs/tab-panel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  241. package/dist/components/tabs/tabs.js.map +1 -1
  242. package/dist/components/tabs/tabs.vue_vue_type_script_setup_true_lang.js +117 -47
  243. package/dist/components/tabs/tabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
  244. package/dist/components/tabs/tabs2.js.map +1 -1
  245. package/dist/components/tag/tag.js.map +1 -1
  246. package/dist/components/tag/tag.vue_vue_type_script_setup_true_lang.js +21 -4
  247. package/dist/components/tag/tag.vue_vue_type_script_setup_true_lang.js.map +1 -1
  248. package/dist/components/timeline/style.js +1 -0
  249. package/dist/components/timeline/timeline-item.js.map +1 -1
  250. package/dist/components/timeline/timeline-item.vue_vue_type_script_setup_true_lang.js +6 -2
  251. package/dist/components/timeline/timeline-item.vue_vue_type_script_setup_true_lang.js.map +1 -1
  252. package/dist/components/tooltip/index.js +2 -0
  253. package/dist/components/tooltip/index.js.map +1 -1
  254. package/dist/components/tooltip/tooltip.js.map +1 -1
  255. package/dist/components/tooltip/tooltip.vue_vue_type_script_setup_true_lang.js +55 -8
  256. package/dist/components/tooltip/tooltip.vue_vue_type_script_setup_true_lang.js.map +1 -1
  257. package/dist/components/tour/tour.js.map +1 -1
  258. package/dist/components/tour/tour.vue_vue_type_script_setup_true_lang.js +3 -3
  259. package/dist/components/tour/tour.vue_vue_type_script_setup_true_lang.js.map +1 -1
  260. package/dist/components/transfer/transfer-list.vue_vue_type_script_setup_true_lang.js +1 -1
  261. package/dist/components/tree/tree.vue_vue_type_script_setup_true_lang.js +1 -1
  262. package/dist/components/tree-select/tree-select.js.map +1 -1
  263. package/dist/components/tree-select/tree-select.vue_vue_type_script_setup_true_lang.js +3 -3
  264. package/dist/components/tree-select/tree-select.vue_vue_type_script_setup_true_lang.js.map +1 -1
  265. package/dist/components/upload/upload.vue_vue_type_script_setup_true_lang.js +2 -2
  266. package/dist/components/upload/upload.vue_vue_type_script_setup_true_lang.js.map +1 -1
  267. package/dist/components/upload/upload2.js.map +1 -1
  268. package/dist/components/user/user.js.map +1 -1
  269. package/dist/components/user/user.vue_vue_type_script_setup_true_lang.js +2 -2
  270. package/dist/components/user/user.vue_vue_type_script_setup_true_lang.js.map +1 -1
  271. package/dist/composables/use-popup.js +30 -5
  272. package/dist/composables/use-popup.js.map +1 -1
  273. package/dist/index.js +23 -17
  274. package/dist/index.js.map +1 -1
  275. package/dist/locale/en.js +13 -8
  276. package/dist/locale/en.js.map +1 -1
  277. package/dist/locale/zh-cn.js +13 -8
  278. package/dist/locale/zh-cn.js.map +1 -1
  279. package/dist/locale/zh-tw.js +13 -8
  280. package/dist/locale/zh-tw.js.map +1 -1
  281. package/dist/plugin.js +21 -14
  282. package/dist/plugin.js.map +1 -1
  283. package/dist/style.css +1 -1
  284. package/dist/types/components/button/button.d.ts +5 -1
  285. package/dist/types/components/calendar-view/calendar-view.d.ts +6 -0
  286. package/dist/types/components/calendar-view/calendar-view.vue.d.ts +1 -0
  287. package/dist/types/components/calendar-view/index.d.ts +3 -0
  288. package/dist/types/components/chat-artifact/chat-artifact.d.ts +2 -1
  289. package/dist/types/components/chat-attachments/chat-attachments.d.ts +2 -2
  290. package/dist/types/components/chat-confirm/chat-confirm.d.ts +7 -2
  291. package/dist/types/components/chat-list/index.d.ts +3 -3
  292. package/dist/types/components/chat-message/chat-message.d.ts +26 -3
  293. package/dist/types/components/chat-message/chat-message.vue.d.ts +4 -3
  294. package/dist/types/components/chat-message/index.d.ts +7 -4
  295. package/dist/types/components/chat-plan/chat-plan.d.ts +19 -2
  296. package/dist/types/components/chat-plan/chat-plan.vue.d.ts +2 -0
  297. package/dist/types/components/chat-plan/index.d.ts +6 -0
  298. package/dist/types/components/chat-sources/chat-sources.d.ts +6 -1
  299. package/dist/types/components/chat-steps/chat-steps.d.ts +10 -4
  300. package/dist/types/components/chat-steps/chat-steps.vue.d.ts +1 -1
  301. package/dist/types/components/chat-steps/index.d.ts +3 -3
  302. package/dist/types/components/chat-tool-call/chat-tool-call.d.ts +12 -3
  303. package/dist/types/components/chat-tool-call/chat-tool-call.vue.d.ts +1 -0
  304. package/dist/types/components/chat-tool-call/index.d.ts +3 -0
  305. package/dist/types/components/checkbox/index.d.ts +5 -5
  306. package/dist/types/components/code-block/code-block.d.ts +11 -0
  307. package/dist/types/components/code-block/code-block.vue.d.ts +3 -1
  308. package/dist/types/components/code-block/index.d.ts +9 -3
  309. package/dist/types/components/collapse/collapse-transition.d.ts +2 -7
  310. package/dist/types/components/collapse/collapse.vue.d.ts +1 -1
  311. package/dist/types/components/collapse/index.d.ts +5 -6
  312. package/dist/types/components/context-menu/context-menu.d.ts +37 -4
  313. package/dist/types/components/context-menu/context-menu.vue.d.ts +2 -0
  314. package/dist/types/components/context-menu/index.d.ts +5 -0
  315. package/dist/types/components/copy-button/copy-button.vue.d.ts +1 -1
  316. package/dist/types/components/copy-button/index.d.ts +1 -1
  317. package/dist/types/components/descriptions/descriptions.d.ts +9 -1
  318. package/dist/types/components/descriptions/descriptions.vue.d.ts +1 -0
  319. package/dist/types/components/descriptions/index.d.ts +3 -0
  320. package/dist/types/components/dropdown/dropdown-group.vue.d.ts +13 -0
  321. package/dist/types/components/dropdown/dropdown-items.vue.d.ts +2 -2
  322. package/dist/types/components/dropdown/dropdown-radio-group.vue.d.ts +8 -4
  323. package/dist/types/components/dropdown/dropdown.d.ts +28 -6
  324. package/dist/types/components/dropdown/dropdown.vue.d.ts +1 -1
  325. package/dist/types/components/dropdown/index.d.ts +10 -81
  326. package/dist/types/components/dropdown/item-components.d.ts +103 -0
  327. package/dist/types/components/dropdown/menu-entries.d.ts +4 -0
  328. package/dist/types/components/index.d.ts +2 -0
  329. package/dist/types/components/layout/index.d.ts +12 -6
  330. package/dist/types/components/layout/layout-aside.vue.d.ts +1 -1
  331. package/dist/types/components/layout/layout-footer.vue.d.ts +4 -2
  332. package/dist/types/components/layout/layout.d.ts +4 -0
  333. package/dist/types/components/markdown/index.d.ts +58 -0
  334. package/dist/types/components/markdown/markdown.d.ts +251 -0
  335. package/dist/types/components/markdown/markdown.vue.d.ts +22 -0
  336. package/dist/types/components/markdown/parse-block.d.ts +61 -0
  337. package/dist/types/components/markdown/parse-inline.d.ts +19 -0
  338. package/dist/types/components/markdown/parser.d.ts +22 -0
  339. package/dist/types/components/markdown/render.d.ts +84 -0
  340. package/dist/types/components/markdown/url.d.ts +10 -0
  341. package/dist/types/components/masonry/index.d.ts +3 -3
  342. package/dist/types/components/menu/index.d.ts +8 -3
  343. package/dist/types/components/menu/menu.d.ts +16 -5
  344. package/dist/types/components/menu/menu.vue.d.ts +3 -1
  345. package/dist/types/components/menubar/menubar.d.ts +1 -1
  346. package/dist/types/components/node-graph/layout.d.ts +16 -0
  347. package/dist/types/components/node-graph/node-graph.d.ts +1 -1
  348. package/dist/types/components/popover/index.d.ts +3 -3
  349. package/dist/types/components/popover/popover.vue.d.ts +1 -1
  350. package/dist/types/components/progress-group/index.d.ts +3 -0
  351. package/dist/types/components/progress-group/progress-group.d.ts +7 -0
  352. package/dist/types/components/progress-group/progress-group.vue.d.ts +1 -0
  353. package/dist/types/components/qrcode/index.d.ts +3 -0
  354. package/dist/types/components/qrcode/qrcode.d.ts +5 -0
  355. package/dist/types/components/qrcode/qrcode.vue.d.ts +1 -0
  356. package/dist/types/components/sortable/index.d.ts +3 -3
  357. package/dist/types/components/status-dot/index.d.ts +51 -0
  358. package/dist/types/components/status-dot/status-dot.d.ts +46 -0
  359. package/dist/types/components/status-dot/status-dot.vue.d.ts +46 -0
  360. package/dist/types/components/steps/steps.d.ts +1 -1
  361. package/dist/types/components/switch/index.d.ts +3 -3
  362. package/dist/types/components/table/index.d.ts +4 -3
  363. package/dist/types/components/table/table.d.ts +6 -1
  364. package/dist/types/components/tabs/index.d.ts +3 -0
  365. package/dist/types/components/tabs/tabs.d.ts +16 -3
  366. package/dist/types/components/tabs/tabs.vue.d.ts +1 -0
  367. package/dist/types/components/timeline/index.d.ts +3 -3
  368. package/dist/types/components/timeline/timeline-item.vue.d.ts +1 -1
  369. package/dist/types/components/virtual-list/index.d.ts +3 -3
  370. package/dist/types/composables/use-popup.d.ts +15 -5
  371. package/dist/types/locale/types.d.ts +18 -7
  372. package/dist/types/utils/only-child.d.ts +3 -1
  373. package/dist/types/utils/pointer.d.ts +5 -0
  374. package/dist/types/utils/safe-url.d.ts +14 -0
  375. package/dist/types/utils/status-check.d.ts +8 -0
  376. package/dist/utils/install.js +5 -0
  377. package/dist/utils/install.js.map +1 -1
  378. package/dist/utils/only-child.js +56 -5
  379. package/dist/utils/only-child.js.map +1 -1
  380. package/dist/utils/pointer.js +6 -1
  381. package/dist/utils/pointer.js.map +1 -1
  382. package/dist/utils/safe-url.js +57 -0
  383. package/dist/utils/safe-url.js.map +1 -0
  384. package/dist/utils/status-check.js +27 -0
  385. package/dist/utils/status-check.js.map +1 -0
  386. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","names":["_sfc_main"],"sources":["../../../src/components/select/select.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CheckIcon, ChevronDownIcon, CloseIcon } from '@dou-ui/icons'\nimport { computed, nextTick, onBeforeUnmount, ref, useId, useTemplateRef, watch } from 'vue'\nimport type { HTMLAttributes } from 'vue'\nimport { usePopup } from '../../composables/use-popup'\nimport { isComposing } from '../../utils/keyboard'\nimport { useNamespace } from '../../utils/namespace'\nimport { shouldVirtualize } from '../../utils/virtual'\nimport { OnlyChild } from '../../utils/only-child'\nimport { useLocale } from '../config-provider/use-config'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport DouSpinner from '../spinner/spinner.vue'\nimport { DouTag } from '../tag'\nimport type {\n SelectExpose,\n SelectOption,\n SelectOptionGroup,\n SelectProps,\n SelectSlots,\n SelectValue,\n} from './select'\nimport { useTeleport } from '../../utils/teleport'\n\ndefineOptions({ name: 'DouSelect', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n multiple: false,\n filterable: false,\n disabled: false,\n invalid: false,\n clearable: false,\n placement: 'bottom-start',\n teleport: undefined,\n remote: false,\n searchDelay: 300,\n loading: false,\n creatable: false,\n virtual: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\n// An explicit default stops Vue from reading a missing value as `false`.\nconst model = defineModel<SelectValue | SelectValue[] | null | undefined>({ default: undefined })\nconst emit = defineEmits<{\n change: [value: SelectValue | SelectValue[] | null]\n clear: []\n search: [query: string]\n create: [value: string]\n visibleChange: [open: boolean]\n removeTag: [value: SelectValue]\n}>()\nconst slots = defineSlots<SelectSlots>()\n\nconst ns = useNamespace('select')\nconst { t } = useLocale()\nconst { formItem } = useFormItem()\n// Searching remotely or creating options needs the search box.\nconst filterable = computed(() => props.filterable || props.remote || props.creatable)\n// A plain combobox is not labelable, so the item names it by id instead.\nif (!filterable.value) formItem?.markGroup()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\n// Read-only keeps the field focusable but never opens or changes it.\nconst locked = computed(() => disabled.value || readonly.value)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\n\nconst id = `dou-select-${useId()}`\nconst listboxId = `${id}-listbox`\nconst optionId = (index: number) => `${id}-option-${index}`\n\nconst toOption = (option: SelectOption | string | number): SelectOption =>\n typeof option === 'object' ? option : { value: option, label: String(option) }\nconst isGroup = (\n entry: SelectOption | SelectOptionGroup | string | number,\n): entry is SelectOptionGroup =>\n typeof entry === 'object' && Array.isArray((entry as SelectOptionGroup).options)\n\ninterface Section {\n key: string\n label?: string\n options: SelectOption[]\n}\n\n/** Options created from the search text, kept so they stay listed. */\nconst created = ref<SelectOption[]>([])\n\nconst sections = computed<Section[]>(() => {\n const result: Section[] = []\n let loose: Section | undefined\n for (const [index, entry] of props.options.entries()) {\n if (isGroup(entry)) {\n loose = undefined\n result.push({\n key: `group-${index}`,\n label: entry.label,\n options: entry.options.map((option) => {\n const normalized = toOption(option)\n return entry.disabled ? { ...normalized, disabled: true } : normalized\n }),\n })\n } else {\n if (!loose) result.push((loose = { key: `loose-${index}`, options: [] }))\n loose.options.push(toOption(entry))\n }\n }\n const known = new Set(result.flatMap((section) => section.options.map((o) => o.value)))\n const extra = created.value.filter((option) => !known.has(option.value))\n if (extra.length) result.push({ key: 'created', options: extra })\n return result\n})\nconst options = computed(() => sections.value.flatMap((section) => section.options))\nconst labelOf = (option: SelectOption) =>\n option.label ??\n (typeof option.value === 'object' ? String(identity(option.value)) : String(option.value))\n\n/** What tells values apart: the `valueKey` of an object, otherwise the value itself. */\nfunction identity(value: SelectValue): unknown {\n return props.valueKey && value !== null && typeof value === 'object'\n ? (value as Record<string, unknown>)[props.valueKey]\n : value\n}\nconst same = (a: SelectValue | null | undefined, b: SelectValue | null | undefined) =>\n a === b || (a != null && b != null && identity(a) === identity(b))\n\n// Remember every option seen, so a value chosen from earlier remote\n// results keeps its label after the options change.\nconst seen = new Map<unknown, SelectOption>()\nwatch(\n options,\n (list) => {\n for (const option of list) seen.set(identity(option.value), option)\n },\n { immediate: true },\n)\n\nconst selected = computed<SelectValue[]>(() => {\n const value = model.value\n if (props.multiple) return Array.isArray(value) ? value : []\n return value === null || value === undefined || Array.isArray(value) ? [] : [value]\n})\n// Looked up by identity, so long lists with many picks stay linear.\nconst selectedSet = computed(() => new Set(selected.value.map(identity)))\nconst isSelected = (option: SelectOption) => selectedSet.value.has(identity(option.value))\nconst optionById = computed(() => {\n const map = new Map<unknown, SelectOption>()\n for (const option of options.value) {\n const key = identity(option.value)\n if (!map.has(key)) map.set(key, option)\n }\n return map\n})\nconst selectedOptions = computed(() =>\n selected.value.map(\n (value) => optionById.value.get(identity(value)) ?? seen.get(identity(value)) ?? { value },\n ),\n)\nconst atLimit = computed(\n () => props.multiple && !!props.multipleLimit && selected.value.length >= props.multipleLimit,\n)\n/** Disabled, or out of reach because the limit is met. */\nconst unavailable = (option: SelectOption) =>\n !!option.disabled || (atLimit.value && !isSelected(option))\n\n// tags shown in the field, and how many more fold into \"+N\"\nconst shownTags = computed(() =>\n props.maxTagCount === undefined\n ? selectedOptions.value\n : selectedOptions.value.slice(0, Math.max(0, props.maxTagCount)),\n)\nconst hiddenTags = computed(() => selectedOptions.value.slice(shownTags.value.length))\nconst hasValue = computed(() => selected.value.length > 0)\n\nconst query = ref('')\nconst matches = (option: SelectOption, text: string) => labelOf(option).toLowerCase().includes(text)\nconst filteredSections = computed<Section[]>(() => {\n const text = query.value.trim().toLowerCase()\n if (!filterable.value || props.remote || !text) return sections.value\n return sections.value\n .map((section) => ({ ...section, options: section.options.filter((o) => matches(o, text)) }))\n .filter((section) => section.options.length > 0)\n})\n\n/** The pseudo-option that creates the typed text, when nothing matches it exactly. */\nconst createOption = computed<SelectOption | undefined>(() => {\n const text = query.value.trim()\n if (!props.creatable || !text) return undefined\n if (options.value.some((option) => labelOf(option) === text || same(option.value, text))) {\n return undefined\n }\n return { value: text, label: t('select.create', { query: text }) }\n})\n\n/** Every option the keyboard can reach, in list order. */\nconst filtered = computed<SelectOption[]>(() => [\n ...(createOption.value ? [createOption.value] : []),\n ...filteredSections.value.flatMap((section) => section.options),\n])\nconst indexes = computed(() => new Map(filtered.value.map((option, index) => [option, index])))\nconst indexOf = (option: SelectOption) => indexes.value.get(option) ?? -1\n\n// virtual list: every row (group label or option) is one option tall\nconst ROW = 32\ntype Row =\n | { kind: 'group'; key: string; label: string; id: string }\n | { kind: 'option'; key: string; option: SelectOption; index: number }\nconst rows = computed<Row[]>(() => {\n const result: Row[] = []\n if (createOption.value) {\n result.push({ kind: 'option', key: 'create', option: createOption.value, index: 0 })\n }\n for (const section of filteredSections.value) {\n if (section.label) {\n result.push({\n kind: 'group',\n key: section.key,\n label: section.label,\n id: `${id}-${section.key}`,\n })\n }\n for (const option of section.options) {\n result.push({\n kind: 'option',\n key: String(identity(option.value)),\n option,\n index: indexOf(option),\n })\n }\n }\n return result\n})\nconst menuScroll = ref(0)\nconst isVirtual = computed(() => shouldVirtualize(props.virtual, rows.value.length))\nconst virtualRange = computed(() => {\n const from = Math.max(0, Math.floor(menuScroll.value / ROW) - 4)\n return { from, to: Math.min(rows.value.length, from + Math.ceil(280 / ROW) + 8) }\n})\nconst virtualRows = computed(() => rows.value.slice(virtualRange.value.from, virtualRange.value.to))\n\nconst open = ref(false)\nconst popup = usePopup({\n open,\n trigger: 'manual',\n closeOnOutside: true,\n disabled: locked,\n placement: () => props.placement,\n offset: 4,\n sameWidth: true,\n})\nconst { triggerRef, panelRef, rendered, theme, placement, panelStyle } = popup\n\n// The highlighted option. Focus stays in the field; the list follows\n// through `aria-activedescendant`.\nconst active = ref(-1)\nconst enabled = (index: number) => !!filtered.value[index] && !unavailable(filtered.value[index]!)\n\nfunction move(from: number, step: 1 | -1) {\n const count = filtered.value.length\n for (let offset = 1; offset <= count; offset++) {\n const index = (((from + step * offset) % count) + count) % count\n if (enabled(index)) {\n active.value = index\n return\n }\n }\n}\nfunction edge(which: 'first' | 'last') {\n move(which === 'first' ? -1 : filtered.value.length, which === 'first' ? 1 : -1)\n}\n\nfunction show() {\n if (locked.value || open.value) return\n open.value = true\n const index = filtered.value.findIndex(isSelected)\n if (index >= 0 && enabled(index)) active.value = index\n else edge('first')\n}\nfunction hide() {\n open.value = false\n query.value = ''\n}\n\n// remote search: report the text once typing pauses, and on opening\nlet searchTimer: ReturnType<typeof setTimeout> | undefined\nwatch(query, (text) => {\n if (!props.remote || !open.value) return\n clearTimeout(searchTimer)\n searchTimer = setTimeout(() => emit('search', text), props.searchDelay)\n})\nonBeforeUnmount(() => clearTimeout(searchTimer))\n\n// Switching between full and virtual rendering keeps the scroll position.\nwatch(isVirtual, () => {\n void nextTick(() => (menuScroll.value = panelRef.value?.scrollTop ?? 0))\n})\n\nwatch(open, (value) => {\n emit('visibleChange', value)\n if (!value) query.value = ''\n else if (props.remote) emit('search', query.value)\n})\n// A parent that re-renders passes a new but equal list: only a different\n// list of options moves the highlight back to the top.\nwatch(\n () => filtered.value.map((option) => identity(option.value)),\n (next, prev) => {\n if (next.length === prev.length && next.every((value, index) => value === prev[index])) return\n if (open.value) edge('first')\n },\n)\nwatch(active, async (index) => {\n await nextTick()\n const menu = panelRef.value\n if (!menu) return\n if (isVirtual.value) {\n // The option may not be rendered yet: scroll by its row instead.\n const row = rows.value.findIndex((item) => item.kind === 'option' && item.index === index)\n if (row < 0) return\n const inset = 4\n const top = row * ROW + inset\n const current = menuScroll.value\n let target = current\n if (top < current) target = top - inset\n else if (top + ROW > current + menu.clientHeight) target = top + ROW - menu.clientHeight + inset\n // Render the rows around the target now, before the scroll event arrives.\n menuScroll.value = Math.max(0, target)\n menu.scrollTop = menuScroll.value\n return\n }\n menu.querySelector(`#${CSS.escape(optionId(index))}`)?.scrollIntoView?.({ block: 'nearest' })\n})\n\nfunction commit(value: SelectValue | SelectValue[] | null) {\n model.value = value\n emit('change', value)\n formItem?.trigger('change')\n}\n\nfunction choose(option: SelectOption | undefined) {\n if (!option || unavailable(option)) return\n if (option === createOption.value) {\n const value = String(option.value)\n option = { value, label: value }\n created.value = [...created.value, option]\n seen.set(value, option)\n emit('create', value)\n }\n if (props.multiple) {\n const chosen = option\n const values = isSelected(chosen)\n ? selected.value.filter((value) => !same(value, chosen.value))\n : [...selected.value, chosen.value]\n commit(values)\n query.value = ''\n } else {\n if (!same(option.value, model.value as SelectValue | null | undefined)) commit(option.value)\n hide()\n }\n}\n\nfunction remove(value: SelectValue) {\n if (locked.value) return\n commit(selected.value.filter((item) => !same(item, value)))\n emit('removeTag', value)\n}\n\nfunction clear() {\n commit(props.multiple ? [] : null)\n emit('clear')\n hide()\n focus()\n}\n\nconst fieldRef = useTemplateRef<HTMLElement>('field')\nconst inputRef = useTemplateRef<HTMLInputElement>('input')\nconst combobox = () => (filterable.value ? inputRef.value : fieldRef.value)\nfunction focus() {\n combobox()?.focus()\n}\n\nlet typed = ''\nlet typedTimer: ReturnType<typeof setTimeout> | undefined\n\nfunction onKeydown(event: KeyboardEvent) {\n if (locked.value || isComposing(event)) return\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n event.preventDefault()\n if (!open.value) show()\n else move(active.value, event.key === 'ArrowDown' ? 1 : -1)\n return\n case 'Home':\n case 'End':\n if (!open.value || filterable.value) return\n event.preventDefault()\n edge(event.key === 'Home' ? 'first' : 'last')\n return\n case 'Enter':\n event.preventDefault()\n if (open.value) choose(filtered.value[active.value])\n else show()\n return\n case ' ':\n if (filterable.value) return\n event.preventDefault()\n if (open.value) choose(filtered.value[active.value])\n else show()\n return\n case 'Tab':\n hide()\n return\n case 'Backspace':\n if (props.multiple && filterable.value && !query.value && selected.value.length) {\n remove(selected.value.at(-1)!)\n }\n return\n }\n\n // Without a search box, typing jumps to the next option starting with it.\n if (filterable.value || event.key.length !== 1 || event.ctrlKey || event.metaKey) return\n clearTimeout(typedTimer)\n typed += event.key.toLowerCase()\n typedTimer = setTimeout(() => (typed = ''), 500)\n show()\n const count = filtered.value.length\n for (let offset = typed.length > 1 ? 0 : 1; offset <= count; offset++) {\n const index = (active.value + offset) % count\n if (enabled(index) && labelOf(filtered.value[index]!).toLowerCase().startsWith(typed)) {\n active.value = index\n return\n }\n }\n}\n\nfunction onInput() {\n show()\n}\n\n// Pressing anywhere on the field toggles the list and keeps focus in it;\n// buttons inside (clear, tag removal) act on their own.\nfunction onFieldMousedown(event: MouseEvent) {\n if (locked.value) return\n const target = event.target as HTMLElement\n if (target.closest('button')) return\n if (target !== inputRef.value) event.preventDefault()\n focus()\n if (open.value && target !== inputRef.value) hide()\n else show()\n}\n\nfunction onBlur(event: FocusEvent) {\n const next = event.relatedTarget\n if (next instanceof Node && (fieldRef.value?.contains(next) || panelRef.value?.contains(next))) {\n return\n }\n hide()\n formItem?.trigger('blur')\n}\n\nconst comboboxAttrs = computed<HTMLAttributes>(() => ({\n role: 'combobox',\n 'aria-haspopup': 'listbox',\n 'aria-expanded': open.value,\n 'aria-controls': rendered.value ? listboxId : undefined,\n 'aria-activedescendant': open.value && active.value >= 0 ? optionId(active.value) : undefined,\n 'aria-disabled': disabled.value || undefined,\n 'aria-readonly': readonly.value || undefined,\n 'aria-invalid': invalid.value || undefined,\n 'aria-required': formItem?.required.value || undefined,\n 'aria-describedby': formItem?.describedBy.value,\n 'aria-label': props.ariaLabel,\n}))\n\nconst singleLabel = computed(() =>\n !props.multiple && selectedOptions.value[0] ? labelOf(selectedOptions.value[0]) : '',\n)\nconst placeholderText = computed(() => props.placeholder ?? t('select.placeholder'))\nconst inputPlaceholder = computed(() => {\n if (props.multiple) return hasValue.value ? '' : placeholderText.value\n return singleLabel.value || placeholderText.value\n})\n\nconst showClear = computed(() => props.clearable && !locked.value && hasValue.value)\nconst tagSize = computed(() => size.value)\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('multiple', props.multiple),\n ns.is('filterable', filterable.value),\n ns.is('open', open.value),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('selected', hasValue.value),\n])\n\ndefineExpose<SelectExpose>({ focus, blur: () => combobox()?.blur() })\n</script>\n\n<template>\n <OnlyChild ref=\"triggerRef\">\n <div\n ref=\"field\"\n v-bind=\"filterable ? $attrs : { ...$attrs, ...comboboxAttrs }\"\n :class=\"classes\"\n :id=\"filterable ? undefined : formItem?.inputId\"\n :aria-labelledby=\"filterable ? undefined : formItem?.labelId\"\n :tabindex=\"filterable || disabled ? undefined : 0\"\n @mousedown=\"onFieldMousedown\"\n @keydown=\"filterable ? undefined : onKeydown($event)\"\n @focusout=\"onBlur\"\n >\n <span v-if=\"slots.prefix\" :class=\"ns.e('prefix')\"><slot name=\"prefix\" /></span>\n <div :class=\"ns.e('selection')\">\n <template v-if=\"multiple\">\n <template v-for=\"option in shownTags\" :key=\"String(identity(option.value))\">\n <slot name=\"tag\" :option=\"option\" :remove=\"() => remove(option.value)\">\n <DouTag\n :size=\"tagSize\"\n :closable=\"!locked\"\n :class=\"ns.e('tag')\"\n @close=\"remove(option.value)\"\n >\n {{ labelOf(option) }}\n </DouTag>\n </slot>\n </template>\n <DouTag\n v-if=\"hiddenTags.length\"\n :size=\"tagSize\"\n :class=\"[ns.e('tag'), ns.e('tag-more')]\"\n :title=\"hiddenTags.map(labelOf).join('、')\"\n >\n +{{ hiddenTags.length }}\n </DouTag>\n </template>\n <input\n v-if=\"filterable\"\n ref=\"input\"\n v-model=\"query\"\n v-bind=\"comboboxAttrs\"\n :id=\"formItem?.inputId\"\n :class=\"ns.e('input')\"\n type=\"text\"\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n :placeholder=\"inputPlaceholder\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n @input=\"onInput\"\n @keydown=\"onKeydown\"\n />\n <span v-else-if=\"!multiple && hasValue\" :class=\"ns.e('value')\">\n <slot name=\"label\" :option=\"selectedOptions[0]!\">{{ singleLabel }}</slot>\n </span>\n <span v-else-if=\"!hasValue\" :class=\"ns.e('placeholder')\">{{ placeholderText }}</span>\n </div>\n <button\n v-if=\"showClear\"\n type=\"button\"\n tabindex=\"-1\"\n :class=\"ns.e('clear')\"\n :aria-label=\"t('select.clear')\"\n @mousedown.prevent\n @click=\"clear\"\n >\n <CloseIcon />\n </button>\n <ChevronDownIcon :class=\"ns.e('arrow')\" />\n </div>\n </OnlyChild>\n <Teleport v-if=\"rendered\" :to=\"teleportTarget.to\" :disabled=\"teleportTarget.disabled\">\n <Transition appear name=\"dou-floating\">\n <div\n v-show=\"open\"\n ref=\"panelRef\"\n :class=\"[ns.e('menu'), 'dou-floating', ns.is('virtual', isVirtual)]\"\n :style=\"panelStyle\"\n :data-placement=\"placement\"\n :data-dou-theme=\"theme\"\n @mousedown.prevent\n @scroll=\"isVirtual && (menuScroll = ($event.target as HTMLElement).scrollTop)\"\n >\n <div v-if=\"slots.header\" :class=\"ns.e('header')\"><slot name=\"header\" /></div>\n <div v-if=\"loading\" :class=\"ns.e('loading')\" role=\"status\">\n <DouSpinner size=\"sm\" :label=\"t('select.loading')\" />\n <span aria-hidden=\"true\">{{ t('select.loading') }}</span>\n </div>\n <ul\n v-else-if=\"isVirtual\"\n :id=\"listboxId\"\n role=\"listbox\"\n :class=\"ns.e('list')\"\n :style=\"{ height: `${rows.length * ROW}px` }\"\n :aria-multiselectable=\"multiple || undefined\"\n :aria-labelledby=\"formItem?.labelId\"\n >\n <template v-for=\"(row, offset) in virtualRows\" :key=\"row.key\">\n <li\n v-if=\"row.kind === 'group'\"\n role=\"presentation\"\n :class=\"[ns.e('group-label'), ns.is('separated', virtualRange.from + offset > 0)]\"\n :style=\"{ transform: `translateY(${(virtualRange.from + offset) * ROW}px)` }\"\n >\n {{ row.label }}\n </li>\n <li\n v-else\n :id=\"optionId(row.index)\"\n role=\"option\"\n :aria-selected=\"isSelected(row.option)\"\n :aria-disabled=\"unavailable(row.option) || undefined\"\n :aria-setsize=\"filtered.length\"\n :aria-posinset=\"row.index + 1\"\n :class=\"[\n ns.e('option'),\n ns.is('active', row.index === active),\n ns.is('selected', isSelected(row.option)),\n ns.is('disabled', unavailable(row.option)),\n ns.is('create', row.option === createOption),\n ]\"\n :style=\"{ transform: `translateY(${(virtualRange.from + offset) * ROW}px)` }\"\n @click=\"choose(row.option)\"\n @mousemove=\"!unavailable(row.option) && (active = row.index)\"\n >\n <span :class=\"ns.e('option-label')\">\n <slot name=\"option\" :option=\"row.option\" :selected=\"isSelected(row.option)\">\n {{ labelOf(row.option) }}\n </slot>\n </span>\n <CheckIcon v-if=\"isSelected(row.option)\" :class=\"ns.e('check')\" />\n </li>\n </template>\n </ul>\n <ul\n v-else\n :id=\"listboxId\"\n role=\"listbox\"\n :class=\"ns.e('list')\"\n :aria-multiselectable=\"multiple || undefined\"\n :aria-labelledby=\"formItem?.labelId\"\n >\n <li\n v-if=\"createOption\"\n :id=\"optionId(0)\"\n role=\"option\"\n :aria-selected=\"false\"\n :class=\"[ns.e('option'), ns.is('active', active === 0), ns.is('create', true)]\"\n @click=\"choose(createOption)\"\n @mousemove=\"active = 0\"\n >\n <span :class=\"ns.e('option-label')\">{{ labelOf(createOption) }}</span>\n </li>\n <li\n v-for=\"section in filteredSections\"\n :key=\"section.key\"\n role=\"presentation\"\n :class=\"ns.e('section')\"\n >\n <div\n v-if=\"section.label\"\n :id=\"`${id}-${section.key}`\"\n :class=\"ns.e('group-label')\"\n aria-hidden=\"true\"\n >\n {{ section.label }}\n </div>\n <ul\n :role=\"section.label ? 'group' : 'presentation'\"\n :aria-labelledby=\"section.label ? `${id}-${section.key}` : undefined\"\n :class=\"ns.e('group')\"\n >\n <li\n v-for=\"option in section.options\"\n :id=\"optionId(indexOf(option))\"\n :key=\"String(identity(option.value))\"\n role=\"option\"\n :aria-selected=\"isSelected(option)\"\n :aria-disabled=\"unavailable(option) || undefined\"\n :class=\"[\n ns.e('option'),\n ns.is('active', indexOf(option) === active),\n ns.is('selected', isSelected(option)),\n ns.is('disabled', unavailable(option)),\n ]\"\n @click=\"choose(option)\"\n @mousemove=\"!unavailable(option) && (active = indexOf(option))\"\n >\n <span :class=\"ns.e('option-label')\">\n <slot name=\"option\" :option=\"option\" :selected=\"isSelected(option)\">\n {{ labelOf(option) }}\n </slot>\n </span>\n <CheckIcon v-if=\"isSelected(option)\" :class=\"ns.e('check')\" />\n </li>\n </ul>\n </li>\n </ul>\n <div v-if=\"!loading && !filtered.length\" :class=\"ns.e('empty')\">\n <slot name=\"empty\">{{ t('select.empty') }}</slot>\n </div>\n <div v-if=\"slots.footer\" :class=\"ns.e('footer')\"><slot name=\"footer\" /></div>\n </div>\n </Transition>\n </Teleport>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"select.js","names":["_sfc_main"],"sources":["../../../src/components/select/select.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CheckIcon, ChevronDownIcon, CloseIcon } from '@dou-ui/icons'\nimport { computed, nextTick, onBeforeUnmount, ref, useId, useTemplateRef, watch } from 'vue'\nimport type { HTMLAttributes } from 'vue'\nimport { usePopup } from '../../composables/use-popup'\nimport { isComposing } from '../../utils/keyboard'\nimport { useNamespace } from '../../utils/namespace'\nimport { shouldVirtualize } from '../../utils/virtual'\nimport { OnlyChild } from '../../utils/only-child'\nimport { useLocale } from '../config-provider/use-config'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport { DouSpinner } from '../spinner'\nimport { DouTag } from '../tag'\nimport type {\n SelectExpose,\n SelectOption,\n SelectOptionGroup,\n SelectProps,\n SelectSlots,\n SelectValue,\n} from './select'\nimport { useTeleport } from '../../utils/teleport'\n\ndefineOptions({ name: 'DouSelect', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n multiple: false,\n filterable: false,\n disabled: false,\n invalid: false,\n clearable: false,\n placement: 'bottom-start',\n teleport: undefined,\n remote: false,\n searchDelay: 300,\n loading: false,\n creatable: false,\n virtual: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\n// An explicit default stops Vue from reading a missing value as `false`.\nconst model = defineModel<SelectValue | SelectValue[] | null | undefined>({ default: undefined })\nconst emit = defineEmits<{\n change: [value: SelectValue | SelectValue[] | null]\n clear: []\n search: [query: string]\n create: [value: string]\n visibleChange: [open: boolean]\n removeTag: [value: SelectValue]\n}>()\nconst slots = defineSlots<SelectSlots>()\n\nconst ns = useNamespace('select')\nconst { t } = useLocale()\nconst { formItem } = useFormItem()\n// Searching remotely or creating options needs the search box.\nconst filterable = computed(() => props.filterable || props.remote || props.creatable)\n// A plain combobox is not labelable, so the item names it by id instead.\nif (!filterable.value) formItem?.markGroup()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\n// Read-only keeps the field focusable but never opens or changes it.\nconst locked = computed(() => disabled.value || readonly.value)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\n\nconst id = `dou-select-${useId()}`\nconst listboxId = `${id}-listbox`\nconst optionId = (index: number) => `${id}-option-${index}`\n\nconst toOption = (option: SelectOption | string | number): SelectOption =>\n typeof option === 'object' ? option : { value: option, label: String(option) }\nconst isGroup = (\n entry: SelectOption | SelectOptionGroup | string | number,\n): entry is SelectOptionGroup =>\n typeof entry === 'object' && Array.isArray((entry as SelectOptionGroup).options)\n\ninterface Section {\n key: string\n label?: string\n options: SelectOption[]\n}\n\n/** Options created from the search text, kept so they stay listed. */\nconst created = ref<SelectOption[]>([])\n\nconst sections = computed<Section[]>(() => {\n const result: Section[] = []\n let loose: Section | undefined\n for (const [index, entry] of props.options.entries()) {\n if (isGroup(entry)) {\n loose = undefined\n result.push({\n key: `group-${index}`,\n label: entry.label,\n options: entry.options.map((option) => {\n const normalized = toOption(option)\n return entry.disabled ? { ...normalized, disabled: true } : normalized\n }),\n })\n } else {\n if (!loose) result.push((loose = { key: `loose-${index}`, options: [] }))\n loose.options.push(toOption(entry))\n }\n }\n const known = new Set(result.flatMap((section) => section.options.map((o) => o.value)))\n const extra = created.value.filter((option) => !known.has(option.value))\n if (extra.length) result.push({ key: 'created', options: extra })\n return result\n})\nconst options = computed(() => sections.value.flatMap((section) => section.options))\nconst labelOf = (option: SelectOption) =>\n option.label ??\n (typeof option.value === 'object' ? String(identity(option.value)) : String(option.value))\n\n/** What tells values apart: the `valueKey` of an object, otherwise the value itself. */\nfunction identity(value: SelectValue): unknown {\n return props.valueKey && value !== null && typeof value === 'object'\n ? (value as Record<string, unknown>)[props.valueKey]\n : value\n}\nconst same = (a: SelectValue | null | undefined, b: SelectValue | null | undefined) =>\n a === b || (a != null && b != null && identity(a) === identity(b))\n\n// Remember every option seen, so a value chosen from earlier remote\n// results keeps its label after the options change.\nconst seen = new Map<unknown, SelectOption>()\nwatch(\n options,\n (list) => {\n for (const option of list) seen.set(identity(option.value), option)\n },\n { immediate: true },\n)\n\nconst selected = computed<SelectValue[]>(() => {\n const value = model.value\n if (props.multiple) return Array.isArray(value) ? value : []\n return value === null || value === undefined || Array.isArray(value) ? [] : [value]\n})\n// Looked up by identity, so long lists with many picks stay linear.\nconst selectedSet = computed(() => new Set(selected.value.map(identity)))\nconst isSelected = (option: SelectOption) => selectedSet.value.has(identity(option.value))\nconst optionById = computed(() => {\n const map = new Map<unknown, SelectOption>()\n for (const option of options.value) {\n const key = identity(option.value)\n if (!map.has(key)) map.set(key, option)\n }\n return map\n})\nconst selectedOptions = computed(() =>\n selected.value.map(\n (value) => optionById.value.get(identity(value)) ?? seen.get(identity(value)) ?? { value },\n ),\n)\nconst atLimit = computed(\n () => props.multiple && !!props.multipleLimit && selected.value.length >= props.multipleLimit,\n)\n/** Disabled, or out of reach because the limit is met. */\nconst unavailable = (option: SelectOption) =>\n !!option.disabled || (atLimit.value && !isSelected(option))\n\n// tags shown in the field, and how many more fold into \"+N\"\nconst shownTags = computed(() =>\n props.maxTagCount === undefined\n ? selectedOptions.value\n : selectedOptions.value.slice(0, Math.max(0, props.maxTagCount)),\n)\nconst hiddenTags = computed(() => selectedOptions.value.slice(shownTags.value.length))\nconst hasValue = computed(() => selected.value.length > 0)\n\nconst query = ref('')\nconst matches = (option: SelectOption, text: string) => labelOf(option).toLowerCase().includes(text)\nconst filteredSections = computed<Section[]>(() => {\n const text = query.value.trim().toLowerCase()\n if (!filterable.value || props.remote || !text) return sections.value\n return sections.value\n .map((section) => ({ ...section, options: section.options.filter((o) => matches(o, text)) }))\n .filter((section) => section.options.length > 0)\n})\n\n/** The pseudo-option that creates the typed text, when nothing matches it exactly. */\nconst createOption = computed<SelectOption | undefined>(() => {\n const text = query.value.trim()\n if (!props.creatable || !text) return undefined\n if (options.value.some((option) => labelOf(option) === text || same(option.value, text))) {\n return undefined\n }\n return { value: text, label: t('select.create', { query: text }) }\n})\n\n/** Every option the keyboard can reach, in list order. */\nconst filtered = computed<SelectOption[]>(() => [\n ...(createOption.value ? [createOption.value] : []),\n ...filteredSections.value.flatMap((section) => section.options),\n])\nconst indexes = computed(() => new Map(filtered.value.map((option, index) => [option, index])))\nconst indexOf = (option: SelectOption) => indexes.value.get(option) ?? -1\n\n// virtual list: every row (group label or option) is one option tall\nconst ROW = 32\ntype Row =\n | { kind: 'group'; key: string; label: string; id: string }\n | { kind: 'option'; key: string; option: SelectOption; index: number }\nconst rows = computed<Row[]>(() => {\n const result: Row[] = []\n if (createOption.value) {\n result.push({ kind: 'option', key: 'create', option: createOption.value, index: 0 })\n }\n for (const section of filteredSections.value) {\n if (section.label) {\n result.push({\n kind: 'group',\n key: section.key,\n label: section.label,\n id: `${id}-${section.key}`,\n })\n }\n for (const option of section.options) {\n result.push({\n kind: 'option',\n key: String(identity(option.value)),\n option,\n index: indexOf(option),\n })\n }\n }\n return result\n})\nconst menuScroll = ref(0)\nconst isVirtual = computed(() => shouldVirtualize(props.virtual, rows.value.length))\nconst virtualRange = computed(() => {\n const from = Math.max(0, Math.floor(menuScroll.value / ROW) - 4)\n return { from, to: Math.min(rows.value.length, from + Math.ceil(280 / ROW) + 8) }\n})\nconst virtualRows = computed(() => rows.value.slice(virtualRange.value.from, virtualRange.value.to))\n\nconst open = ref(false)\nconst popup = usePopup({\n open,\n trigger: 'manual',\n closeOnOutside: true,\n disabled: locked,\n placement: () => props.placement,\n offset: 4,\n sameWidth: true,\n})\nconst { triggerRef, panelRef, rendered, theme, placement, panelStyle } = popup\n\n// The highlighted option. Focus stays in the field; the list follows\n// through `aria-activedescendant`.\nconst active = ref(-1)\nconst enabled = (index: number) => !!filtered.value[index] && !unavailable(filtered.value[index]!)\n\nfunction move(from: number, step: 1 | -1) {\n const count = filtered.value.length\n for (let offset = 1; offset <= count; offset++) {\n const index = (((from + step * offset) % count) + count) % count\n if (enabled(index)) {\n active.value = index\n return\n }\n }\n}\nfunction edge(which: 'first' | 'last') {\n move(which === 'first' ? -1 : filtered.value.length, which === 'first' ? 1 : -1)\n}\n\nfunction show() {\n if (locked.value || open.value) return\n open.value = true\n const index = filtered.value.findIndex(isSelected)\n if (index >= 0 && enabled(index)) active.value = index\n else edge('first')\n}\nfunction hide() {\n open.value = false\n query.value = ''\n}\n\n// remote search: report the text once typing pauses, and on opening\nlet searchTimer: ReturnType<typeof setTimeout> | undefined\nwatch(query, (text) => {\n if (!props.remote || !open.value) return\n clearTimeout(searchTimer)\n searchTimer = setTimeout(() => emit('search', text), props.searchDelay)\n})\nonBeforeUnmount(() => clearTimeout(searchTimer))\n\n// Switching between full and virtual rendering keeps the scroll position.\nwatch(isVirtual, () => {\n void nextTick(() => (menuScroll.value = panelRef.value?.scrollTop ?? 0))\n})\n\nwatch(open, (value) => {\n emit('visibleChange', value)\n if (!value) query.value = ''\n else if (props.remote) emit('search', query.value)\n})\n// A parent that re-renders passes a new but equal list: only a different\n// list of options moves the highlight back to the top.\nwatch(\n () => filtered.value.map((option) => identity(option.value)),\n (next, prev) => {\n if (next.length === prev.length && next.every((value, index) => value === prev[index])) return\n if (open.value) edge('first')\n },\n)\nwatch(active, async (index) => {\n await nextTick()\n const menu = panelRef.value\n if (!menu) return\n if (isVirtual.value) {\n // The option may not be rendered yet: scroll by its row instead.\n const row = rows.value.findIndex((item) => item.kind === 'option' && item.index === index)\n if (row < 0) return\n const inset = 4\n const top = row * ROW + inset\n const current = menuScroll.value\n let target = current\n if (top < current) target = top - inset\n else if (top + ROW > current + menu.clientHeight) target = top + ROW - menu.clientHeight + inset\n // Render the rows around the target now, before the scroll event arrives.\n menuScroll.value = Math.max(0, target)\n menu.scrollTop = menuScroll.value\n return\n }\n menu.querySelector(`#${CSS.escape(optionId(index))}`)?.scrollIntoView?.({ block: 'nearest' })\n})\n\nfunction commit(value: SelectValue | SelectValue[] | null) {\n model.value = value\n emit('change', value)\n formItem?.trigger('change')\n}\n\nfunction choose(option: SelectOption | undefined) {\n if (!option || unavailable(option)) return\n if (option === createOption.value) {\n const value = String(option.value)\n option = { value, label: value }\n created.value = [...created.value, option]\n seen.set(value, option)\n emit('create', value)\n }\n if (props.multiple) {\n const chosen = option\n const values = isSelected(chosen)\n ? selected.value.filter((value) => !same(value, chosen.value))\n : [...selected.value, chosen.value]\n commit(values)\n query.value = ''\n } else {\n if (!same(option.value, model.value as SelectValue | null | undefined)) commit(option.value)\n hide()\n }\n}\n\nfunction remove(value: SelectValue) {\n if (locked.value) return\n commit(selected.value.filter((item) => !same(item, value)))\n emit('removeTag', value)\n}\n\nfunction clear() {\n commit(props.multiple ? [] : null)\n emit('clear')\n hide()\n focus()\n}\n\nconst fieldRef = useTemplateRef<HTMLElement>('field')\nconst inputRef = useTemplateRef<HTMLInputElement>('input')\nconst combobox = () => (filterable.value ? inputRef.value : fieldRef.value)\nfunction focus() {\n combobox()?.focus()\n}\n\nlet typed = ''\nlet typedTimer: ReturnType<typeof setTimeout> | undefined\n\nfunction onKeydown(event: KeyboardEvent) {\n if (locked.value || isComposing(event)) return\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n event.preventDefault()\n if (!open.value) show()\n else move(active.value, event.key === 'ArrowDown' ? 1 : -1)\n return\n case 'Home':\n case 'End':\n if (!open.value || filterable.value) return\n event.preventDefault()\n edge(event.key === 'Home' ? 'first' : 'last')\n return\n case 'Enter':\n event.preventDefault()\n if (open.value) choose(filtered.value[active.value])\n else show()\n return\n case ' ':\n if (filterable.value) return\n event.preventDefault()\n if (open.value) choose(filtered.value[active.value])\n else show()\n return\n case 'Tab':\n hide()\n return\n case 'Backspace':\n if (props.multiple && filterable.value && !query.value && selected.value.length) {\n remove(selected.value.at(-1)!)\n }\n return\n }\n\n // Without a search box, typing jumps to the next option starting with it.\n if (filterable.value || event.key.length !== 1 || event.ctrlKey || event.metaKey) return\n clearTimeout(typedTimer)\n typed += event.key.toLowerCase()\n typedTimer = setTimeout(() => (typed = ''), 500)\n show()\n const count = filtered.value.length\n for (let offset = typed.length > 1 ? 0 : 1; offset <= count; offset++) {\n const index = (active.value + offset) % count\n if (enabled(index) && labelOf(filtered.value[index]!).toLowerCase().startsWith(typed)) {\n active.value = index\n return\n }\n }\n}\n\nfunction onInput() {\n show()\n}\n\n// Pressing anywhere on the field toggles the list and keeps focus in it;\n// buttons inside (clear, tag removal) act on their own.\nfunction onFieldMousedown(event: MouseEvent) {\n if (locked.value) return\n const target = event.target as HTMLElement\n if (target.closest('button')) return\n if (target !== inputRef.value) event.preventDefault()\n focus()\n if (open.value && target !== inputRef.value) hide()\n else show()\n}\n\nfunction onBlur(event: FocusEvent) {\n const next = event.relatedTarget\n if (next instanceof Node && (fieldRef.value?.contains(next) || panelRef.value?.contains(next))) {\n return\n }\n hide()\n formItem?.trigger('blur')\n}\n\nconst comboboxAttrs = computed<HTMLAttributes>(() => ({\n role: 'combobox',\n 'aria-haspopup': 'listbox',\n 'aria-expanded': open.value,\n 'aria-controls': rendered.value ? listboxId : undefined,\n 'aria-activedescendant': open.value && active.value >= 0 ? optionId(active.value) : undefined,\n 'aria-disabled': disabled.value || undefined,\n 'aria-readonly': readonly.value || undefined,\n 'aria-invalid': invalid.value || undefined,\n 'aria-required': formItem?.required.value || undefined,\n 'aria-describedby': formItem?.describedBy.value,\n 'aria-label': props.ariaLabel,\n}))\n\nconst singleLabel = computed(() =>\n !props.multiple && selectedOptions.value[0] ? labelOf(selectedOptions.value[0]) : '',\n)\nconst placeholderText = computed(() => props.placeholder ?? t('select.placeholder'))\nconst inputPlaceholder = computed(() => {\n if (props.multiple) return hasValue.value ? '' : placeholderText.value\n return singleLabel.value || placeholderText.value\n})\n\nconst showClear = computed(() => props.clearable && !locked.value && hasValue.value)\nconst tagSize = computed(() => size.value)\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('multiple', props.multiple),\n ns.is('filterable', filterable.value),\n ns.is('open', open.value),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('selected', hasValue.value),\n])\n\ndefineExpose<SelectExpose>({ focus, blur: () => combobox()?.blur() })\n</script>\n\n<template>\n <OnlyChild ref=\"triggerRef\">\n <div\n ref=\"field\"\n v-bind=\"filterable ? $attrs : { ...$attrs, ...comboboxAttrs }\"\n :class=\"classes\"\n :id=\"filterable ? undefined : formItem?.inputId\"\n :aria-labelledby=\"filterable ? undefined : formItem?.labelId\"\n :tabindex=\"filterable || disabled ? undefined : 0\"\n @mousedown=\"onFieldMousedown\"\n @keydown=\"filterable ? undefined : onKeydown($event)\"\n @focusout=\"onBlur\"\n >\n <span v-if=\"slots.prefix\" :class=\"ns.e('prefix')\"><slot name=\"prefix\" /></span>\n <div :class=\"ns.e('selection')\">\n <template v-if=\"multiple\">\n <template v-for=\"option in shownTags\" :key=\"String(identity(option.value))\">\n <slot name=\"tag\" :option=\"option\" :remove=\"() => remove(option.value)\">\n <DouTag\n :size=\"tagSize\"\n :closable=\"!locked\"\n :class=\"ns.e('tag')\"\n @close=\"remove(option.value)\"\n >\n {{ labelOf(option) }}\n </DouTag>\n </slot>\n </template>\n <DouTag\n v-if=\"hiddenTags.length\"\n :size=\"tagSize\"\n :class=\"[ns.e('tag'), ns.e('tag-more')]\"\n :title=\"hiddenTags.map(labelOf).join('、')\"\n >\n +{{ hiddenTags.length }}\n </DouTag>\n </template>\n <input\n v-if=\"filterable\"\n ref=\"input\"\n v-model=\"query\"\n v-bind=\"comboboxAttrs\"\n :id=\"formItem?.inputId\"\n :class=\"ns.e('input')\"\n type=\"text\"\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n :placeholder=\"inputPlaceholder\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n @input=\"onInput\"\n @keydown=\"onKeydown\"\n />\n <span v-else-if=\"!multiple && hasValue\" :class=\"ns.e('value')\">\n <slot name=\"label\" :option=\"selectedOptions[0]!\">{{ singleLabel }}</slot>\n </span>\n <span v-else-if=\"!hasValue\" :class=\"ns.e('placeholder')\">{{ placeholderText }}</span>\n </div>\n <button\n v-if=\"showClear\"\n type=\"button\"\n tabindex=\"-1\"\n :class=\"ns.e('clear')\"\n :aria-label=\"t('select.clear')\"\n @mousedown.prevent\n @click=\"clear\"\n >\n <CloseIcon />\n </button>\n <ChevronDownIcon :class=\"ns.e('arrow')\" />\n </div>\n </OnlyChild>\n <Teleport v-if=\"rendered\" :to=\"teleportTarget.to\" :disabled=\"teleportTarget.disabled\">\n <Transition appear name=\"dou-floating\">\n <div\n v-show=\"open\"\n ref=\"panelRef\"\n :class=\"[ns.e('menu'), 'dou-floating', ns.is('virtual', isVirtual)]\"\n :style=\"panelStyle\"\n :data-placement=\"placement\"\n :data-dou-theme=\"theme\"\n @mousedown.prevent\n @scroll=\"isVirtual && (menuScroll = ($event.target as HTMLElement).scrollTop)\"\n >\n <div v-if=\"slots.header\" :class=\"ns.e('header')\"><slot name=\"header\" /></div>\n <div v-if=\"loading\" :class=\"ns.e('loading')\" role=\"status\">\n <DouSpinner size=\"sm\" :label=\"t('select.loading')\" />\n <span aria-hidden=\"true\">{{ t('select.loading') }}</span>\n </div>\n <ul\n v-else-if=\"isVirtual\"\n :id=\"listboxId\"\n role=\"listbox\"\n :class=\"ns.e('list')\"\n :style=\"{ height: `${rows.length * ROW}px` }\"\n :aria-multiselectable=\"multiple || undefined\"\n :aria-labelledby=\"formItem?.labelId\"\n >\n <template v-for=\"(row, offset) in virtualRows\" :key=\"row.key\">\n <li\n v-if=\"row.kind === 'group'\"\n role=\"presentation\"\n :class=\"[ns.e('group-label'), ns.is('separated', virtualRange.from + offset > 0)]\"\n :style=\"{ transform: `translateY(${(virtualRange.from + offset) * ROW}px)` }\"\n >\n {{ row.label }}\n </li>\n <li\n v-else\n :id=\"optionId(row.index)\"\n role=\"option\"\n :aria-selected=\"isSelected(row.option)\"\n :aria-disabled=\"unavailable(row.option) || undefined\"\n :aria-setsize=\"filtered.length\"\n :aria-posinset=\"row.index + 1\"\n :class=\"[\n ns.e('option'),\n ns.is('active', row.index === active),\n ns.is('selected', isSelected(row.option)),\n ns.is('disabled', unavailable(row.option)),\n ns.is('create', row.option === createOption),\n ]\"\n :style=\"{ transform: `translateY(${(virtualRange.from + offset) * ROW}px)` }\"\n @click=\"choose(row.option)\"\n @mousemove=\"!unavailable(row.option) && (active = row.index)\"\n >\n <span :class=\"ns.e('option-label')\">\n <slot name=\"option\" :option=\"row.option\" :selected=\"isSelected(row.option)\">\n {{ labelOf(row.option) }}\n </slot>\n </span>\n <CheckIcon v-if=\"isSelected(row.option)\" :class=\"ns.e('check')\" />\n </li>\n </template>\n </ul>\n <ul\n v-else\n :id=\"listboxId\"\n role=\"listbox\"\n :class=\"ns.e('list')\"\n :aria-multiselectable=\"multiple || undefined\"\n :aria-labelledby=\"formItem?.labelId\"\n >\n <li\n v-if=\"createOption\"\n :id=\"optionId(0)\"\n role=\"option\"\n :aria-selected=\"false\"\n :class=\"[ns.e('option'), ns.is('active', active === 0), ns.is('create', true)]\"\n @click=\"choose(createOption)\"\n @mousemove=\"active = 0\"\n >\n <span :class=\"ns.e('option-label')\">{{ labelOf(createOption) }}</span>\n </li>\n <li\n v-for=\"section in filteredSections\"\n :key=\"section.key\"\n role=\"presentation\"\n :class=\"ns.e('section')\"\n >\n <div\n v-if=\"section.label\"\n :id=\"`${id}-${section.key}`\"\n :class=\"ns.e('group-label')\"\n aria-hidden=\"true\"\n >\n {{ section.label }}\n </div>\n <ul\n :role=\"section.label ? 'group' : 'presentation'\"\n :aria-labelledby=\"section.label ? `${id}-${section.key}` : undefined\"\n :class=\"ns.e('group')\"\n >\n <li\n v-for=\"option in section.options\"\n :id=\"optionId(indexOf(option))\"\n :key=\"String(identity(option.value))\"\n role=\"option\"\n :aria-selected=\"isSelected(option)\"\n :aria-disabled=\"unavailable(option) || undefined\"\n :class=\"[\n ns.e('option'),\n ns.is('active', indexOf(option) === active),\n ns.is('selected', isSelected(option)),\n ns.is('disabled', unavailable(option)),\n ]\"\n @click=\"choose(option)\"\n @mousemove=\"!unavailable(option) && (active = indexOf(option))\"\n >\n <span :class=\"ns.e('option-label')\">\n <slot name=\"option\" :option=\"option\" :selected=\"isSelected(option)\">\n {{ labelOf(option) }}\n </slot>\n </span>\n <CheckIcon v-if=\"isSelected(option)\" :class=\"ns.e('check')\" />\n </li>\n </ul>\n </li>\n </ul>\n <div v-if=\"!loading && !filtered.length\" :class=\"ns.e('empty')\">\n <slot name=\"empty\">{{ t('select.empty') }}</slot>\n </div>\n <div v-if=\"slots.footer\" :class=\"ns.e('footer')\"><slot name=\"footer\" /></div>\n </div>\n </Transition>\n </Teleport>\n</template>\n"],"mappings":""}
@@ -5,7 +5,7 @@ import { isComposing } from "../../utils/keyboard.js";
5
5
  import { usePopup } from "../../composables/use-popup.js";
6
6
  import { shouldVirtualize } from "../../utils/virtual.js";
7
7
  import { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from "../form/use-form-item.js";
8
- import spinner_default from "../spinner/spinner.js";
8
+ import { DouSpinner } from "../spinner/index.js";
9
9
  import { useTeleport } from "../../utils/teleport.js";
10
10
  import { DouTag } from "../tag/index.js";
11
11
  import { Fragment, Teleport, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useId, useModel, useSlots, useTemplateRef, vModelText, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
@@ -616,7 +616,7 @@ var select_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
616
616
  key: 1,
617
617
  class: normalizeClass(unref(ns).e("loading")),
618
618
  role: "status"
619
- }, [createVNode(spinner_default, {
619
+ }, [createVNode(unref(DouSpinner), {
620
620
  size: "sm",
621
621
  label: unref(t)("select.loading")
622
622
  }, null, 8, ["label"]), createElementVNode("span", _hoisted_5, toDisplayString(unref(t)("select.loading")), 1)], 2)) : isVirtual.value ? (openBlock(), createElementBlock("ul", {
@@ -1 +1 @@
1
- {"version":3,"file":"select.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useModel","_useSlots","_openBlock","_createElementBlock","_Fragment","_createVNode","_unref","_withCtx","_createElementVNode","_mergeProps","_normalizeClass","_renderSlot","_createCommentVNode","_renderList","_createTextVNode","_toDisplayString","_createBlock","_withDirectives","_vModelText","_withModifiers","_Teleport","_Transition","_normalizeStyle","DouSpinner","_vShow"],"sources":["../../../src/components/select/select.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CheckIcon, ChevronDownIcon, CloseIcon } from '@dou-ui/icons'\nimport { computed, nextTick, onBeforeUnmount, ref, useId, useTemplateRef, watch } from 'vue'\nimport type { HTMLAttributes } from 'vue'\nimport { usePopup } from '../../composables/use-popup'\nimport { isComposing } from '../../utils/keyboard'\nimport { useNamespace } from '../../utils/namespace'\nimport { shouldVirtualize } from '../../utils/virtual'\nimport { OnlyChild } from '../../utils/only-child'\nimport { useLocale } from '../config-provider/use-config'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport DouSpinner from '../spinner/spinner.vue'\nimport { DouTag } from '../tag'\nimport type {\n SelectExpose,\n SelectOption,\n SelectOptionGroup,\n SelectProps,\n SelectSlots,\n SelectValue,\n} from './select'\nimport { useTeleport } from '../../utils/teleport'\n\ndefineOptions({ name: 'DouSelect', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n multiple: false,\n filterable: false,\n disabled: false,\n invalid: false,\n clearable: false,\n placement: 'bottom-start',\n teleport: undefined,\n remote: false,\n searchDelay: 300,\n loading: false,\n creatable: false,\n virtual: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\n// An explicit default stops Vue from reading a missing value as `false`.\nconst model = defineModel<SelectValue | SelectValue[] | null | undefined>({ default: undefined })\nconst emit = defineEmits<{\n change: [value: SelectValue | SelectValue[] | null]\n clear: []\n search: [query: string]\n create: [value: string]\n visibleChange: [open: boolean]\n removeTag: [value: SelectValue]\n}>()\nconst slots = defineSlots<SelectSlots>()\n\nconst ns = useNamespace('select')\nconst { t } = useLocale()\nconst { formItem } = useFormItem()\n// Searching remotely or creating options needs the search box.\nconst filterable = computed(() => props.filterable || props.remote || props.creatable)\n// A plain combobox is not labelable, so the item names it by id instead.\nif (!filterable.value) formItem?.markGroup()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\n// Read-only keeps the field focusable but never opens or changes it.\nconst locked = computed(() => disabled.value || readonly.value)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\n\nconst id = `dou-select-${useId()}`\nconst listboxId = `${id}-listbox`\nconst optionId = (index: number) => `${id}-option-${index}`\n\nconst toOption = (option: SelectOption | string | number): SelectOption =>\n typeof option === 'object' ? option : { value: option, label: String(option) }\nconst isGroup = (\n entry: SelectOption | SelectOptionGroup | string | number,\n): entry is SelectOptionGroup =>\n typeof entry === 'object' && Array.isArray((entry as SelectOptionGroup).options)\n\ninterface Section {\n key: string\n label?: string\n options: SelectOption[]\n}\n\n/** Options created from the search text, kept so they stay listed. */\nconst created = ref<SelectOption[]>([])\n\nconst sections = computed<Section[]>(() => {\n const result: Section[] = []\n let loose: Section | undefined\n for (const [index, entry] of props.options.entries()) {\n if (isGroup(entry)) {\n loose = undefined\n result.push({\n key: `group-${index}`,\n label: entry.label,\n options: entry.options.map((option) => {\n const normalized = toOption(option)\n return entry.disabled ? { ...normalized, disabled: true } : normalized\n }),\n })\n } else {\n if (!loose) result.push((loose = { key: `loose-${index}`, options: [] }))\n loose.options.push(toOption(entry))\n }\n }\n const known = new Set(result.flatMap((section) => section.options.map((o) => o.value)))\n const extra = created.value.filter((option) => !known.has(option.value))\n if (extra.length) result.push({ key: 'created', options: extra })\n return result\n})\nconst options = computed(() => sections.value.flatMap((section) => section.options))\nconst labelOf = (option: SelectOption) =>\n option.label ??\n (typeof option.value === 'object' ? String(identity(option.value)) : String(option.value))\n\n/** What tells values apart: the `valueKey` of an object, otherwise the value itself. */\nfunction identity(value: SelectValue): unknown {\n return props.valueKey && value !== null && typeof value === 'object'\n ? (value as Record<string, unknown>)[props.valueKey]\n : value\n}\nconst same = (a: SelectValue | null | undefined, b: SelectValue | null | undefined) =>\n a === b || (a != null && b != null && identity(a) === identity(b))\n\n// Remember every option seen, so a value chosen from earlier remote\n// results keeps its label after the options change.\nconst seen = new Map<unknown, SelectOption>()\nwatch(\n options,\n (list) => {\n for (const option of list) seen.set(identity(option.value), option)\n },\n { immediate: true },\n)\n\nconst selected = computed<SelectValue[]>(() => {\n const value = model.value\n if (props.multiple) return Array.isArray(value) ? value : []\n return value === null || value === undefined || Array.isArray(value) ? [] : [value]\n})\n// Looked up by identity, so long lists with many picks stay linear.\nconst selectedSet = computed(() => new Set(selected.value.map(identity)))\nconst isSelected = (option: SelectOption) => selectedSet.value.has(identity(option.value))\nconst optionById = computed(() => {\n const map = new Map<unknown, SelectOption>()\n for (const option of options.value) {\n const key = identity(option.value)\n if (!map.has(key)) map.set(key, option)\n }\n return map\n})\nconst selectedOptions = computed(() =>\n selected.value.map(\n (value) => optionById.value.get(identity(value)) ?? seen.get(identity(value)) ?? { value },\n ),\n)\nconst atLimit = computed(\n () => props.multiple && !!props.multipleLimit && selected.value.length >= props.multipleLimit,\n)\n/** Disabled, or out of reach because the limit is met. */\nconst unavailable = (option: SelectOption) =>\n !!option.disabled || (atLimit.value && !isSelected(option))\n\n// tags shown in the field, and how many more fold into \"+N\"\nconst shownTags = computed(() =>\n props.maxTagCount === undefined\n ? selectedOptions.value\n : selectedOptions.value.slice(0, Math.max(0, props.maxTagCount)),\n)\nconst hiddenTags = computed(() => selectedOptions.value.slice(shownTags.value.length))\nconst hasValue = computed(() => selected.value.length > 0)\n\nconst query = ref('')\nconst matches = (option: SelectOption, text: string) => labelOf(option).toLowerCase().includes(text)\nconst filteredSections = computed<Section[]>(() => {\n const text = query.value.trim().toLowerCase()\n if (!filterable.value || props.remote || !text) return sections.value\n return sections.value\n .map((section) => ({ ...section, options: section.options.filter((o) => matches(o, text)) }))\n .filter((section) => section.options.length > 0)\n})\n\n/** The pseudo-option that creates the typed text, when nothing matches it exactly. */\nconst createOption = computed<SelectOption | undefined>(() => {\n const text = query.value.trim()\n if (!props.creatable || !text) return undefined\n if (options.value.some((option) => labelOf(option) === text || same(option.value, text))) {\n return undefined\n }\n return { value: text, label: t('select.create', { query: text }) }\n})\n\n/** Every option the keyboard can reach, in list order. */\nconst filtered = computed<SelectOption[]>(() => [\n ...(createOption.value ? [createOption.value] : []),\n ...filteredSections.value.flatMap((section) => section.options),\n])\nconst indexes = computed(() => new Map(filtered.value.map((option, index) => [option, index])))\nconst indexOf = (option: SelectOption) => indexes.value.get(option) ?? -1\n\n// virtual list: every row (group label or option) is one option tall\nconst ROW = 32\ntype Row =\n | { kind: 'group'; key: string; label: string; id: string }\n | { kind: 'option'; key: string; option: SelectOption; index: number }\nconst rows = computed<Row[]>(() => {\n const result: Row[] = []\n if (createOption.value) {\n result.push({ kind: 'option', key: 'create', option: createOption.value, index: 0 })\n }\n for (const section of filteredSections.value) {\n if (section.label) {\n result.push({\n kind: 'group',\n key: section.key,\n label: section.label,\n id: `${id}-${section.key}`,\n })\n }\n for (const option of section.options) {\n result.push({\n kind: 'option',\n key: String(identity(option.value)),\n option,\n index: indexOf(option),\n })\n }\n }\n return result\n})\nconst menuScroll = ref(0)\nconst isVirtual = computed(() => shouldVirtualize(props.virtual, rows.value.length))\nconst virtualRange = computed(() => {\n const from = Math.max(0, Math.floor(menuScroll.value / ROW) - 4)\n return { from, to: Math.min(rows.value.length, from + Math.ceil(280 / ROW) + 8) }\n})\nconst virtualRows = computed(() => rows.value.slice(virtualRange.value.from, virtualRange.value.to))\n\nconst open = ref(false)\nconst popup = usePopup({\n open,\n trigger: 'manual',\n closeOnOutside: true,\n disabled: locked,\n placement: () => props.placement,\n offset: 4,\n sameWidth: true,\n})\nconst { triggerRef, panelRef, rendered, theme, placement, panelStyle } = popup\n\n// The highlighted option. Focus stays in the field; the list follows\n// through `aria-activedescendant`.\nconst active = ref(-1)\nconst enabled = (index: number) => !!filtered.value[index] && !unavailable(filtered.value[index]!)\n\nfunction move(from: number, step: 1 | -1) {\n const count = filtered.value.length\n for (let offset = 1; offset <= count; offset++) {\n const index = (((from + step * offset) % count) + count) % count\n if (enabled(index)) {\n active.value = index\n return\n }\n }\n}\nfunction edge(which: 'first' | 'last') {\n move(which === 'first' ? -1 : filtered.value.length, which === 'first' ? 1 : -1)\n}\n\nfunction show() {\n if (locked.value || open.value) return\n open.value = true\n const index = filtered.value.findIndex(isSelected)\n if (index >= 0 && enabled(index)) active.value = index\n else edge('first')\n}\nfunction hide() {\n open.value = false\n query.value = ''\n}\n\n// remote search: report the text once typing pauses, and on opening\nlet searchTimer: ReturnType<typeof setTimeout> | undefined\nwatch(query, (text) => {\n if (!props.remote || !open.value) return\n clearTimeout(searchTimer)\n searchTimer = setTimeout(() => emit('search', text), props.searchDelay)\n})\nonBeforeUnmount(() => clearTimeout(searchTimer))\n\n// Switching between full and virtual rendering keeps the scroll position.\nwatch(isVirtual, () => {\n void nextTick(() => (menuScroll.value = panelRef.value?.scrollTop ?? 0))\n})\n\nwatch(open, (value) => {\n emit('visibleChange', value)\n if (!value) query.value = ''\n else if (props.remote) emit('search', query.value)\n})\n// A parent that re-renders passes a new but equal list: only a different\n// list of options moves the highlight back to the top.\nwatch(\n () => filtered.value.map((option) => identity(option.value)),\n (next, prev) => {\n if (next.length === prev.length && next.every((value, index) => value === prev[index])) return\n if (open.value) edge('first')\n },\n)\nwatch(active, async (index) => {\n await nextTick()\n const menu = panelRef.value\n if (!menu) return\n if (isVirtual.value) {\n // The option may not be rendered yet: scroll by its row instead.\n const row = rows.value.findIndex((item) => item.kind === 'option' && item.index === index)\n if (row < 0) return\n const inset = 4\n const top = row * ROW + inset\n const current = menuScroll.value\n let target = current\n if (top < current) target = top - inset\n else if (top + ROW > current + menu.clientHeight) target = top + ROW - menu.clientHeight + inset\n // Render the rows around the target now, before the scroll event arrives.\n menuScroll.value = Math.max(0, target)\n menu.scrollTop = menuScroll.value\n return\n }\n menu.querySelector(`#${CSS.escape(optionId(index))}`)?.scrollIntoView?.({ block: 'nearest' })\n})\n\nfunction commit(value: SelectValue | SelectValue[] | null) {\n model.value = value\n emit('change', value)\n formItem?.trigger('change')\n}\n\nfunction choose(option: SelectOption | undefined) {\n if (!option || unavailable(option)) return\n if (option === createOption.value) {\n const value = String(option.value)\n option = { value, label: value }\n created.value = [...created.value, option]\n seen.set(value, option)\n emit('create', value)\n }\n if (props.multiple) {\n const chosen = option\n const values = isSelected(chosen)\n ? selected.value.filter((value) => !same(value, chosen.value))\n : [...selected.value, chosen.value]\n commit(values)\n query.value = ''\n } else {\n if (!same(option.value, model.value as SelectValue | null | undefined)) commit(option.value)\n hide()\n }\n}\n\nfunction remove(value: SelectValue) {\n if (locked.value) return\n commit(selected.value.filter((item) => !same(item, value)))\n emit('removeTag', value)\n}\n\nfunction clear() {\n commit(props.multiple ? [] : null)\n emit('clear')\n hide()\n focus()\n}\n\nconst fieldRef = useTemplateRef<HTMLElement>('field')\nconst inputRef = useTemplateRef<HTMLInputElement>('input')\nconst combobox = () => (filterable.value ? inputRef.value : fieldRef.value)\nfunction focus() {\n combobox()?.focus()\n}\n\nlet typed = ''\nlet typedTimer: ReturnType<typeof setTimeout> | undefined\n\nfunction onKeydown(event: KeyboardEvent) {\n if (locked.value || isComposing(event)) return\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n event.preventDefault()\n if (!open.value) show()\n else move(active.value, event.key === 'ArrowDown' ? 1 : -1)\n return\n case 'Home':\n case 'End':\n if (!open.value || filterable.value) return\n event.preventDefault()\n edge(event.key === 'Home' ? 'first' : 'last')\n return\n case 'Enter':\n event.preventDefault()\n if (open.value) choose(filtered.value[active.value])\n else show()\n return\n case ' ':\n if (filterable.value) return\n event.preventDefault()\n if (open.value) choose(filtered.value[active.value])\n else show()\n return\n case 'Tab':\n hide()\n return\n case 'Backspace':\n if (props.multiple && filterable.value && !query.value && selected.value.length) {\n remove(selected.value.at(-1)!)\n }\n return\n }\n\n // Without a search box, typing jumps to the next option starting with it.\n if (filterable.value || event.key.length !== 1 || event.ctrlKey || event.metaKey) return\n clearTimeout(typedTimer)\n typed += event.key.toLowerCase()\n typedTimer = setTimeout(() => (typed = ''), 500)\n show()\n const count = filtered.value.length\n for (let offset = typed.length > 1 ? 0 : 1; offset <= count; offset++) {\n const index = (active.value + offset) % count\n if (enabled(index) && labelOf(filtered.value[index]!).toLowerCase().startsWith(typed)) {\n active.value = index\n return\n }\n }\n}\n\nfunction onInput() {\n show()\n}\n\n// Pressing anywhere on the field toggles the list and keeps focus in it;\n// buttons inside (clear, tag removal) act on their own.\nfunction onFieldMousedown(event: MouseEvent) {\n if (locked.value) return\n const target = event.target as HTMLElement\n if (target.closest('button')) return\n if (target !== inputRef.value) event.preventDefault()\n focus()\n if (open.value && target !== inputRef.value) hide()\n else show()\n}\n\nfunction onBlur(event: FocusEvent) {\n const next = event.relatedTarget\n if (next instanceof Node && (fieldRef.value?.contains(next) || panelRef.value?.contains(next))) {\n return\n }\n hide()\n formItem?.trigger('blur')\n}\n\nconst comboboxAttrs = computed<HTMLAttributes>(() => ({\n role: 'combobox',\n 'aria-haspopup': 'listbox',\n 'aria-expanded': open.value,\n 'aria-controls': rendered.value ? listboxId : undefined,\n 'aria-activedescendant': open.value && active.value >= 0 ? optionId(active.value) : undefined,\n 'aria-disabled': disabled.value || undefined,\n 'aria-readonly': readonly.value || undefined,\n 'aria-invalid': invalid.value || undefined,\n 'aria-required': formItem?.required.value || undefined,\n 'aria-describedby': formItem?.describedBy.value,\n 'aria-label': props.ariaLabel,\n}))\n\nconst singleLabel = computed(() =>\n !props.multiple && selectedOptions.value[0] ? labelOf(selectedOptions.value[0]) : '',\n)\nconst placeholderText = computed(() => props.placeholder ?? t('select.placeholder'))\nconst inputPlaceholder = computed(() => {\n if (props.multiple) return hasValue.value ? '' : placeholderText.value\n return singleLabel.value || placeholderText.value\n})\n\nconst showClear = computed(() => props.clearable && !locked.value && hasValue.value)\nconst tagSize = computed(() => size.value)\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('multiple', props.multiple),\n ns.is('filterable', filterable.value),\n ns.is('open', open.value),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('selected', hasValue.value),\n])\n\ndefineExpose<SelectExpose>({ focus, blur: () => combobox()?.blur() })\n</script>\n\n<template>\n <OnlyChild ref=\"triggerRef\">\n <div\n ref=\"field\"\n v-bind=\"filterable ? $attrs : { ...$attrs, ...comboboxAttrs }\"\n :class=\"classes\"\n :id=\"filterable ? undefined : formItem?.inputId\"\n :aria-labelledby=\"filterable ? undefined : formItem?.labelId\"\n :tabindex=\"filterable || disabled ? undefined : 0\"\n @mousedown=\"onFieldMousedown\"\n @keydown=\"filterable ? undefined : onKeydown($event)\"\n @focusout=\"onBlur\"\n >\n <span v-if=\"slots.prefix\" :class=\"ns.e('prefix')\"><slot name=\"prefix\" /></span>\n <div :class=\"ns.e('selection')\">\n <template v-if=\"multiple\">\n <template v-for=\"option in shownTags\" :key=\"String(identity(option.value))\">\n <slot name=\"tag\" :option=\"option\" :remove=\"() => remove(option.value)\">\n <DouTag\n :size=\"tagSize\"\n :closable=\"!locked\"\n :class=\"ns.e('tag')\"\n @close=\"remove(option.value)\"\n >\n {{ labelOf(option) }}\n </DouTag>\n </slot>\n </template>\n <DouTag\n v-if=\"hiddenTags.length\"\n :size=\"tagSize\"\n :class=\"[ns.e('tag'), ns.e('tag-more')]\"\n :title=\"hiddenTags.map(labelOf).join('、')\"\n >\n +{{ hiddenTags.length }}\n </DouTag>\n </template>\n <input\n v-if=\"filterable\"\n ref=\"input\"\n v-model=\"query\"\n v-bind=\"comboboxAttrs\"\n :id=\"formItem?.inputId\"\n :class=\"ns.e('input')\"\n type=\"text\"\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n :placeholder=\"inputPlaceholder\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n @input=\"onInput\"\n @keydown=\"onKeydown\"\n />\n <span v-else-if=\"!multiple && hasValue\" :class=\"ns.e('value')\">\n <slot name=\"label\" :option=\"selectedOptions[0]!\">{{ singleLabel }}</slot>\n </span>\n <span v-else-if=\"!hasValue\" :class=\"ns.e('placeholder')\">{{ placeholderText }}</span>\n </div>\n <button\n v-if=\"showClear\"\n type=\"button\"\n tabindex=\"-1\"\n :class=\"ns.e('clear')\"\n :aria-label=\"t('select.clear')\"\n @mousedown.prevent\n @click=\"clear\"\n >\n <CloseIcon />\n </button>\n <ChevronDownIcon :class=\"ns.e('arrow')\" />\n </div>\n </OnlyChild>\n <Teleport v-if=\"rendered\" :to=\"teleportTarget.to\" :disabled=\"teleportTarget.disabled\">\n <Transition appear name=\"dou-floating\">\n <div\n v-show=\"open\"\n ref=\"panelRef\"\n :class=\"[ns.e('menu'), 'dou-floating', ns.is('virtual', isVirtual)]\"\n :style=\"panelStyle\"\n :data-placement=\"placement\"\n :data-dou-theme=\"theme\"\n @mousedown.prevent\n @scroll=\"isVirtual && (menuScroll = ($event.target as HTMLElement).scrollTop)\"\n >\n <div v-if=\"slots.header\" :class=\"ns.e('header')\"><slot name=\"header\" /></div>\n <div v-if=\"loading\" :class=\"ns.e('loading')\" role=\"status\">\n <DouSpinner size=\"sm\" :label=\"t('select.loading')\" />\n <span aria-hidden=\"true\">{{ t('select.loading') }}</span>\n </div>\n <ul\n v-else-if=\"isVirtual\"\n :id=\"listboxId\"\n role=\"listbox\"\n :class=\"ns.e('list')\"\n :style=\"{ height: `${rows.length * ROW}px` }\"\n :aria-multiselectable=\"multiple || undefined\"\n :aria-labelledby=\"formItem?.labelId\"\n >\n <template v-for=\"(row, offset) in virtualRows\" :key=\"row.key\">\n <li\n v-if=\"row.kind === 'group'\"\n role=\"presentation\"\n :class=\"[ns.e('group-label'), ns.is('separated', virtualRange.from + offset > 0)]\"\n :style=\"{ transform: `translateY(${(virtualRange.from + offset) * ROW}px)` }\"\n >\n {{ row.label }}\n </li>\n <li\n v-else\n :id=\"optionId(row.index)\"\n role=\"option\"\n :aria-selected=\"isSelected(row.option)\"\n :aria-disabled=\"unavailable(row.option) || undefined\"\n :aria-setsize=\"filtered.length\"\n :aria-posinset=\"row.index + 1\"\n :class=\"[\n ns.e('option'),\n ns.is('active', row.index === active),\n ns.is('selected', isSelected(row.option)),\n ns.is('disabled', unavailable(row.option)),\n ns.is('create', row.option === createOption),\n ]\"\n :style=\"{ transform: `translateY(${(virtualRange.from + offset) * ROW}px)` }\"\n @click=\"choose(row.option)\"\n @mousemove=\"!unavailable(row.option) && (active = row.index)\"\n >\n <span :class=\"ns.e('option-label')\">\n <slot name=\"option\" :option=\"row.option\" :selected=\"isSelected(row.option)\">\n {{ labelOf(row.option) }}\n </slot>\n </span>\n <CheckIcon v-if=\"isSelected(row.option)\" :class=\"ns.e('check')\" />\n </li>\n </template>\n </ul>\n <ul\n v-else\n :id=\"listboxId\"\n role=\"listbox\"\n :class=\"ns.e('list')\"\n :aria-multiselectable=\"multiple || undefined\"\n :aria-labelledby=\"formItem?.labelId\"\n >\n <li\n v-if=\"createOption\"\n :id=\"optionId(0)\"\n role=\"option\"\n :aria-selected=\"false\"\n :class=\"[ns.e('option'), ns.is('active', active === 0), ns.is('create', true)]\"\n @click=\"choose(createOption)\"\n @mousemove=\"active = 0\"\n >\n <span :class=\"ns.e('option-label')\">{{ labelOf(createOption) }}</span>\n </li>\n <li\n v-for=\"section in filteredSections\"\n :key=\"section.key\"\n role=\"presentation\"\n :class=\"ns.e('section')\"\n >\n <div\n v-if=\"section.label\"\n :id=\"`${id}-${section.key}`\"\n :class=\"ns.e('group-label')\"\n aria-hidden=\"true\"\n >\n {{ section.label }}\n </div>\n <ul\n :role=\"section.label ? 'group' : 'presentation'\"\n :aria-labelledby=\"section.label ? `${id}-${section.key}` : undefined\"\n :class=\"ns.e('group')\"\n >\n <li\n v-for=\"option in section.options\"\n :id=\"optionId(indexOf(option))\"\n :key=\"String(identity(option.value))\"\n role=\"option\"\n :aria-selected=\"isSelected(option)\"\n :aria-disabled=\"unavailable(option) || undefined\"\n :class=\"[\n ns.e('option'),\n ns.is('active', indexOf(option) === active),\n ns.is('selected', isSelected(option)),\n ns.is('disabled', unavailable(option)),\n ]\"\n @click=\"choose(option)\"\n @mousemove=\"!unavailable(option) && (active = indexOf(option))\"\n >\n <span :class=\"ns.e('option-label')\">\n <slot name=\"option\" :option=\"option\" :selected=\"isSelected(option)\">\n {{ labelOf(option) }}\n </slot>\n </span>\n <CheckIcon v-if=\"isSelected(option)\" :class=\"ns.e('check')\" />\n </li>\n </ul>\n </li>\n </ul>\n <div v-if=\"!loading && !filtered.length\" :class=\"ns.e('empty')\">\n <slot name=\"empty\">{{ t('select.empty') }}</slot>\n </div>\n <div v-if=\"slots.footer\" :class=\"ns.e('footer')\"><slot name=\"footer\" /></div>\n </div>\n </Transition>\n </Tele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A,QAAA,UAAA;QAFsB;QAAS,UAAU,WAAW,MAAM;OAAjE,SAEO,CADFG,gBAAAC,gBAAA,QAAQ,MAAM,CAAA,GAAA,CAAA,C,SAGJ,WAAW,MAAM,KAAlCb,UAAA,GAAAc,YAA8DV,MAAA,SAAA,GAAA;;QAAxB,OAAKI,eAAEJ,MAAA,EAAA,CAAE,CAAC,EAAC,OAAA,CAAA;;;;KAK7C,CAAA,QAAA,WAAO,CAAK,SAAA,MAAS,UAAjCJ,UAAA,GAAAC,mBAEM,OAAA;;MAFoC,OAAKO,eAAEJ,MAAA,EAAA,CAAE,CAAC,EAAC,OAAA,CAAA;K,IACnDK,WAAiD,KAAA,QAAA,SAAA,CAAA,SAAA,CAA3BG,gBAAAC,gBAAAT,MAAA,CAAA,CAAC,CAAA,cAAA,CAAA,GAAA,CAAA,C;KAEd,MAAM,UAAjBJ,UAAA,GAAAC,mBAA6E,OAAA;;MAAnD,OAAKO,eAAEJ,MAAA,EAAA,CAAE,CAAC,EAAC,QAAA,CAAA;K,IAAYK,WAAsB,KAAA,QAAA,QAAA,C;I,qBA/H/D,CAAAa,OAAA,KAAA,KAAI,C"}
1
+ {"version":3,"file":"select.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useModel","_useSlots","_openBlock","_createElementBlock","_Fragment","_createVNode","_unref","_withCtx","_createElementVNode","_mergeProps","_normalizeClass","_renderSlot","_createCommentVNode","_renderList","_createTextVNode","_toDisplayString","_createBlock","_withDirectives","_vModelText","_withModifiers","_Teleport","_Transition","_normalizeStyle","_vShow"],"sources":["../../../src/components/select/select.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CheckIcon, ChevronDownIcon, CloseIcon } from '@dou-ui/icons'\nimport { computed, nextTick, onBeforeUnmount, ref, useId, useTemplateRef, watch } from 'vue'\nimport type { HTMLAttributes } from 'vue'\nimport { usePopup } from '../../composables/use-popup'\nimport { isComposing } from '../../utils/keyboard'\nimport { useNamespace } from '../../utils/namespace'\nimport { shouldVirtualize } from '../../utils/virtual'\nimport { OnlyChild } from '../../utils/only-child'\nimport { useLocale } from '../config-provider/use-config'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport { DouSpinner } from '../spinner'\nimport { DouTag } from '../tag'\nimport type {\n SelectExpose,\n SelectOption,\n SelectOptionGroup,\n SelectProps,\n SelectSlots,\n SelectValue,\n} from './select'\nimport { useTeleport } from '../../utils/teleport'\n\ndefineOptions({ name: 'DouSelect', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n multiple: false,\n filterable: false,\n disabled: false,\n invalid: false,\n clearable: false,\n placement: 'bottom-start',\n teleport: undefined,\n remote: false,\n searchDelay: 300,\n loading: false,\n creatable: false,\n virtual: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\n// An explicit default stops Vue from reading a missing value as `false`.\nconst model = defineModel<SelectValue | SelectValue[] | null | undefined>({ default: undefined })\nconst emit = defineEmits<{\n change: [value: SelectValue | SelectValue[] | null]\n clear: []\n search: [query: string]\n create: [value: string]\n visibleChange: [open: boolean]\n removeTag: [value: SelectValue]\n}>()\nconst slots = defineSlots<SelectSlots>()\n\nconst ns = useNamespace('select')\nconst { t } = useLocale()\nconst { formItem } = useFormItem()\n// Searching remotely or creating options needs the search box.\nconst filterable = computed(() => props.filterable || props.remote || props.creatable)\n// A plain combobox is not labelable, so the item names it by id instead.\nif (!filterable.value) formItem?.markGroup()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\n// Read-only keeps the field focusable but never opens or changes it.\nconst locked = computed(() => disabled.value || readonly.value)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\n\nconst id = `dou-select-${useId()}`\nconst listboxId = `${id}-listbox`\nconst optionId = (index: number) => `${id}-option-${index}`\n\nconst toOption = (option: SelectOption | string | number): SelectOption =>\n typeof option === 'object' ? option : { value: option, label: String(option) }\nconst isGroup = (\n entry: SelectOption | SelectOptionGroup | string | number,\n): entry is SelectOptionGroup =>\n typeof entry === 'object' && Array.isArray((entry as SelectOptionGroup).options)\n\ninterface Section {\n key: string\n label?: string\n options: SelectOption[]\n}\n\n/** Options created from the search text, kept so they stay listed. */\nconst created = ref<SelectOption[]>([])\n\nconst sections = computed<Section[]>(() => {\n const result: Section[] = []\n let loose: Section | undefined\n for (const [index, entry] of props.options.entries()) {\n if (isGroup(entry)) {\n loose = undefined\n result.push({\n key: `group-${index}`,\n label: entry.label,\n options: entry.options.map((option) => {\n const normalized = toOption(option)\n return entry.disabled ? { ...normalized, disabled: true } : normalized\n }),\n })\n } else {\n if (!loose) result.push((loose = { key: `loose-${index}`, options: [] }))\n loose.options.push(toOption(entry))\n }\n }\n const known = new Set(result.flatMap((section) => section.options.map((o) => o.value)))\n const extra = created.value.filter((option) => !known.has(option.value))\n if (extra.length) result.push({ key: 'created', options: extra })\n return result\n})\nconst options = computed(() => sections.value.flatMap((section) => section.options))\nconst labelOf = (option: SelectOption) =>\n option.label ??\n (typeof option.value === 'object' ? String(identity(option.value)) : String(option.value))\n\n/** What tells values apart: the `valueKey` of an object, otherwise the value itself. */\nfunction identity(value: SelectValue): unknown {\n return props.valueKey && value !== null && typeof value === 'object'\n ? (value as Record<string, unknown>)[props.valueKey]\n : value\n}\nconst same = (a: SelectValue | null | undefined, b: SelectValue | null | undefined) =>\n a === b || (a != null && b != null && identity(a) === identity(b))\n\n// Remember every option seen, so a value chosen from earlier remote\n// results keeps its label after the options change.\nconst seen = new Map<unknown, SelectOption>()\nwatch(\n options,\n (list) => {\n for (const option of list) seen.set(identity(option.value), option)\n },\n { immediate: true },\n)\n\nconst selected = computed<SelectValue[]>(() => {\n const value = model.value\n if (props.multiple) return Array.isArray(value) ? value : []\n return value === null || value === undefined || Array.isArray(value) ? [] : [value]\n})\n// Looked up by identity, so long lists with many picks stay linear.\nconst selectedSet = computed(() => new Set(selected.value.map(identity)))\nconst isSelected = (option: SelectOption) => selectedSet.value.has(identity(option.value))\nconst optionById = computed(() => {\n const map = new Map<unknown, SelectOption>()\n for (const option of options.value) {\n const key = identity(option.value)\n if (!map.has(key)) map.set(key, option)\n }\n return map\n})\nconst selectedOptions = computed(() =>\n selected.value.map(\n (value) => optionById.value.get(identity(value)) ?? seen.get(identity(value)) ?? { value },\n ),\n)\nconst atLimit = computed(\n () => props.multiple && !!props.multipleLimit && selected.value.length >= props.multipleLimit,\n)\n/** Disabled, or out of reach because the limit is met. */\nconst unavailable = (option: SelectOption) =>\n !!option.disabled || (atLimit.value && !isSelected(option))\n\n// tags shown in the field, and how many more fold into \"+N\"\nconst shownTags = computed(() =>\n props.maxTagCount === undefined\n ? selectedOptions.value\n : selectedOptions.value.slice(0, Math.max(0, props.maxTagCount)),\n)\nconst hiddenTags = computed(() => selectedOptions.value.slice(shownTags.value.length))\nconst hasValue = computed(() => selected.value.length > 0)\n\nconst query = ref('')\nconst matches = (option: SelectOption, text: string) => labelOf(option).toLowerCase().includes(text)\nconst filteredSections = computed<Section[]>(() => {\n const text = query.value.trim().toLowerCase()\n if (!filterable.value || props.remote || !text) return sections.value\n return sections.value\n .map((section) => ({ ...section, options: section.options.filter((o) => matches(o, text)) }))\n .filter((section) => section.options.length > 0)\n})\n\n/** The pseudo-option that creates the typed text, when nothing matches it exactly. */\nconst createOption = computed<SelectOption | undefined>(() => {\n const text = query.value.trim()\n if (!props.creatable || !text) return undefined\n if (options.value.some((option) => labelOf(option) === text || same(option.value, text))) {\n return undefined\n }\n return { value: text, label: t('select.create', { query: text }) }\n})\n\n/** Every option the keyboard can reach, in list order. */\nconst filtered = computed<SelectOption[]>(() => [\n ...(createOption.value ? [createOption.value] : []),\n ...filteredSections.value.flatMap((section) => section.options),\n])\nconst indexes = computed(() => new Map(filtered.value.map((option, index) => [option, index])))\nconst indexOf = (option: SelectOption) => indexes.value.get(option) ?? -1\n\n// virtual list: every row (group label or option) is one option tall\nconst ROW = 32\ntype Row =\n | { kind: 'group'; key: string; label: string; id: string }\n | { kind: 'option'; key: string; option: SelectOption; index: number }\nconst rows = computed<Row[]>(() => {\n const result: Row[] = []\n if (createOption.value) {\n result.push({ kind: 'option', key: 'create', option: createOption.value, index: 0 })\n }\n for (const section of filteredSections.value) {\n if (section.label) {\n result.push({\n kind: 'group',\n key: section.key,\n label: section.label,\n id: `${id}-${section.key}`,\n })\n }\n for (const option of section.options) {\n result.push({\n kind: 'option',\n key: String(identity(option.value)),\n option,\n index: indexOf(option),\n })\n }\n }\n return result\n})\nconst menuScroll = ref(0)\nconst isVirtual = computed(() => shouldVirtualize(props.virtual, rows.value.length))\nconst virtualRange = computed(() => {\n const from = Math.max(0, Math.floor(menuScroll.value / ROW) - 4)\n return { from, to: Math.min(rows.value.length, from + Math.ceil(280 / ROW) + 8) }\n})\nconst virtualRows = computed(() => rows.value.slice(virtualRange.value.from, virtualRange.value.to))\n\nconst open = ref(false)\nconst popup = usePopup({\n open,\n trigger: 'manual',\n closeOnOutside: true,\n disabled: locked,\n placement: () => props.placement,\n offset: 4,\n sameWidth: true,\n})\nconst { triggerRef, panelRef, rendered, theme, placement, panelStyle } = popup\n\n// The highlighted option. Focus stays in the field; the list follows\n// through `aria-activedescendant`.\nconst active = ref(-1)\nconst enabled = (index: number) => !!filtered.value[index] && !unavailable(filtered.value[index]!)\n\nfunction move(from: number, step: 1 | -1) {\n const count = filtered.value.length\n for (let offset = 1; offset <= count; offset++) {\n const index = (((from + step * offset) % count) + count) % count\n if (enabled(index)) {\n active.value = index\n return\n }\n }\n}\nfunction edge(which: 'first' | 'last') {\n move(which === 'first' ? -1 : filtered.value.length, which === 'first' ? 1 : -1)\n}\n\nfunction show() {\n if (locked.value || open.value) return\n open.value = true\n const index = filtered.value.findIndex(isSelected)\n if (index >= 0 && enabled(index)) active.value = index\n else edge('first')\n}\nfunction hide() {\n open.value = false\n query.value = ''\n}\n\n// remote search: report the text once typing pauses, and on opening\nlet searchTimer: ReturnType<typeof setTimeout> | undefined\nwatch(query, (text) => {\n if (!props.remote || !open.value) return\n clearTimeout(searchTimer)\n searchTimer = setTimeout(() => emit('search', text), props.searchDelay)\n})\nonBeforeUnmount(() => clearTimeout(searchTimer))\n\n// Switching between full and virtual rendering keeps the scroll position.\nwatch(isVirtual, () => {\n void nextTick(() => (menuScroll.value = panelRef.value?.scrollTop ?? 0))\n})\n\nwatch(open, (value) => {\n emit('visibleChange', value)\n if (!value) query.value = ''\n else if (props.remote) emit('search', query.value)\n})\n// A parent that re-renders passes a new but equal list: only a different\n// list of options moves the highlight back to the top.\nwatch(\n () => filtered.value.map((option) => identity(option.value)),\n (next, prev) => {\n if (next.length === prev.length && next.every((value, index) => value === prev[index])) return\n if (open.value) edge('first')\n },\n)\nwatch(active, async (index) => {\n await nextTick()\n const menu = panelRef.value\n if (!menu) return\n if (isVirtual.value) {\n // The option may not be rendered yet: scroll by its row instead.\n const row = rows.value.findIndex((item) => item.kind === 'option' && item.index === index)\n if (row < 0) return\n const inset = 4\n const top = row * ROW + inset\n const current = menuScroll.value\n let target = current\n if (top < current) target = top - inset\n else if (top + ROW > current + menu.clientHeight) target = top + ROW - menu.clientHeight + inset\n // Render the rows around the target now, before the scroll event arrives.\n menuScroll.value = Math.max(0, target)\n menu.scrollTop = menuScroll.value\n return\n }\n menu.querySelector(`#${CSS.escape(optionId(index))}`)?.scrollIntoView?.({ block: 'nearest' })\n})\n\nfunction commit(value: SelectValue | SelectValue[] | null) {\n model.value = value\n emit('change', value)\n formItem?.trigger('change')\n}\n\nfunction choose(option: SelectOption | undefined) {\n if (!option || unavailable(option)) return\n if (option === createOption.value) {\n const value = String(option.value)\n option = { value, label: value }\n created.value = [...created.value, option]\n seen.set(value, option)\n emit('create', value)\n }\n if (props.multiple) {\n const chosen = option\n const values = isSelected(chosen)\n ? selected.value.filter((value) => !same(value, chosen.value))\n : [...selected.value, chosen.value]\n commit(values)\n query.value = ''\n } else {\n if (!same(option.value, model.value as SelectValue | null | undefined)) commit(option.value)\n hide()\n }\n}\n\nfunction remove(value: SelectValue) {\n if (locked.value) return\n commit(selected.value.filter((item) => !same(item, value)))\n emit('removeTag', value)\n}\n\nfunction clear() {\n commit(props.multiple ? [] : null)\n emit('clear')\n hide()\n focus()\n}\n\nconst fieldRef = useTemplateRef<HTMLElement>('field')\nconst inputRef = useTemplateRef<HTMLInputElement>('input')\nconst combobox = () => (filterable.value ? inputRef.value : fieldRef.value)\nfunction focus() {\n combobox()?.focus()\n}\n\nlet typed = ''\nlet typedTimer: ReturnType<typeof setTimeout> | undefined\n\nfunction onKeydown(event: KeyboardEvent) {\n if (locked.value || isComposing(event)) return\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n event.preventDefault()\n if (!open.value) show()\n else move(active.value, event.key === 'ArrowDown' ? 1 : -1)\n return\n case 'Home':\n case 'End':\n if (!open.value || filterable.value) return\n event.preventDefault()\n edge(event.key === 'Home' ? 'first' : 'last')\n return\n case 'Enter':\n event.preventDefault()\n if (open.value) choose(filtered.value[active.value])\n else show()\n return\n case ' ':\n if (filterable.value) return\n event.preventDefault()\n if (open.value) choose(filtered.value[active.value])\n else show()\n return\n case 'Tab':\n hide()\n return\n case 'Backspace':\n if (props.multiple && filterable.value && !query.value && selected.value.length) {\n remove(selected.value.at(-1)!)\n }\n return\n }\n\n // Without a search box, typing jumps to the next option starting with it.\n if (filterable.value || event.key.length !== 1 || event.ctrlKey || event.metaKey) return\n clearTimeout(typedTimer)\n typed += event.key.toLowerCase()\n typedTimer = setTimeout(() => (typed = ''), 500)\n show()\n const count = filtered.value.length\n for (let offset = typed.length > 1 ? 0 : 1; offset <= count; offset++) {\n const index = (active.value + offset) % count\n if (enabled(index) && labelOf(filtered.value[index]!).toLowerCase().startsWith(typed)) {\n active.value = index\n return\n }\n }\n}\n\nfunction onInput() {\n show()\n}\n\n// Pressing anywhere on the field toggles the list and keeps focus in it;\n// buttons inside (clear, tag removal) act on their own.\nfunction onFieldMousedown(event: MouseEvent) {\n if (locked.value) return\n const target = event.target as HTMLElement\n if (target.closest('button')) return\n if (target !== inputRef.value) event.preventDefault()\n focus()\n if (open.value && target !== inputRef.value) hide()\n else show()\n}\n\nfunction onBlur(event: FocusEvent) {\n const next = event.relatedTarget\n if (next instanceof Node && (fieldRef.value?.contains(next) || panelRef.value?.contains(next))) {\n return\n }\n hide()\n formItem?.trigger('blur')\n}\n\nconst comboboxAttrs = computed<HTMLAttributes>(() => ({\n role: 'combobox',\n 'aria-haspopup': 'listbox',\n 'aria-expanded': open.value,\n 'aria-controls': rendered.value ? listboxId : undefined,\n 'aria-activedescendant': open.value && active.value >= 0 ? optionId(active.value) : undefined,\n 'aria-disabled': disabled.value || undefined,\n 'aria-readonly': readonly.value || undefined,\n 'aria-invalid': invalid.value || undefined,\n 'aria-required': formItem?.required.value || undefined,\n 'aria-describedby': formItem?.describedBy.value,\n 'aria-label': props.ariaLabel,\n}))\n\nconst singleLabel = computed(() =>\n !props.multiple && selectedOptions.value[0] ? labelOf(selectedOptions.value[0]) : '',\n)\nconst placeholderText = computed(() => props.placeholder ?? t('select.placeholder'))\nconst inputPlaceholder = computed(() => {\n if (props.multiple) return hasValue.value ? '' : placeholderText.value\n return singleLabel.value || placeholderText.value\n})\n\nconst showClear = computed(() => props.clearable && !locked.value && hasValue.value)\nconst tagSize = computed(() => size.value)\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('multiple', props.multiple),\n ns.is('filterable', filterable.value),\n ns.is('open', open.value),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('selected', hasValue.value),\n])\n\ndefineExpose<SelectExpose>({ focus, blur: () => combobox()?.blur() })\n</script>\n\n<template>\n <OnlyChild ref=\"triggerRef\">\n <div\n ref=\"field\"\n v-bind=\"filterable ? $attrs : { ...$attrs, ...comboboxAttrs }\"\n :class=\"classes\"\n :id=\"filterable ? undefined : formItem?.inputId\"\n :aria-labelledby=\"filterable ? undefined : formItem?.labelId\"\n :tabindex=\"filterable || disabled ? undefined : 0\"\n @mousedown=\"onFieldMousedown\"\n @keydown=\"filterable ? undefined : onKeydown($event)\"\n @focusout=\"onBlur\"\n >\n <span v-if=\"slots.prefix\" :class=\"ns.e('prefix')\"><slot name=\"prefix\" /></span>\n <div :class=\"ns.e('selection')\">\n <template v-if=\"multiple\">\n <template v-for=\"option in shownTags\" :key=\"String(identity(option.value))\">\n <slot name=\"tag\" :option=\"option\" :remove=\"() => remove(option.value)\">\n <DouTag\n :size=\"tagSize\"\n :closable=\"!locked\"\n :class=\"ns.e('tag')\"\n @close=\"remove(option.value)\"\n >\n {{ labelOf(option) }}\n </DouTag>\n </slot>\n </template>\n <DouTag\n v-if=\"hiddenTags.length\"\n :size=\"tagSize\"\n :class=\"[ns.e('tag'), ns.e('tag-more')]\"\n :title=\"hiddenTags.map(labelOf).join('、')\"\n >\n +{{ hiddenTags.length }}\n </DouTag>\n </template>\n <input\n v-if=\"filterable\"\n ref=\"input\"\n v-model=\"query\"\n v-bind=\"comboboxAttrs\"\n :id=\"formItem?.inputId\"\n :class=\"ns.e('input')\"\n type=\"text\"\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n :placeholder=\"inputPlaceholder\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n @input=\"onInput\"\n @keydown=\"onKeydown\"\n />\n <span v-else-if=\"!multiple && hasValue\" :class=\"ns.e('value')\">\n <slot name=\"label\" :option=\"selectedOptions[0]!\">{{ singleLabel }}</slot>\n </span>\n <span v-else-if=\"!hasValue\" :class=\"ns.e('placeholder')\">{{ placeholderText }}</span>\n </div>\n <button\n v-if=\"showClear\"\n type=\"button\"\n tabindex=\"-1\"\n :class=\"ns.e('clear')\"\n :aria-label=\"t('select.clear')\"\n @mousedown.prevent\n @click=\"clear\"\n >\n <CloseIcon />\n </button>\n <ChevronDownIcon :class=\"ns.e('arrow')\" />\n </div>\n </OnlyChild>\n <Teleport v-if=\"rendered\" :to=\"teleportTarget.to\" :disabled=\"teleportTarget.disabled\">\n <Transition appear name=\"dou-floating\">\n <div\n v-show=\"open\"\n ref=\"panelRef\"\n :class=\"[ns.e('menu'), 'dou-floating', ns.is('virtual', isVirtual)]\"\n :style=\"panelStyle\"\n :data-placement=\"placement\"\n :data-dou-theme=\"theme\"\n @mousedown.prevent\n @scroll=\"isVirtual && (menuScroll = ($event.target as HTMLElement).scrollTop)\"\n >\n <div v-if=\"slots.header\" :class=\"ns.e('header')\"><slot name=\"header\" /></div>\n <div v-if=\"loading\" :class=\"ns.e('loading')\" role=\"status\">\n <DouSpinner size=\"sm\" :label=\"t('select.loading')\" />\n <span aria-hidden=\"true\">{{ t('select.loading') }}</span>\n </div>\n <ul\n v-else-if=\"isVirtual\"\n :id=\"listboxId\"\n role=\"listbox\"\n :class=\"ns.e('list')\"\n :style=\"{ height: `${rows.length * ROW}px` }\"\n :aria-multiselectable=\"multiple || undefined\"\n :aria-labelledby=\"formItem?.labelId\"\n >\n <template v-for=\"(row, offset) in virtualRows\" :key=\"row.key\">\n <li\n v-if=\"row.kind === 'group'\"\n role=\"presentation\"\n :class=\"[ns.e('group-label'), ns.is('separated', virtualRange.from + offset > 0)]\"\n :style=\"{ transform: `translateY(${(virtualRange.from + offset) * ROW}px)` }\"\n >\n {{ row.label }}\n </li>\n <li\n v-else\n :id=\"optionId(row.index)\"\n role=\"option\"\n :aria-selected=\"isSelected(row.option)\"\n :aria-disabled=\"unavailable(row.option) || undefined\"\n :aria-setsize=\"filtered.length\"\n :aria-posinset=\"row.index + 1\"\n :class=\"[\n ns.e('option'),\n ns.is('active', row.index === active),\n ns.is('selected', isSelected(row.option)),\n ns.is('disabled', unavailable(row.option)),\n ns.is('create', row.option === createOption),\n ]\"\n :style=\"{ transform: `translateY(${(virtualRange.from + offset) * ROW}px)` }\"\n @click=\"choose(row.option)\"\n @mousemove=\"!unavailable(row.option) && (active = row.index)\"\n >\n <span :class=\"ns.e('option-label')\">\n <slot name=\"option\" :option=\"row.option\" :selected=\"isSelected(row.option)\">\n {{ labelOf(row.option) }}\n </slot>\n </span>\n <CheckIcon v-if=\"isSelected(row.option)\" :class=\"ns.e('check')\" />\n </li>\n </template>\n </ul>\n <ul\n v-else\n :id=\"listboxId\"\n role=\"listbox\"\n :class=\"ns.e('list')\"\n :aria-multiselectable=\"multiple || undefined\"\n :aria-labelledby=\"formItem?.labelId\"\n >\n <li\n v-if=\"createOption\"\n :id=\"optionId(0)\"\n role=\"option\"\n :aria-selected=\"false\"\n :class=\"[ns.e('option'), ns.is('active', active === 0), ns.is('create', true)]\"\n @click=\"choose(createOption)\"\n @mousemove=\"active = 0\"\n >\n <span :class=\"ns.e('option-label')\">{{ labelOf(createOption) }}</span>\n </li>\n <li\n v-for=\"section in filteredSections\"\n :key=\"section.key\"\n role=\"presentation\"\n :class=\"ns.e('section')\"\n >\n <div\n v-if=\"section.label\"\n :id=\"`${id}-${section.key}`\"\n :class=\"ns.e('group-label')\"\n aria-hidden=\"true\"\n >\n {{ section.label }}\n </div>\n <ul\n :role=\"section.label ? 'group' : 'presentation'\"\n :aria-labelledby=\"section.label ? `${id}-${section.key}` : undefined\"\n :class=\"ns.e('group')\"\n >\n <li\n v-for=\"option in section.options\"\n :id=\"optionId(indexOf(option))\"\n :key=\"String(identity(option.value))\"\n role=\"option\"\n :aria-selected=\"isSelected(option)\"\n :aria-disabled=\"unavailable(option) || undefined\"\n :class=\"[\n ns.e('option'),\n ns.is('active', indexOf(option) === active),\n ns.is('selected', isSelected(option)),\n ns.is('disabled', unavailable(option)),\n ]\"\n @click=\"choose(option)\"\n @mousemove=\"!unavailable(option) && (active = indexOf(option))\"\n >\n <span :class=\"ns.e('option-label')\">\n <slot name=\"option\" :option=\"option\" :selected=\"isSelected(option)\">\n {{ labelOf(option) }}\n </slot>\n </span>\n <CheckIcon v-if=\"isSelected(option)\" :class=\"ns.e('check')\" />\n </li>\n </ul>\n </li>\n </ul>\n <div v-if=\"!loading && !filtered.length\" :class=\"ns.e('empty')\">\n <slot name=\"empty\">{{ t('select.empty') }}</slot>\n </div>\n <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EAJA,OAAKE,eAAEJ,MAAA,EAAA,CAAE,CAAC,EAAC,cAAA,CAAA,E,IAChBK,WAEO,KAAA,QAAA,UAAA;QAFsB;QAAS,UAAU,WAAW,MAAM;OAAjE,SAEO,CADFG,gBAAAC,gBAAA,QAAQ,MAAM,CAAA,GAAA,CAAA,C,SAGJ,WAAW,MAAM,KAAlCb,UAAA,GAAAc,YAA8DV,MAAA,SAAA,GAAA;;QAAxB,OAAKI,eAAEJ,MAAA,EAAA,CAAE,CAAC,EAAC,OAAA,CAAA;;;;KAK7C,CAAA,QAAA,WAAO,CAAK,SAAA,MAAS,UAAjCJ,UAAA,GAAAC,mBAEM,OAAA;;MAFoC,OAAKO,eAAEJ,MAAA,EAAA,CAAE,CAAC,EAAC,OAAA,CAAA;K,IACnDK,WAAiD,KAAA,QAAA,SAAA,CAAA,SAAA,CAA3BG,gBAAAC,gBAAAT,MAAA,CAAA,CAAC,CAAA,cAAA,CAAA,GAAA,CAAA,C;KAEd,MAAM,UAAjBJ,UAAA,GAAAC,mBAA6E,OAAA;;MAAnD,OAAKO,eAAEJ,MAAA,EAAA,CAAE,CAAC,EAAC,QAAA,CAAA;K,IAAYK,WAAsB,KAAA,QAAA,QAAA,C;I,qBA/H/D,CAAAY,OAAA,KAAA,KAAI,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"slider.js","names":["_sfc_main"],"sources":["../../../src/components/slider/slider.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, provide, ref, useAttrs, useTemplateRef } from 'vue'\nimport type { StyleValue } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { useLocale } from '../config-provider/use-config'\nimport { formItemKey } from '../form/form'\nimport type { FormItemContext } from '../form/form'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport DouInputNumber from '../input-number/input-number.vue'\nimport type { SliderExpose, SliderProps, SliderValue } from './slider'\n\ndefineOptions({ name: 'DouSlider', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<SliderProps>(), {\n range: false,\n min: 0,\n max: 100,\n step: 1,\n disabled: false,\n invalid: false,\n vertical: false,\n showInput: false,\n tooltip: false,\n})\nconst model = defineModel<SliderValue>()\nconst emit = defineEmits<{ change: [value: SliderValue] }>()\n\nconst ns = useNamespace('slider')\nconst { t } = useLocale()\nconst { formItem } = useFormItem()\n// The thumbs are not labelable elements, so the item labels them by id.\nformItem?.markGroup()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\n// The number input is part of the slider, not a second field of the form item.\nprovide(formItemKey, undefined as unknown as FormItemContext)\n\n// `aria-label` and `aria-labelledby` name the thumb of a single slider;\n// everything else dresses the root.\nconst attrs = useAttrs()\nconst rootAttrs = computed(() => {\n if (props.range) return attrs\n const { 'aria-label': _label, 'aria-labelledby': _labelledby, ...rest } = attrs\n return rest\n})\n\nconst railRef = useTemplateRef<HTMLElement>('rail')\n\nconst thumbEl = (index: number) =>\n railRef.value?.querySelector<HTMLElement>(`[data-index=\"${index}\"]`) ?? undefined\n\nfunction decimals(value: number) {\n const [digits = '', exponent] = String(value).split('e')\n const fraction = digits.split('.')[1]?.length ?? 0\n return Math.max(0, fraction - Number(exponent ?? 0))\n}\n\n/** Snap to the nearest step and keep within `[lower, upper]`. */\nfunction snap(value: number, lower = props.min, upper = props.max) {\n const steps = Math.round((value - props.min) / props.step)\n const snapped = Number((props.min + steps * props.step).toFixed(decimals(props.step)))\n return Math.min(Math.max(snapped, lower), upper)\n}\n\nconst values = computed<number[]>(() => {\n const value = model.value\n if (props.range) {\n const [a = props.min, b = props.max] = Array.isArray(value) ? value : [props.min, value]\n return [snap(Math.min(a, b)), snap(Math.max(a, b))]\n }\n return [snap(Array.isArray(value) ? value[0] : (value ?? props.min))]\n})\n\nconst span = computed(() => props.max - props.min || 1)\nconst percent = (value: number) => ((value - props.min) / span.value) * 100\n\n/** Where along the track: from the left, or from the bottom when vertical. */\nconst along = (at: number) => (props.vertical ? { bottom: `${at}%` } : { left: `${at}%` })\n\nconst fillStyle = computed(() => {\n const [first = props.min, second] = values.value\n const start = second === undefined ? 0 : percent(first)\n const end = percent(second ?? first)\n return props.vertical\n ? { bottom: `${start}%`, height: `${end - start}%` }\n : { left: `${start}%`, width: `${end - start}%` }\n})\n\nconst marks = computed(() => {\n const list = Object.entries(props.marks ?? {})\n .map(([key, label]) => ({ value: Number(key), label }))\n .filter((mark) => mark.value >= props.min && mark.value <= props.max)\n // `list` is a fresh array, sorting it in place is safe.\n // oxlint-disable-next-line unicorn/no-array-sort\n return list.sort((a, b) => a.value - b.value)\n})\n\n// The rail's rounded ends already mark the bounds.\nconst innerMarks = computed(() =>\n marks.value.filter((mark) => mark.value > props.min && mark.value < props.max),\n)\n\nfunction inFill(value: number) {\n const [first = props.min, second] = values.value\n return second === undefined ? value <= first : value >= first && value <= second\n}\n\n/** Where a thumb may go without passing the other one. */\nfunction bounds(index: number): [number, number] {\n if (!props.range) return [props.min, props.max]\n const [first = props.min, second = props.max] = values.value\n return index === 0 ? [props.min, second] : [first, props.max]\n}\n\n// The value last set, as a bound model only updates once the parent re-renders.\nlet latest: SliderValue | undefined\n\nfunction set(index: number, value: number) {\n const next = [...values.value]\n next[index] = snap(value, ...bounds(index))\n if (next[index] === values.value[index] && model.value !== undefined) return false\n latest = props.range ? [next[0]!, next[1]!] : next[0]!\n model.value = latest\n return true\n}\n\nfunction commit() {\n const value = latest ?? model.value\n if (value === undefined) return\n emit('change', value)\n formItem?.trigger('change')\n}\n\n// Pointer: pressing the rail moves the nearest thumb there, and the\n// thumb follows the pointer until it is released.\nconst active = ref<number | null>(null)\nlet moved = false\n\nfunction valueAt(event: PointerEvent) {\n const rect = railRef.value?.getBoundingClientRect()\n if (!rect) return props.min\n const ratio = props.vertical\n ? rect.height && (rect.bottom - event.clientY) / rect.height\n : rect.width && (event.clientX - rect.left) / rect.width\n return props.min + Math.min(Math.max(ratio, 0), 1) * span.value\n}\n\nfunction nearest(value: number) {\n const [first = props.min, second] = values.value\n if (second === undefined) return 0\n if (first === second) return value > first ? 1 : 0\n return Math.abs(value - first) <= Math.abs(value - second) ? 0 : 1\n}\n\nfunction onPointerdown(event: PointerEvent) {\n if (disabled.value || readonly.value || event.button !== 0) return\n event.preventDefault()\n const value = valueAt(event)\n const thumb = (event.target as HTMLElement).closest<HTMLElement>('[data-index]')\n const index = thumb ? Number(thumb.dataset.index) : nearest(value)\n active.value = index\n // Pressing a thumb grabs it where it is; pressing the rail jumps.\n moved = thumb ? false : set(index, value)\n thumbEl(index)?.focus()\n railRef.value?.setPointerCapture?.(event.pointerId)\n}\n\nfunction onPointermove(event: PointerEvent) {\n if (active.value === null) return\n const value = valueAt(event)\n // Two thumbs on the same spot: the one that can go where the pointer\n // heads takes over.\n const [first, second] = values.value\n if (props.range && first === second && value !== first) {\n active.value = value < first! ? 0 : 1\n thumbEl(active.value)?.focus()\n }\n if (set(active.value, value)) moved = true\n}\n\nfunction onPointerup(event: PointerEvent) {\n if (active.value === null) return\n railRef.value?.releasePointerCapture?.(event.pointerId)\n active.value = null\n if (moved) commit()\n}\n\nfunction onKeydown(event: KeyboardEvent, index: number) {\n if (disabled.value || readonly.value) return\n const value = values.value[index] ?? props.min\n const page = Math.max(props.step, Math.round(span.value / 10 / props.step) * props.step)\n const targets: Record<string, number> = {\n ArrowRight: value + props.step,\n ArrowUp: value + props.step,\n ArrowLeft: value - props.step,\n ArrowDown: value - props.step,\n PageUp: value + page,\n PageDown: value - page,\n Home: props.min,\n End: props.max,\n }\n if (!(event.key in targets)) return\n event.preventDefault()\n if (set(index, targets[event.key]!)) commit()\n}\n\nconst groupLabelledBy = computed(\n () => (attrs['aria-labelledby'] as string | undefined) ?? formItem?.labelId,\n)\n\nfunction onInput(value: number | null) {\n if (value === null || Number.isNaN(value)) return\n if (set(0, value)) commit()\n}\n\nconst describe = (value: number) => (props.format ? props.format(value) : undefined)\n\nconst thumbs = computed(() =>\n values.value.map((value, index) => {\n const [lower, upper] = bounds(index)\n return {\n value,\n index,\n style: along(percent(value)),\n min: lower,\n max: upper,\n label: props.range\n ? t(index === 0 ? 'slider.start' : 'slider.end')\n : (attrs['aria-label'] as string | undefined),\n labelledBy: props.range\n ? undefined\n : ((attrs['aria-labelledby'] as string | undefined) ?? formItem?.labelId),\n }\n }),\n)\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('range', props.range),\n ns.is('vertical', props.vertical),\n ns.is('with-input', props.showInput && !props.range),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('dragging', active.value !== null),\n ns.is(\n 'marked',\n marks.value.some((mark) => mark.label),\n ),\n attrs.class,\n])\n\ndefineExpose<SliderExpose>({\n focus: () => thumbEl(0)?.focus(),\n blur: () => {\n const focused = document.activeElement\n if (focused instanceof HTMLElement && railRef.value?.contains(focused)) focused.blur()\n },\n})\n</script>\n\n<template>\n <div\n v-bind=\"rootAttrs\"\n :class=\"classes\"\n :style=\"[\n vertical && height !== undefined\n ? { height: typeof height === 'number' ? `${height}px` : height }\n : undefined,\n attrs.style as StyleValue,\n ]\"\n :role=\"range ? 'group' : undefined\"\n :aria-labelledby=\"range ? groupLabelledBy : undefined\"\n >\n <div :class=\"ns.e('body')\">\n <div\n ref=\"rail\"\n :class=\"ns.e('rail')\"\n @pointerdown=\"onPointerdown\"\n @pointermove=\"onPointermove\"\n @pointerup=\"onPointerup\"\n @pointercancel=\"onPointerup\"\n @lostpointercapture=\"onPointerup\"\n >\n <div :class=\"ns.e('fill')\" :style=\"fillStyle\" />\n <span\n v-for=\"mark in innerMarks\"\n :key=\"mark.value\"\n :class=\"[ns.e('dot'), ns.is('active', inFill(mark.value))]\"\n :style=\"along(percent(mark.value))\"\n aria-hidden=\"true\"\n />\n <div\n v-for=\"thumb in thumbs\"\n :key=\"thumb.index\"\n :id=\"thumb.index === 0 ? formItem?.inputId : undefined\"\n :class=\"[\n ns.e('thumb'),\n ns.is('active', active === thumb.index),\n ns.is('pinned', tooltip === 'always'),\n ]\"\n :style=\"thumb.style\"\n :data-index=\"thumb.index\"\n role=\"slider\"\n :tabindex=\"disabled ? -1 : 0\"\n :aria-orientation=\"vertical ? 'vertical' : 'horizontal'\"\n :aria-valuenow=\"thumb.value\"\n :aria-valuemin=\"thumb.min\"\n :aria-valuemax=\"thumb.max\"\n :aria-valuetext=\"describe(thumb.value)\"\n :aria-label=\"thumb.label\"\n :aria-labelledby=\"thumb.labelledBy\"\n :aria-describedby=\"formItem?.describedBy.value\"\n :aria-disabled=\"disabled || undefined\"\n :aria-readonly=\"readonly || undefined\"\n :aria-invalid=\"invalid || undefined\"\n @keydown=\"onKeydown($event, thumb.index)\"\n >\n <span v-if=\"tooltip\" :class=\"ns.e('tooltip')\" aria-hidden=\"true\">\n {{ describe(thumb.value) ?? thumb.value }}\n </span>\n </div>\n </div>\n <div v-if=\"marks.length\" :class=\"ns.e('marks')\" aria-hidden=\"true\">\n <span\n v-for=\"mark in marks\"\n :key=\"mark.value\"\n :class=\"[ns.e('mark'), ns.is('active', inFill(mark.value))]\"\n :style=\"along(percent(mark.value))\"\n >\n {{ mark.label }}\n </span>\n </div>\n </div>\n <DouInputNumber\n v-if=\"showInput && !range\"\n :class=\"ns.e('input')\"\n :model-value=\"values[0]\"\n :min=\"min\"\n :max=\"max\"\n :step=\"step\"\n :size=\"size\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :invalid=\"invalid\"\n :aria-label=\"thumbs[0]?.label\"\n :aria-labelledby=\"thumbs[0]?.labelledBy\"\n @update:model-value=\"onInput\"\n />\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"slider.js","names":["_sfc_main"],"sources":["../../../src/components/slider/slider.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, provide, ref, useAttrs, useTemplateRef } from 'vue'\nimport type { StyleValue } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { useLocale } from '../config-provider/use-config'\nimport { formItemKey } from '../form/form'\nimport type { FormItemContext } from '../form/form'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport { DouInputNumber } from '../input-number'\nimport type { SliderExpose, SliderProps, SliderValue } from './slider'\n\ndefineOptions({ name: 'DouSlider', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<SliderProps>(), {\n range: false,\n min: 0,\n max: 100,\n step: 1,\n disabled: false,\n invalid: false,\n vertical: false,\n showInput: false,\n tooltip: false,\n})\nconst model = defineModel<SliderValue>()\nconst emit = defineEmits<{ change: [value: SliderValue] }>()\n\nconst ns = useNamespace('slider')\nconst { t } = useLocale()\nconst { formItem } = useFormItem()\n// The thumbs are not labelable elements, so the item labels them by id.\nformItem?.markGroup()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\n// The number input is part of the slider, not a second field of the form item.\nprovide(formItemKey, undefined as unknown as FormItemContext)\n\n// `aria-label` and `aria-labelledby` name the thumb of a single slider;\n// everything else dresses the root.\nconst attrs = useAttrs()\nconst rootAttrs = computed(() => {\n if (props.range) return attrs\n const { 'aria-label': _label, 'aria-labelledby': _labelledby, ...rest } = attrs\n return rest\n})\n\nconst railRef = useTemplateRef<HTMLElement>('rail')\n\nconst thumbEl = (index: number) =>\n railRef.value?.querySelector<HTMLElement>(`[data-index=\"${index}\"]`) ?? undefined\n\nfunction decimals(value: number) {\n const [digits = '', exponent] = String(value).split('e')\n const fraction = digits.split('.')[1]?.length ?? 0\n return Math.max(0, fraction - Number(exponent ?? 0))\n}\n\n/** Snap to the nearest step and keep within `[lower, upper]`. */\nfunction snap(value: number, lower = props.min, upper = props.max) {\n const steps = Math.round((value - props.min) / props.step)\n const snapped = Number((props.min + steps * props.step).toFixed(decimals(props.step)))\n return Math.min(Math.max(snapped, lower), upper)\n}\n\nconst values = computed<number[]>(() => {\n const value = model.value\n if (props.range) {\n const [a = props.min, b = props.max] = Array.isArray(value) ? value : [props.min, value]\n return [snap(Math.min(a, b)), snap(Math.max(a, b))]\n }\n return [snap(Array.isArray(value) ? value[0] : (value ?? props.min))]\n})\n\nconst span = computed(() => props.max - props.min || 1)\nconst percent = (value: number) => ((value - props.min) / span.value) * 100\n\n/** Where along the track: from the left, or from the bottom when vertical. */\nconst along = (at: number) => (props.vertical ? { bottom: `${at}%` } : { left: `${at}%` })\n\nconst fillStyle = computed(() => {\n const [first = props.min, second] = values.value\n const start = second === undefined ? 0 : percent(first)\n const end = percent(second ?? first)\n return props.vertical\n ? { bottom: `${start}%`, height: `${end - start}%` }\n : { left: `${start}%`, width: `${end - start}%` }\n})\n\nconst marks = computed(() => {\n const list = Object.entries(props.marks ?? {})\n .map(([key, label]) => ({ value: Number(key), label }))\n .filter((mark) => mark.value >= props.min && mark.value <= props.max)\n // `list` is a fresh array, sorting it in place is safe.\n // oxlint-disable-next-line unicorn/no-array-sort\n return list.sort((a, b) => a.value - b.value)\n})\n\n// The rail's rounded ends already mark the bounds.\nconst innerMarks = computed(() =>\n marks.value.filter((mark) => mark.value > props.min && mark.value < props.max),\n)\n\nfunction inFill(value: number) {\n const [first = props.min, second] = values.value\n return second === undefined ? value <= first : value >= first && value <= second\n}\n\n/** Where a thumb may go without passing the other one. */\nfunction bounds(index: number): [number, number] {\n if (!props.range) return [props.min, props.max]\n const [first = props.min, second = props.max] = values.value\n return index === 0 ? [props.min, second] : [first, props.max]\n}\n\n// The value last set, as a bound model only updates once the parent re-renders.\nlet latest: SliderValue | undefined\n\nfunction set(index: number, value: number) {\n const next = [...values.value]\n next[index] = snap(value, ...bounds(index))\n if (next[index] === values.value[index] && model.value !== undefined) return false\n latest = props.range ? [next[0]!, next[1]!] : next[0]!\n model.value = latest\n return true\n}\n\nfunction commit() {\n const value = latest ?? model.value\n if (value === undefined) return\n emit('change', value)\n formItem?.trigger('change')\n}\n\n// Pointer: pressing the rail moves the nearest thumb there, and the\n// thumb follows the pointer until it is released.\nconst active = ref<number | null>(null)\nlet moved = false\n\nfunction valueAt(event: PointerEvent) {\n const rect = railRef.value?.getBoundingClientRect()\n if (!rect) return props.min\n const ratio = props.vertical\n ? rect.height && (rect.bottom - event.clientY) / rect.height\n : rect.width && (event.clientX - rect.left) / rect.width\n return props.min + Math.min(Math.max(ratio, 0), 1) * span.value\n}\n\nfunction nearest(value: number) {\n const [first = props.min, second] = values.value\n if (second === undefined) return 0\n if (first === second) return value > first ? 1 : 0\n return Math.abs(value - first) <= Math.abs(value - second) ? 0 : 1\n}\n\nfunction onPointerdown(event: PointerEvent) {\n if (disabled.value || readonly.value || event.button !== 0) return\n event.preventDefault()\n const value = valueAt(event)\n const thumb = (event.target as HTMLElement).closest<HTMLElement>('[data-index]')\n const index = thumb ? Number(thumb.dataset.index) : nearest(value)\n active.value = index\n // Pressing a thumb grabs it where it is; pressing the rail jumps.\n moved = thumb ? false : set(index, value)\n thumbEl(index)?.focus()\n railRef.value?.setPointerCapture?.(event.pointerId)\n}\n\nfunction onPointermove(event: PointerEvent) {\n if (active.value === null) return\n const value = valueAt(event)\n // Two thumbs on the same spot: the one that can go where the pointer\n // heads takes over.\n const [first, second] = values.value\n if (props.range && first === second && value !== first) {\n active.value = value < first! ? 0 : 1\n thumbEl(active.value)?.focus()\n }\n if (set(active.value, value)) moved = true\n}\n\nfunction onPointerup(event: PointerEvent) {\n if (active.value === null) return\n railRef.value?.releasePointerCapture?.(event.pointerId)\n active.value = null\n if (moved) commit()\n}\n\nfunction onKeydown(event: KeyboardEvent, index: number) {\n if (disabled.value || readonly.value) return\n const value = values.value[index] ?? props.min\n const page = Math.max(props.step, Math.round(span.value / 10 / props.step) * props.step)\n const targets: Record<string, number> = {\n ArrowRight: value + props.step,\n ArrowUp: value + props.step,\n ArrowLeft: value - props.step,\n ArrowDown: value - props.step,\n PageUp: value + page,\n PageDown: value - page,\n Home: props.min,\n End: props.max,\n }\n if (!(event.key in targets)) return\n event.preventDefault()\n if (set(index, targets[event.key]!)) commit()\n}\n\nconst groupLabelledBy = computed(\n () => (attrs['aria-labelledby'] as string | undefined) ?? formItem?.labelId,\n)\n\nfunction onInput(value: number | null) {\n if (value === null || Number.isNaN(value)) return\n if (set(0, value)) commit()\n}\n\nconst describe = (value: number) => (props.format ? props.format(value) : undefined)\n\nconst thumbs = computed(() =>\n values.value.map((value, index) => {\n const [lower, upper] = bounds(index)\n return {\n value,\n index,\n style: along(percent(value)),\n min: lower,\n max: upper,\n label: props.range\n ? t(index === 0 ? 'slider.start' : 'slider.end')\n : (attrs['aria-label'] as string | undefined),\n labelledBy: props.range\n ? undefined\n : ((attrs['aria-labelledby'] as string | undefined) ?? formItem?.labelId),\n }\n }),\n)\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('range', props.range),\n ns.is('vertical', props.vertical),\n ns.is('with-input', props.showInput && !props.range),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('dragging', active.value !== null),\n ns.is(\n 'marked',\n marks.value.some((mark) => mark.label),\n ),\n attrs.class,\n])\n\ndefineExpose<SliderExpose>({\n focus: () => thumbEl(0)?.focus(),\n blur: () => {\n const focused = document.activeElement\n if (focused instanceof HTMLElement && railRef.value?.contains(focused)) focused.blur()\n },\n})\n</script>\n\n<template>\n <div\n v-bind=\"rootAttrs\"\n :class=\"classes\"\n :style=\"[\n vertical && height !== undefined\n ? { height: typeof height === 'number' ? `${height}px` : height }\n : undefined,\n attrs.style as StyleValue,\n ]\"\n :role=\"range ? 'group' : undefined\"\n :aria-labelledby=\"range ? groupLabelledBy : undefined\"\n >\n <div :class=\"ns.e('body')\">\n <div\n ref=\"rail\"\n :class=\"ns.e('rail')\"\n @pointerdown=\"onPointerdown\"\n @pointermove=\"onPointermove\"\n @pointerup=\"onPointerup\"\n @pointercancel=\"onPointerup\"\n @lostpointercapture=\"onPointerup\"\n >\n <div :class=\"ns.e('fill')\" :style=\"fillStyle\" />\n <span\n v-for=\"mark in innerMarks\"\n :key=\"mark.value\"\n :class=\"[ns.e('dot'), ns.is('active', inFill(mark.value))]\"\n :style=\"along(percent(mark.value))\"\n aria-hidden=\"true\"\n />\n <div\n v-for=\"thumb in thumbs\"\n :key=\"thumb.index\"\n :id=\"thumb.index === 0 ? formItem?.inputId : undefined\"\n :class=\"[\n ns.e('thumb'),\n ns.is('active', active === thumb.index),\n ns.is('pinned', tooltip === 'always'),\n ]\"\n :style=\"thumb.style\"\n :data-index=\"thumb.index\"\n role=\"slider\"\n :tabindex=\"disabled ? -1 : 0\"\n :aria-orientation=\"vertical ? 'vertical' : 'horizontal'\"\n :aria-valuenow=\"thumb.value\"\n :aria-valuemin=\"thumb.min\"\n :aria-valuemax=\"thumb.max\"\n :aria-valuetext=\"describe(thumb.value)\"\n :aria-label=\"thumb.label\"\n :aria-labelledby=\"thumb.labelledBy\"\n :aria-describedby=\"formItem?.describedBy.value\"\n :aria-disabled=\"disabled || undefined\"\n :aria-readonly=\"readonly || undefined\"\n :aria-invalid=\"invalid || undefined\"\n @keydown=\"onKeydown($event, thumb.index)\"\n >\n <span v-if=\"tooltip\" :class=\"ns.e('tooltip')\" aria-hidden=\"true\">\n {{ describe(thumb.value) ?? thumb.value }}\n </span>\n </div>\n </div>\n <div v-if=\"marks.length\" :class=\"ns.e('marks')\" aria-hidden=\"true\">\n <span\n v-for=\"mark in marks\"\n :key=\"mark.value\"\n :class=\"[ns.e('mark'), ns.is('active', inFill(mark.value))]\"\n :style=\"along(percent(mark.value))\"\n >\n {{ mark.label }}\n </span>\n </div>\n </div>\n <DouInputNumber\n v-if=\"showInput && !range\"\n :class=\"ns.e('input')\"\n :model-value=\"values[0]\"\n :min=\"min\"\n :max=\"max\"\n :step=\"step\"\n :size=\"size\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :invalid=\"invalid\"\n :aria-label=\"thumbs[0]?.label\"\n :aria-labelledby=\"thumbs[0]?.labelledBy\"\n @update:model-value=\"onInput\"\n />\n </div>\n</template>\n"],"mappings":""}
@@ -2,7 +2,7 @@ import { useNamespace } from "../../utils/namespace.js";
2
2
  import { useLocale } from "../config-provider/use-config.js";
3
3
  import { formItemKey } from "../form/form.js";
4
4
  import { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from "../form/use-form-item.js";
5
- import input_number_default from "../input-number/input-number.js";
5
+ import { DouInputNumber } from "../input-number/index.js";
6
6
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeModels, mergeProps, normalizeClass, normalizeStyle, openBlock, provide, ref, renderList, toDisplayString, unref, useAttrs, useModel, useTemplateRef } from "vue";
7
7
  // src/components/slider/slider.vue?vue&type=script&setup=true&lang.ts
8
8
  var _hoisted_1 = ["role", "aria-labelledby"];
@@ -319,7 +319,7 @@ var slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
319
319
  class: normalizeClass([unref(ns).e("mark"), unref(ns).is("active", inFill(mark.value))]),
320
320
  style: normalizeStyle(along(percent(mark.value)))
321
321
  }, toDisplayString(mark.label), 7);
322
- }), 128))], 2)) : createCommentVNode("", true)], 2), __props.showInput && !__props.range ? (openBlock(), createBlock(input_number_default, {
322
+ }), 128))], 2)) : createCommentVNode("", true)], 2), __props.showInput && !__props.range ? (openBlock(), createBlock(unref(DouInputNumber), {
323
323
  key: 0,
324
324
  class: normalizeClass(unref(ns).e("input")),
325
325
  "model-value": values.value[0],
@@ -1 +1 @@
1
- {"version":3,"file":"slider.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createElementBlock","_mergeProps","_unref","_createElementVNode","_normalizeClass","_normalizeStyle","_Fragment","_renderList","_toDisplayString","_createCommentVNode","_createBlock","DouInputNumber"],"sources":["../../../src/components/slider/slider.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, provide, ref, useAttrs, useTemplateRef } from 'vue'\nimport type { StyleValue } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { useLocale } from '../config-provider/use-config'\nimport { formItemKey } from '../form/form'\nimport type { FormItemContext } from '../form/form'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport DouInputNumber from '../input-number/input-number.vue'\nimport type { SliderExpose, SliderProps, SliderValue } from './slider'\n\ndefineOptions({ name: 'DouSlider', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<SliderProps>(), {\n range: false,\n min: 0,\n max: 100,\n step: 1,\n disabled: false,\n invalid: false,\n vertical: false,\n showInput: false,\n tooltip: false,\n})\nconst model = defineModel<SliderValue>()\nconst emit = defineEmits<{ change: [value: SliderValue] }>()\n\nconst ns = useNamespace('slider')\nconst { t } = useLocale()\nconst { formItem } = useFormItem()\n// The thumbs are not labelable elements, so the item labels them by id.\nformItem?.markGroup()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\n// The number input is part of the slider, not a second field of the form item.\nprovide(formItemKey, undefined as unknown as FormItemContext)\n\n// `aria-label` and `aria-labelledby` name the thumb of a single slider;\n// everything else dresses the root.\nconst attrs = useAttrs()\nconst rootAttrs = computed(() => {\n if (props.range) return attrs\n const { 'aria-label': _label, 'aria-labelledby': _labelledby, ...rest } = attrs\n return rest\n})\n\nconst railRef = useTemplateRef<HTMLElement>('rail')\n\nconst thumbEl = (index: number) =>\n railRef.value?.querySelector<HTMLElement>(`[data-index=\"${index}\"]`) ?? undefined\n\nfunction decimals(value: number) {\n const [digits = '', exponent] = String(value).split('e')\n const fraction = digits.split('.')[1]?.length ?? 0\n return Math.max(0, fraction - Number(exponent ?? 0))\n}\n\n/** Snap to the nearest step and keep within `[lower, upper]`. */\nfunction snap(value: number, lower = props.min, upper = props.max) {\n const steps = Math.round((value - props.min) / props.step)\n const snapped = Number((props.min + steps * props.step).toFixed(decimals(props.step)))\n return Math.min(Math.max(snapped, lower), upper)\n}\n\nconst values = computed<number[]>(() => {\n const value = model.value\n if (props.range) {\n const [a = props.min, b = props.max] = Array.isArray(value) ? value : [props.min, value]\n return [snap(Math.min(a, b)), snap(Math.max(a, b))]\n }\n return [snap(Array.isArray(value) ? value[0] : (value ?? props.min))]\n})\n\nconst span = computed(() => props.max - props.min || 1)\nconst percent = (value: number) => ((value - props.min) / span.value) * 100\n\n/** Where along the track: from the left, or from the bottom when vertical. */\nconst along = (at: number) => (props.vertical ? { bottom: `${at}%` } : { left: `${at}%` })\n\nconst fillStyle = computed(() => {\n const [first = props.min, second] = values.value\n const start = second === undefined ? 0 : percent(first)\n const end = percent(second ?? first)\n return props.vertical\n ? { bottom: `${start}%`, height: `${end - start}%` }\n : { left: `${start}%`, width: `${end - start}%` }\n})\n\nconst marks = computed(() => {\n const list = Object.entries(props.marks ?? {})\n .map(([key, label]) => ({ value: Number(key), label }))\n .filter((mark) => mark.value >= props.min && mark.value <= props.max)\n // `list` is a fresh array, sorting it in place is safe.\n // oxlint-disable-next-line unicorn/no-array-sort\n return list.sort((a, b) => a.value - b.value)\n})\n\n// The rail's rounded ends already mark the bounds.\nconst innerMarks = computed(() =>\n marks.value.filter((mark) => mark.value > props.min && mark.value < props.max),\n)\n\nfunction inFill(value: number) {\n const [first = props.min, second] = values.value\n return second === undefined ? value <= first : value >= first && value <= second\n}\n\n/** Where a thumb may go without passing the other one. */\nfunction bounds(index: number): [number, number] {\n if (!props.range) return [props.min, props.max]\n const [first = props.min, second = props.max] = values.value\n return index === 0 ? [props.min, second] : [first, props.max]\n}\n\n// The value last set, as a bound model only updates once the parent re-renders.\nlet latest: SliderValue | undefined\n\nfunction set(index: number, value: number) {\n const next = [...values.value]\n next[index] = snap(value, ...bounds(index))\n if (next[index] === values.value[index] && model.value !== undefined) return false\n latest = props.range ? [next[0]!, next[1]!] : next[0]!\n model.value = latest\n return true\n}\n\nfunction commit() {\n const value = latest ?? model.value\n if (value === undefined) return\n emit('change', value)\n formItem?.trigger('change')\n}\n\n// Pointer: pressing the rail moves the nearest thumb there, and the\n// thumb follows the pointer until it is released.\nconst active = ref<number | null>(null)\nlet moved = false\n\nfunction valueAt(event: PointerEvent) {\n const rect = railRef.value?.getBoundingClientRect()\n if (!rect) return props.min\n const ratio = props.vertical\n ? rect.height && (rect.bottom - event.clientY) / rect.height\n : rect.width && (event.clientX - rect.left) / rect.width\n return props.min + Math.min(Math.max(ratio, 0), 1) * span.value\n}\n\nfunction nearest(value: number) {\n const [first = props.min, second] = values.value\n if (second === undefined) return 0\n if (first === second) return value > first ? 1 : 0\n return Math.abs(value - first) <= Math.abs(value - second) ? 0 : 1\n}\n\nfunction onPointerdown(event: PointerEvent) {\n if (disabled.value || readonly.value || event.button !== 0) return\n event.preventDefault()\n const value = valueAt(event)\n const thumb = (event.target as HTMLElement).closest<HTMLElement>('[data-index]')\n const index = thumb ? Number(thumb.dataset.index) : nearest(value)\n active.value = index\n // Pressing a thumb grabs it where it is; pressing the rail jumps.\n moved = thumb ? false : set(index, value)\n thumbEl(index)?.focus()\n railRef.value?.setPointerCapture?.(event.pointerId)\n}\n\nfunction onPointermove(event: PointerEvent) {\n if (active.value === null) return\n const value = valueAt(event)\n // Two thumbs on the same spot: the one that can go where the pointer\n // heads takes over.\n const [first, second] = values.value\n if (props.range && first === second && value !== first) {\n active.value = value < first! ? 0 : 1\n thumbEl(active.value)?.focus()\n }\n if (set(active.value, value)) moved = true\n}\n\nfunction onPointerup(event: PointerEvent) {\n if (active.value === null) return\n railRef.value?.releasePointerCapture?.(event.pointerId)\n active.value = null\n if (moved) commit()\n}\n\nfunction onKeydown(event: KeyboardEvent, index: number) {\n if (disabled.value || readonly.value) return\n const value = values.value[index] ?? props.min\n const page = Math.max(props.step, Math.round(span.value / 10 / props.step) * props.step)\n const targets: Record<string, number> = {\n ArrowRight: value + props.step,\n ArrowUp: value + props.step,\n ArrowLeft: value - props.step,\n ArrowDown: value - props.step,\n PageUp: value + page,\n PageDown: value - page,\n Home: props.min,\n End: props.max,\n }\n if (!(event.key in targets)) return\n event.preventDefault()\n if (set(index, targets[event.key]!)) commit()\n}\n\nconst groupLabelledBy = computed(\n () => (attrs['aria-labelledby'] as string | undefined) ?? formItem?.labelId,\n)\n\nfunction onInput(value: number | null) {\n if (value === null || Number.isNaN(value)) return\n if (set(0, value)) commit()\n}\n\nconst describe = (value: number) => (props.format ? props.format(value) : undefined)\n\nconst thumbs = computed(() =>\n values.value.map((value, index) => {\n const [lower, upper] = bounds(index)\n return {\n value,\n index,\n style: along(percent(value)),\n min: lower,\n max: upper,\n label: props.range\n ? t(index === 0 ? 'slider.start' : 'slider.end')\n : (attrs['aria-label'] as string | undefined),\n labelledBy: props.range\n ? undefined\n : ((attrs['aria-labelledby'] as string | undefined) ?? formItem?.labelId),\n }\n }),\n)\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('range', props.range),\n ns.is('vertical', props.vertical),\n ns.is('with-input', props.showInput && !props.range),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('dragging', active.value !== null),\n ns.is(\n 'marked',\n marks.value.some((mark) => mark.label),\n ),\n attrs.class,\n])\n\ndefineExpose<SliderExpose>({\n focus: () => thumbEl(0)?.focus(),\n blur: () => {\n const focused = document.activeElement\n if (focused instanceof HTMLElement && railRef.value?.contains(focused)) focused.blur()\n },\n})\n</script>\n\n<template>\n <div\n v-bind=\"rootAttrs\"\n :class=\"classes\"\n :style=\"[\n vertical && height !== undefined\n ? { height: typeof height === 'number' ? `${height}px` : height }\n : undefined,\n attrs.style as StyleValue,\n ]\"\n :role=\"range ? 'group' : undefined\"\n :aria-labelledby=\"range ? groupLabelledBy : undefined\"\n >\n <div :class=\"ns.e('body')\">\n <div\n ref=\"rail\"\n :class=\"ns.e('rail')\"\n @pointerdown=\"onPointerdown\"\n @pointermove=\"onPointermove\"\n @pointerup=\"onPointerup\"\n @pointercancel=\"onPointerup\"\n @lostpointercapture=\"onPointerup\"\n >\n <div :class=\"ns.e('fill')\" :style=\"fillStyle\" />\n <span\n v-for=\"mark in innerMarks\"\n :key=\"mark.value\"\n :class=\"[ns.e('dot'), ns.is('active', inFill(mark.value))]\"\n :style=\"along(percent(mark.value))\"\n aria-hidden=\"true\"\n />\n <div\n v-for=\"thumb in thumbs\"\n :key=\"thumb.index\"\n :id=\"thumb.index === 0 ? formItem?.inputId : undefined\"\n :class=\"[\n ns.e('thumb'),\n ns.is('active', active === thumb.index),\n ns.is('pinned', tooltip === 'always'),\n ]\"\n :style=\"thumb.style\"\n :data-index=\"thumb.index\"\n role=\"slider\"\n :tabindex=\"disabled ? -1 : 0\"\n :aria-orientation=\"vertical ? 'vertical' : 'horizontal'\"\n :aria-valuenow=\"thumb.value\"\n :aria-valuemin=\"thumb.min\"\n :aria-valuemax=\"thumb.max\"\n :aria-valuetext=\"describe(thumb.value)\"\n :aria-label=\"thumb.label\"\n :aria-labelledby=\"thumb.labelledBy\"\n :aria-describedby=\"formItem?.describedBy.value\"\n :aria-disabled=\"disabled || undefined\"\n :aria-readonly=\"readonly || undefined\"\n :aria-invalid=\"invalid || undefined\"\n @keydown=\"onKeydown($event, thumb.index)\"\n >\n <span v-if=\"tooltip\" :class=\"ns.e('tooltip')\" aria-hidden=\"true\">\n {{ describe(thumb.value) ?? thumb.value }}\n </span>\n </div>\n </div>\n <div v-if=\"marks.length\" :class=\"ns.e('marks')\" aria-hidden=\"true\">\n <span\n v-for=\"mark in marks\"\n :key=\"mark.value\"\n :class=\"[ns.e('mark'), ns.is('active', inFill(mark.value))]\"\n :style=\"along(percent(mark.value))\"\n >\n {{ mark.label }}\n </span>\n </div>\n </div>\n <DouInputNumber\n v-if=\"showInput && !range\"\n :class=\"ns.e('input')\"\n :model-value=\"values[0]\"\n :min=\"min\"\n :max=\"max\"\n :step=\"step\"\n :size=\"size\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :invalid=\"invalid\"\n :aria-label=\"thumbs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QAAQ,MAAM,KAAK;K,IAE3B,QAAA,WAAZH,UAAA,GAAAC,mBAEO,QAAA;;MAFe,OAAKI,eAAEF,MAAA,EAAA,CAAE,CAAC,EAAC,SAAA,CAAA;MAAa,eAAY;KACrD,GAAAM,gBAAA,SAAS,MAAM,KAAK,KAAK,MAAM,KAAK,GAAA,CAAA,K;;G,QAIlC,MAAA,MAAM,UAAjBT,UAAA,GAAAC,mBASM,OAAA;;IAToB,OAAKI,eAAEF,MAAA,EAAA,CAAE,CAAC,EAAC,OAAA,CAAA;IAAW,eAAY;G,KAC1DH,UAAA,IAAA,GAAAC,mBAOOM,UAAA,MAAAC,WANU,MAAA,QAAR,SAAI;IADb,OAAAR,UAAA,GAAAC,mBAOO,QAAA;KALJ,KAAK,KAAK;KACV,OAAKI,eAAA,CAAGF,MAAA,EAAA,CAAE,CAAC,EAAC,MAAA,GAAUA,MAAA,EAAA,CAAE,CAAC,GAAE,UAAW,OAAO,KAAK,KAAK,CAAA,CAAA,CAAA;KACvD,OAAKG,eAAE,MAAM,QAAQ,KAAK,KAAK,CAAA,CAAA;IAE7B,GAAAG,gBAAA,KAAK,KAAK,GAAA,CAAA;G,qDAKX,QAAA,aAAS,CAAK,QAAA,SADtBT,UAAA,GAAAW,YAcEC,sBAAA;;IAZC,OAAKP,eAAEF,MAAA,EAAA,CAAE,CAAC,EAAC,OAAA,CAAA;IACX,eAAa,OAAA,MAAM;IACnB,KAAK,QAAA;IACL,KAAK,QAAA;IACL,MAAM,QAAA;IACN,MAAMA,MAAA,IAAA;IACN,UAAUA,MAAA,QAAA;IACV,UAAUA,MAAA,QAAA;IACV,SAAS,QAAA;IACT,cAAY,OAAA,MAAM,EAAA,EAAK;IACvB,mBAAiB,OAAA,MAAM,EAAA,EAAK;IAC5B,uBAAoB"}
1
+ {"version":3,"file":"slider.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createElementBlock","_mergeProps","_unref","_createElementVNode","_normalizeClass","_normalizeStyle","_Fragment","_renderList","_toDisplayString","_createCommentVNode","_createBlock"],"sources":["../../../src/components/slider/slider.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, provide, ref, useAttrs, useTemplateRef } from 'vue'\nimport type { StyleValue } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { useLocale } from '../config-provider/use-config'\nimport { formItemKey } from '../form/form'\nimport type { FormItemContext } from '../form/form'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport { DouInputNumber } from '../input-number'\nimport type { SliderExpose, SliderProps, SliderValue } from './slider'\n\ndefineOptions({ name: 'DouSlider', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<SliderProps>(), {\n range: false,\n min: 0,\n max: 100,\n step: 1,\n disabled: false,\n invalid: false,\n vertical: false,\n showInput: false,\n tooltip: false,\n})\nconst model = defineModel<SliderValue>()\nconst emit = defineEmits<{ change: [value: SliderValue] }>()\n\nconst ns = useNamespace('slider')\nconst { t } = useLocale()\nconst { formItem } = useFormItem()\n// The thumbs are not labelable elements, so the item labels them by id.\nformItem?.markGroup()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\n// The number input is part of the slider, not a second field of the form item.\nprovide(formItemKey, undefined as unknown as FormItemContext)\n\n// `aria-label` and `aria-labelledby` name the thumb of a single slider;\n// everything else dresses the root.\nconst attrs = useAttrs()\nconst rootAttrs = computed(() => {\n if (props.range) return attrs\n const { 'aria-label': _label, 'aria-labelledby': _labelledby, ...rest } = attrs\n return rest\n})\n\nconst railRef = useTemplateRef<HTMLElement>('rail')\n\nconst thumbEl = (index: number) =>\n railRef.value?.querySelector<HTMLElement>(`[data-index=\"${index}\"]`) ?? undefined\n\nfunction decimals(value: number) {\n const [digits = '', exponent] = String(value).split('e')\n const fraction = digits.split('.')[1]?.length ?? 0\n return Math.max(0, fraction - Number(exponent ?? 0))\n}\n\n/** Snap to the nearest step and keep within `[lower, upper]`. */\nfunction snap(value: number, lower = props.min, upper = props.max) {\n const steps = Math.round((value - props.min) / props.step)\n const snapped = Number((props.min + steps * props.step).toFixed(decimals(props.step)))\n return Math.min(Math.max(snapped, lower), upper)\n}\n\nconst values = computed<number[]>(() => {\n const value = model.value\n if (props.range) {\n const [a = props.min, b = props.max] = Array.isArray(value) ? value : [props.min, value]\n return [snap(Math.min(a, b)), snap(Math.max(a, b))]\n }\n return [snap(Array.isArray(value) ? value[0] : (value ?? props.min))]\n})\n\nconst span = computed(() => props.max - props.min || 1)\nconst percent = (value: number) => ((value - props.min) / span.value) * 100\n\n/** Where along the track: from the left, or from the bottom when vertical. */\nconst along = (at: number) => (props.vertical ? { bottom: `${at}%` } : { left: `${at}%` })\n\nconst fillStyle = computed(() => {\n const [first = props.min, second] = values.value\n const start = second === undefined ? 0 : percent(first)\n const end = percent(second ?? first)\n return props.vertical\n ? { bottom: `${start}%`, height: `${end - start}%` }\n : { left: `${start}%`, width: `${end - start}%` }\n})\n\nconst marks = computed(() => {\n const list = Object.entries(props.marks ?? {})\n .map(([key, label]) => ({ value: Number(key), label }))\n .filter((mark) => mark.value >= props.min && mark.value <= props.max)\n // `list` is a fresh array, sorting it in place is safe.\n // oxlint-disable-next-line unicorn/no-array-sort\n return list.sort((a, b) => a.value - b.value)\n})\n\n// The rail's rounded ends already mark the bounds.\nconst innerMarks = computed(() =>\n marks.value.filter((mark) => mark.value > props.min && mark.value < props.max),\n)\n\nfunction inFill(value: number) {\n const [first = props.min, second] = values.value\n return second === undefined ? value <= first : value >= first && value <= second\n}\n\n/** Where a thumb may go without passing the other one. */\nfunction bounds(index: number): [number, number] {\n if (!props.range) return [props.min, props.max]\n const [first = props.min, second = props.max] = values.value\n return index === 0 ? [props.min, second] : [first, props.max]\n}\n\n// The value last set, as a bound model only updates once the parent re-renders.\nlet latest: SliderValue | undefined\n\nfunction set(index: number, value: number) {\n const next = [...values.value]\n next[index] = snap(value, ...bounds(index))\n if (next[index] === values.value[index] && model.value !== undefined) return false\n latest = props.range ? [next[0]!, next[1]!] : next[0]!\n model.value = latest\n return true\n}\n\nfunction commit() {\n const value = latest ?? model.value\n if (value === undefined) return\n emit('change', value)\n formItem?.trigger('change')\n}\n\n// Pointer: pressing the rail moves the nearest thumb there, and the\n// thumb follows the pointer until it is released.\nconst active = ref<number | null>(null)\nlet moved = false\n\nfunction valueAt(event: PointerEvent) {\n const rect = railRef.value?.getBoundingClientRect()\n if (!rect) return props.min\n const ratio = props.vertical\n ? rect.height && (rect.bottom - event.clientY) / rect.height\n : rect.width && (event.clientX - rect.left) / rect.width\n return props.min + Math.min(Math.max(ratio, 0), 1) * span.value\n}\n\nfunction nearest(value: number) {\n const [first = props.min, second] = values.value\n if (second === undefined) return 0\n if (first === second) return value > first ? 1 : 0\n return Math.abs(value - first) <= Math.abs(value - second) ? 0 : 1\n}\n\nfunction onPointerdown(event: PointerEvent) {\n if (disabled.value || readonly.value || event.button !== 0) return\n event.preventDefault()\n const value = valueAt(event)\n const thumb = (event.target as HTMLElement).closest<HTMLElement>('[data-index]')\n const index = thumb ? Number(thumb.dataset.index) : nearest(value)\n active.value = index\n // Pressing a thumb grabs it where it is; pressing the rail jumps.\n moved = thumb ? false : set(index, value)\n thumbEl(index)?.focus()\n railRef.value?.setPointerCapture?.(event.pointerId)\n}\n\nfunction onPointermove(event: PointerEvent) {\n if (active.value === null) return\n const value = valueAt(event)\n // Two thumbs on the same spot: the one that can go where the pointer\n // heads takes over.\n const [first, second] = values.value\n if (props.range && first === second && value !== first) {\n active.value = value < first! ? 0 : 1\n thumbEl(active.value)?.focus()\n }\n if (set(active.value, value)) moved = true\n}\n\nfunction onPointerup(event: PointerEvent) {\n if (active.value === null) return\n railRef.value?.releasePointerCapture?.(event.pointerId)\n active.value = null\n if (moved) commit()\n}\n\nfunction onKeydown(event: KeyboardEvent, index: number) {\n if (disabled.value || readonly.value) return\n const value = values.value[index] ?? props.min\n const page = Math.max(props.step, Math.round(span.value / 10 / props.step) * props.step)\n const targets: Record<string, number> = {\n ArrowRight: value + props.step,\n ArrowUp: value + props.step,\n ArrowLeft: value - props.step,\n ArrowDown: value - props.step,\n PageUp: value + page,\n PageDown: value - page,\n Home: props.min,\n End: props.max,\n }\n if (!(event.key in targets)) return\n event.preventDefault()\n if (set(index, targets[event.key]!)) commit()\n}\n\nconst groupLabelledBy = computed(\n () => (attrs['aria-labelledby'] as string | undefined) ?? formItem?.labelId,\n)\n\nfunction onInput(value: number | null) {\n if (value === null || Number.isNaN(value)) return\n if (set(0, value)) commit()\n}\n\nconst describe = (value: number) => (props.format ? props.format(value) : undefined)\n\nconst thumbs = computed(() =>\n values.value.map((value, index) => {\n const [lower, upper] = bounds(index)\n return {\n value,\n index,\n style: along(percent(value)),\n min: lower,\n max: upper,\n label: props.range\n ? t(index === 0 ? 'slider.start' : 'slider.end')\n : (attrs['aria-label'] as string | undefined),\n labelledBy: props.range\n ? undefined\n : ((attrs['aria-labelledby'] as string | undefined) ?? formItem?.labelId),\n }\n }),\n)\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('range', props.range),\n ns.is('vertical', props.vertical),\n ns.is('with-input', props.showInput && !props.range),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('dragging', active.value !== null),\n ns.is(\n 'marked',\n marks.value.some((mark) => mark.label),\n ),\n attrs.class,\n])\n\ndefineExpose<SliderExpose>({\n focus: () => thumbEl(0)?.focus(),\n blur: () => {\n const focused = document.activeElement\n if (focused instanceof HTMLElement && railRef.value?.contains(focused)) focused.blur()\n },\n})\n</script>\n\n<template>\n <div\n v-bind=\"rootAttrs\"\n :class=\"classes\"\n :style=\"[\n vertical && height !== undefined\n ? { height: typeof height === 'number' ? `${height}px` : height }\n : undefined,\n attrs.style as StyleValue,\n ]\"\n :role=\"range ? 'group' : undefined\"\n :aria-labelledby=\"range ? groupLabelledBy : undefined\"\n >\n <div :class=\"ns.e('body')\">\n <div\n ref=\"rail\"\n :class=\"ns.e('rail')\"\n @pointerdown=\"onPointerdown\"\n @pointermove=\"onPointermove\"\n @pointerup=\"onPointerup\"\n @pointercancel=\"onPointerup\"\n @lostpointercapture=\"onPointerup\"\n >\n <div :class=\"ns.e('fill')\" :style=\"fillStyle\" />\n <span\n v-for=\"mark in innerMarks\"\n :key=\"mark.value\"\n :class=\"[ns.e('dot'), ns.is('active', inFill(mark.value))]\"\n :style=\"along(percent(mark.value))\"\n aria-hidden=\"true\"\n />\n <div\n v-for=\"thumb in thumbs\"\n :key=\"thumb.index\"\n :id=\"thumb.index === 0 ? formItem?.inputId : undefined\"\n :class=\"[\n ns.e('thumb'),\n ns.is('active', active === thumb.index),\n ns.is('pinned', tooltip === 'always'),\n ]\"\n :style=\"thumb.style\"\n :data-index=\"thumb.index\"\n role=\"slider\"\n :tabindex=\"disabled ? -1 : 0\"\n :aria-orientation=\"vertical ? 'vertical' : 'horizontal'\"\n :aria-valuenow=\"thumb.value\"\n :aria-valuemin=\"thumb.min\"\n :aria-valuemax=\"thumb.max\"\n :aria-valuetext=\"describe(thumb.value)\"\n :aria-label=\"thumb.label\"\n :aria-labelledby=\"thumb.labelledBy\"\n :aria-describedby=\"formItem?.describedBy.value\"\n :aria-disabled=\"disabled || undefined\"\n :aria-readonly=\"readonly || undefined\"\n :aria-invalid=\"invalid || undefined\"\n @keydown=\"onKeydown($event, thumb.index)\"\n >\n <span v-if=\"tooltip\" :class=\"ns.e('tooltip')\" aria-hidden=\"true\">\n {{ describe(thumb.value) ?? thumb.value }}\n </span>\n </div>\n </div>\n <div v-if=\"marks.length\" :class=\"ns.e('marks')\" aria-hidden=\"true\">\n <span\n v-for=\"mark in marks\"\n :key=\"mark.value\"\n :class=\"[ns.e('mark'), ns.is('active', inFill(mark.value))]\"\n :style=\"along(percent(mark.value))\"\n >\n {{ mark.label }}\n </span>\n </div>\n </div>\n <DouInputNumber\n v-if=\"showInput && !range\"\n :class=\"ns.e('input')\"\n :model-value=\"values[0]\"\n :min=\"min\"\n :max=\"max\"\n :step=\"step\"\n :size=\"size\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :invalid=\"invalid\"\n :aria-label=\"thumbs[0]?.label\"\n :aria-labelledby=\"thumbs[0]?.labelledBy\"\n @update:model-value=\"onInput\"\n />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaA,MAAM,QAAQ;EAWd,MAAM,QAAQA,SAAwB,SAAA,YAAC;EACvC,MAAM,OAAO;EAEb,MAAM,KAAK,aAAa,QAAQ;EAChC,MAAM,EAAE,MAAM,UAAU;EACxB,MAAM,EAAE,aAAa,YAAY;EAEjC,UAAU,UAAU;EACpB,MAAM,OAAO,kBAAkB,MAAM,IAAI;EACzC,MAAM,WAAW,sBAAsB,MAAM,QAAQ;EACrD,MAAM,WAAW,sBAAsB,MAAM,QAAQ;EACrD,MAAM,UAAU,eAAe,MAAM,WAAW,CAAC,CAAC,UAAU,QAAQ,KAAK;EAEzE,QAAQ,aAAa,KAAA,CAAuC;EAI5D,MAAM,QAAQ,SAAS;EACvB,MAAM,YAAY,eAAe;GAC/B,IAAI,MAAM,OAAO,OAAO;GACxB,MAAM,EAAE,cAAc,QAAQ,mBAAmB,aAAa,GAAG,SAAS;GAC1E,OAAO;EACT,CAAC;EAED,MAAM,UAAU,eAA4B,MAAM;EAElD,MAAM,WAAW,UACf,QAAQ,OAAO,cAA2B,gBAAgB,MAAM,GAAG,KAAK,KAAA;EAE1E,SAAS,SAAS,OAAe;GAC/B,MAAM,CAAC,SAAS,IAAI,YAAY,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG;GACvD,MAAM,WAAW,OAAO,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,UAAU;GACjD,OAAO,KAAK,IAAI,GAAG,WAAW,OAAO,YAAY,CAAC,CAAC;EACrD;;EAGA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