huibo-ui 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (839) hide show
  1. package/dist/cjs/{a11y-802de67a.js → a11y-4385c871.js} +17 -2
  2. package/dist/cjs/a11y-4385c871.js.map +1 -0
  3. package/dist/cjs/{date-helpers-904747ff.js → date-helpers-c05ef385.js} +10 -17
  4. package/dist/cjs/date-helpers-c05ef385.js.map +1 -0
  5. package/dist/cjs/hb-affix.cjs.entry.js +1 -1
  6. package/dist/cjs/hb-alert.cjs.entry.js +2 -1
  7. package/dist/cjs/hb-alert.cjs.entry.js.map +1 -1
  8. package/dist/cjs/hb-aside.cjs.entry.js +1 -1
  9. package/dist/cjs/hb-avatar.cjs.entry.js +1 -1
  10. package/dist/cjs/hb-backtop.cjs.entry.js +2 -2
  11. package/dist/cjs/hb-badge.cjs.entry.js +1 -1
  12. package/dist/cjs/hb-breadcrumb-item.cjs.entry.js +1 -1
  13. package/dist/cjs/hb-breadcrumb.cjs.entry.js +1 -1
  14. package/dist/cjs/hb-button.cjs.entry.js +2 -2
  15. package/dist/cjs/hb-calendar.cjs.entry.js +78 -10
  16. package/dist/cjs/hb-calendar.cjs.entry.js.map +1 -1
  17. package/dist/cjs/hb-card.cjs.entry.js +1 -1
  18. package/dist/cjs/hb-cascader.cjs.entry.js +306 -146
  19. package/dist/cjs/hb-cascader.cjs.entry.js.map +1 -1
  20. package/dist/cjs/hb-checkbox-group.cjs.entry.js +12 -8
  21. package/dist/cjs/hb-checkbox-group.cjs.entry.js.map +1 -1
  22. package/dist/cjs/hb-checkbox.cjs.entry.js +9 -4
  23. package/dist/cjs/hb-checkbox.cjs.entry.js.map +1 -1
  24. package/dist/cjs/hb-collapse-item.cjs.entry.js +13 -4
  25. package/dist/cjs/hb-collapse-item.cjs.entry.js.map +1 -1
  26. package/dist/cjs/hb-collapse.cjs.entry.js +20 -15
  27. package/dist/cjs/hb-collapse.cjs.entry.js.map +1 -1
  28. package/dist/cjs/hb-color-picker-panel.cjs.entry.js +2 -2
  29. package/dist/cjs/hb-color-picker.cjs.entry.js +108 -28
  30. package/dist/cjs/hb-color-picker.cjs.entry.js.map +1 -1
  31. package/dist/cjs/hb-config-provider.cjs.entry.js +1 -1
  32. package/dist/cjs/hb-container.cjs.entry.js +2 -2
  33. package/dist/cjs/hb-date-picker-pane.cjs.entry.js +2 -2
  34. package/dist/cjs/hb-date-picker.cjs.entry.js +90 -9
  35. package/dist/cjs/hb-date-picker.cjs.entry.js.map +1 -1
  36. package/dist/cjs/hb-date-range-picker.cjs.entry.js +3 -3
  37. package/dist/cjs/hb-date-time-picker.cjs.entry.js +3 -3
  38. package/dist/cjs/hb-descriptions.cjs.entry.js +2 -2
  39. package/dist/cjs/hb-descriptions.cjs.entry.js.map +1 -1
  40. package/dist/cjs/hb-dialog.cjs.entry.js +51 -12
  41. package/dist/cjs/hb-dialog.cjs.entry.js.map +1 -1
  42. package/dist/cjs/hb-divider.cjs.entry.js +2 -2
  43. package/dist/cjs/hb-drawer.cjs.entry.js +34 -4
  44. package/dist/cjs/hb-drawer.cjs.entry.js.map +1 -1
  45. package/dist/cjs/hb-dropdown.cjs.entry.js +91 -11
  46. package/dist/cjs/hb-dropdown.cjs.entry.js.map +1 -1
  47. package/dist/cjs/hb-empty.cjs.entry.js +1 -1
  48. package/dist/cjs/hb-float-button.cjs.entry.js +2 -2
  49. package/dist/cjs/hb-footer.cjs.entry.js +1 -1
  50. package/dist/cjs/hb-form-item.cjs.entry.js +61 -9
  51. package/dist/cjs/hb-form-item.cjs.entry.js.map +1 -1
  52. package/dist/cjs/hb-form.cjs.entry.js +13 -8
  53. package/dist/cjs/hb-form.cjs.entry.js.map +1 -1
  54. package/dist/cjs/hb-header.cjs.entry.js +1 -1
  55. package/dist/cjs/hb-image-preview.cjs.entry.js +13 -9
  56. package/dist/cjs/hb-image-preview.cjs.entry.js.map +1 -1
  57. package/dist/cjs/hb-image.cjs.entry.js +21 -3
  58. package/dist/cjs/hb-image.cjs.entry.js.map +1 -1
  59. package/dist/cjs/hb-input-number.cjs.entry.js +7 -7
  60. package/dist/cjs/hb-input-number.cjs.entry.js.map +1 -1
  61. package/dist/cjs/hb-input-tag.cjs.entry.js +2 -2
  62. package/dist/cjs/hb-input.cjs.entry.js +40 -3
  63. package/dist/cjs/hb-input.cjs.entry.js.map +1 -1
  64. package/dist/cjs/hb-layout.cjs.entry.js +36 -14
  65. package/dist/cjs/hb-layout.cjs.entry.js.map +1 -1
  66. package/dist/cjs/hb-link.cjs.entry.js +2 -2
  67. package/dist/cjs/hb-loading.cjs.entry.js +2 -2
  68. package/dist/cjs/hb-main.cjs.entry.js +1 -1
  69. package/dist/cjs/hb-menu-item.cjs.entry.js +14 -5
  70. package/dist/cjs/hb-menu-item.cjs.entry.js.map +1 -1
  71. package/dist/cjs/hb-menu.cjs.entry.js +3 -3
  72. package/dist/cjs/hb-menu.cjs.entry.js.map +1 -1
  73. package/dist/cjs/hb-message.cjs.entry.js +13 -4
  74. package/dist/cjs/hb-message.cjs.entry.js.map +1 -1
  75. package/dist/cjs/hb-notification.cjs.entry.js +2 -2
  76. package/dist/cjs/hb-page-header.cjs.entry.js +1 -1
  77. package/dist/cjs/hb-pagination.cjs.entry.js +24 -8
  78. package/dist/cjs/hb-pagination.cjs.entry.js.map +1 -1
  79. package/dist/cjs/hb-popconfirm.cjs.entry.js +57 -8
  80. package/dist/cjs/hb-popconfirm.cjs.entry.js.map +1 -1
  81. package/dist/cjs/hb-popover.cjs.entry.js +37 -5
  82. package/dist/cjs/hb-popover.cjs.entry.js.map +1 -1
  83. package/dist/cjs/hb-progress.cjs.entry.js +1 -1
  84. package/dist/cjs/hb-radio.cjs.entry.js +8 -3
  85. package/dist/cjs/hb-radio.cjs.entry.js.map +1 -1
  86. package/dist/cjs/hb-rate.cjs.entry.js +46 -4
  87. package/dist/cjs/hb-rate.cjs.entry.js.map +1 -1
  88. package/dist/cjs/hb-result.cjs.entry.js +1 -1
  89. package/dist/cjs/hb-row.cjs.entry.js +2 -2
  90. package/dist/cjs/hb-scrollbar.cjs.entry.js +5 -5
  91. package/dist/cjs/hb-scrollbar.cjs.entry.js.map +1 -1
  92. package/dist/cjs/hb-segmented.cjs.entry.js +50 -5
  93. package/dist/cjs/hb-segmented.cjs.entry.js.map +1 -1
  94. package/dist/cjs/hb-select.cjs.entry.js +64 -16
  95. package/dist/cjs/hb-select.cjs.entry.js.map +1 -1
  96. package/dist/cjs/hb-slider.cjs.entry.js +186 -23
  97. package/dist/cjs/hb-slider.cjs.entry.js.map +1 -1
  98. package/dist/cjs/hb-space.cjs.entry.js +2 -2
  99. package/dist/cjs/hb-statistic.cjs.entry.js +1 -1
  100. package/dist/cjs/hb-step.cjs.entry.js +1 -1
  101. package/dist/cjs/hb-steps.cjs.entry.js +30 -9
  102. package/dist/cjs/hb-steps.cjs.entry.js.map +1 -1
  103. package/dist/cjs/hb-sub-menu.cjs.entry.js +5 -5
  104. package/dist/cjs/hb-switch.cjs.entry.js +9 -4
  105. package/dist/cjs/hb-switch.cjs.entry.js.map +1 -1
  106. package/dist/cjs/hb-tab-pane.cjs.entry.js +1 -1
  107. package/dist/cjs/hb-table.cjs.entry.js +26 -17
  108. package/dist/cjs/hb-table.cjs.entry.js.map +1 -1
  109. package/dist/cjs/hb-tabs.cjs.entry.js +31 -10
  110. package/dist/cjs/hb-tabs.cjs.entry.js.map +1 -1
  111. package/dist/cjs/hb-tag.cjs.entry.js +3 -2
  112. package/dist/cjs/hb-tag.cjs.entry.js.map +1 -1
  113. package/dist/cjs/hb-text.cjs.entry.js +2 -2
  114. package/dist/cjs/hb-time-picker.cjs.entry.js +14 -9
  115. package/dist/cjs/hb-time-picker.cjs.entry.js.map +1 -1
  116. package/dist/cjs/hb-time-select.cjs.entry.js +13 -4
  117. package/dist/cjs/hb-time-select.cjs.entry.js.map +1 -1
  118. package/dist/cjs/hb-timeline.cjs.entry.js +1 -1
  119. package/dist/cjs/hb-tooltip.cjs.entry.js +43 -6
  120. package/dist/cjs/hb-tooltip.cjs.entry.js.map +1 -1
  121. package/dist/cjs/hb-transfer.cjs.entry.js +2 -2
  122. package/dist/cjs/hb-tree-select.cjs.entry.js +215 -23
  123. package/dist/cjs/hb-tree-select.cjs.entry.js.map +1 -1
  124. package/dist/cjs/hb-tree.cjs.entry.js +145 -12
  125. package/dist/cjs/hb-tree.cjs.entry.js.map +1 -1
  126. package/dist/cjs/hb-upload.cjs.entry.js +3 -3
  127. package/dist/cjs/hb-watermark.cjs.entry.js +19 -11
  128. package/dist/cjs/hb-watermark.cjs.entry.js.map +1 -1
  129. package/dist/cjs/huibo-ui.cjs.js +1 -1
  130. package/dist/cjs/loader.cjs.js +1 -1
  131. package/dist/cjs/transition-59f1da0f.js +34 -0
  132. package/dist/cjs/transition-59f1da0f.js.map +1 -0
  133. package/dist/collection/collection-manifest.json +3 -3
  134. package/dist/collection/components/Affix/Affix.js +1 -1
  135. package/dist/collection/components/Alert/Alert.js +2 -1
  136. package/dist/collection/components/Alert/Alert.js.map +1 -1
  137. package/dist/collection/components/Avatar/Avatar.js +1 -1
  138. package/dist/collection/components/Backtop/Backtop.js +2 -2
  139. package/dist/collection/components/Badge/Badge.js +1 -1
  140. package/dist/collection/components/Breadcrumb/Breadcrumb.js +1 -1
  141. package/dist/collection/components/Breadcrumb/BreadcrumbItem.js +1 -1
  142. package/dist/collection/components/Button/Button.js +2 -2
  143. package/dist/collection/components/Calendar/Calendar.js +84 -10
  144. package/dist/collection/components/Calendar/Calendar.js.map +1 -1
  145. package/dist/collection/components/Calendar/calendar.css +16 -0
  146. package/dist/collection/components/Card/Card.js +1 -1
  147. package/dist/collection/components/Cascader/Cascader.js +410 -194
  148. package/dist/collection/components/Cascader/Cascader.js.map +1 -1
  149. package/dist/collection/components/Cascader/cascader.css +170 -16
  150. package/dist/collection/components/Checkbox/Checkbox.js +9 -4
  151. package/dist/collection/components/Checkbox/Checkbox.js.map +1 -1
  152. package/dist/collection/components/Checkbox/CheckboxGroup.js +12 -8
  153. package/dist/collection/components/Checkbox/CheckboxGroup.js.map +1 -1
  154. package/dist/collection/components/Collapse/Collapse.js +20 -15
  155. package/dist/collection/components/Collapse/Collapse.js.map +1 -1
  156. package/dist/collection/components/Collapse/CollapseItem.js +33 -4
  157. package/dist/collection/components/Collapse/CollapseItem.js.map +1 -1
  158. package/dist/collection/components/ColorPicker/ColorPicker.js +109 -28
  159. package/dist/collection/components/ColorPicker/ColorPicker.js.map +1 -1
  160. package/dist/collection/components/ColorPicker/color-picker.css +21 -3
  161. package/dist/collection/components/ColorPickerPanel/ColorPickerPanel.js +2 -2
  162. package/dist/collection/components/ConfigProvider/ConfigProvider.js +1 -1
  163. package/dist/collection/components/Container/Aside.js +1 -1
  164. package/dist/collection/components/Container/Container.js +2 -2
  165. package/dist/collection/components/Container/Footer.js +1 -1
  166. package/dist/collection/components/Container/Header.js +1 -1
  167. package/dist/collection/components/Container/Main.js +1 -1
  168. package/dist/collection/components/DatePicker/DatePicker.js +94 -12
  169. package/dist/collection/components/DatePicker/DatePicker.js.map +1 -1
  170. package/dist/collection/components/DatePicker/date-picker.css +63 -2
  171. package/dist/collection/components/DatePickerPane/DatePickerPane.js +1 -1
  172. package/dist/collection/components/DateRangePicker/DateRangePicker.js +2 -2
  173. package/dist/collection/components/DateTimePicker/DateTimePicker.js +2 -2
  174. package/dist/collection/components/Descriptions/Descriptions.js +1 -1
  175. package/dist/collection/components/Descriptions/descriptions.css +52 -10
  176. package/dist/collection/components/Dialog/Dialog.js +54 -10
  177. package/dist/collection/components/Dialog/Dialog.js.map +1 -1
  178. package/dist/collection/components/Dialog/dialog.css +57 -11
  179. package/dist/collection/components/Divider/Divider.js +2 -2
  180. package/dist/collection/components/Drawer/Drawer.js +34 -3
  181. package/dist/collection/components/Drawer/Drawer.js.map +1 -1
  182. package/dist/collection/components/Drawer/drawer.css +207 -17
  183. package/dist/collection/components/Dropdown/Dropdown.js +103 -12
  184. package/dist/collection/components/Dropdown/Dropdown.js.map +1 -1
  185. package/dist/collection/components/Dropdown/dropdown.css +26 -3
  186. package/dist/collection/components/Empty/Empty.js +1 -1
  187. package/dist/collection/components/FloatButton/FloatButton.js +2 -2
  188. package/dist/collection/components/Form/Form.js +14 -9
  189. package/dist/collection/components/Form/Form.js.map +1 -1
  190. package/dist/collection/components/Form/FormItem.js +62 -10
  191. package/dist/collection/components/Form/FormItem.js.map +1 -1
  192. package/dist/collection/components/Form/form-item.css +57 -6
  193. package/dist/collection/components/Form/form.css +1 -0
  194. package/dist/collection/components/Image/Image.js +24 -3
  195. package/dist/collection/components/Image/Image.js.map +1 -1
  196. package/dist/collection/components/ImagePreview/ImagePreview.js +13 -9
  197. package/dist/collection/components/ImagePreview/ImagePreview.js.map +1 -1
  198. package/dist/collection/components/Input/Input.js +39 -2
  199. package/dist/collection/components/Input/Input.js.map +1 -1
  200. package/dist/collection/components/Input/input.css +22 -4
  201. package/dist/collection/components/InputNumber/InputNumber.js +6 -6
  202. package/dist/collection/components/InputNumber/InputNumber.js.map +1 -1
  203. package/dist/collection/components/InputNumber/input-number.css +11 -1
  204. package/dist/collection/components/InputTag/InputTag.js +2 -2
  205. package/dist/collection/components/Layout/Layout.js +87 -34
  206. package/dist/collection/components/Layout/Layout.js.map +1 -1
  207. package/dist/collection/components/Layout/Row.js +2 -2
  208. package/dist/collection/components/Layout/layout.css +1732 -71
  209. package/dist/collection/components/Link/Link.js +2 -2
  210. package/dist/collection/components/Loading/Loading.js +2 -2
  211. package/dist/collection/components/Menu/Menu.js +2 -2
  212. package/dist/collection/components/Menu/MenuItem.js +34 -5
  213. package/dist/collection/components/Menu/MenuItem.js.map +1 -1
  214. package/dist/collection/components/Menu/SubMenu.js +4 -4
  215. package/dist/collection/components/Menu/menu.css +25 -0
  216. package/dist/collection/components/Message/Message.js +13 -4
  217. package/dist/collection/components/Message/Message.js.map +1 -1
  218. package/dist/collection/components/Notification/Notification.js +2 -2
  219. package/dist/collection/components/PageHeader/PageHeader.js +1 -1
  220. package/dist/collection/components/Pagination/Pagination.js +26 -7
  221. package/dist/collection/components/Pagination/Pagination.js.map +1 -1
  222. package/dist/collection/components/Pagination/pagination.css +23 -0
  223. package/dist/collection/components/Popconfirm/Popconfirm.js +66 -7
  224. package/dist/collection/components/Popconfirm/Popconfirm.js.map +1 -1
  225. package/dist/collection/components/Popconfirm/popconfirm.css +80 -16
  226. package/dist/collection/components/Popover/Popover.js +46 -4
  227. package/dist/collection/components/Popover/Popover.js.map +1 -1
  228. package/dist/collection/components/Popover/popover.css +49 -8
  229. package/dist/collection/components/Progress/Progress.js +1 -1
  230. package/dist/collection/components/Radio/Radio.js +8 -3
  231. package/dist/collection/components/Radio/Radio.js.map +1 -1
  232. package/dist/collection/components/Rate/Rate.js +46 -4
  233. package/dist/collection/components/Rate/Rate.js.map +1 -1
  234. package/dist/collection/components/Result/Result.js +1 -1
  235. package/dist/collection/components/Scrollbar/Scrollbar.js +5 -5
  236. package/dist/collection/components/Scrollbar/Scrollbar.js.map +1 -1
  237. package/dist/collection/components/Segmented/Segmented.js +65 -6
  238. package/dist/collection/components/Segmented/Segmented.js.map +1 -1
  239. package/dist/collection/components/Select/Select.js +63 -15
  240. package/dist/collection/components/Select/Select.js.map +1 -1
  241. package/dist/collection/components/Select/select.css +50 -5
  242. package/dist/collection/components/Slider/Slider.js +218 -24
  243. package/dist/collection/components/Slider/Slider.js.map +1 -1
  244. package/dist/collection/components/Slider/slider.css +57 -7
  245. package/dist/collection/components/Space/Space.js +2 -2
  246. package/dist/collection/components/Statistic/Statistic.js +1 -1
  247. package/dist/collection/components/Steps/Step.js +1 -1
  248. package/dist/collection/components/Steps/Steps.js +35 -8
  249. package/dist/collection/components/Steps/Steps.js.map +1 -1
  250. package/dist/collection/components/Switch/Switch.js +8 -3
  251. package/dist/collection/components/Switch/Switch.js.map +1 -1
  252. package/dist/collection/components/Switch/switch.css +47 -1
  253. package/dist/collection/components/Table/Table.js +25 -16
  254. package/dist/collection/components/Table/Table.js.map +1 -1
  255. package/dist/collection/components/Table/table.css +26 -2
  256. package/dist/collection/components/Tabs/TabPane.js +1 -1
  257. package/dist/collection/components/Tabs/Tabs.js +31 -10
  258. package/dist/collection/components/Tabs/Tabs.js.map +1 -1
  259. package/dist/collection/components/Tag/Tag.js +3 -2
  260. package/dist/collection/components/Tag/Tag.js.map +1 -1
  261. package/dist/collection/components/Text/Text.js +2 -2
  262. package/dist/collection/components/TimePicker/TimePicker.js +14 -9
  263. package/dist/collection/components/TimePicker/TimePicker.js.map +1 -1
  264. package/dist/collection/components/TimeSelect/TimeSelect.js +13 -4
  265. package/dist/collection/components/TimeSelect/TimeSelect.js.map +1 -1
  266. package/dist/collection/components/Timeline/Timeline.js +1 -1
  267. package/dist/collection/components/Tooltip/Tooltip.js +52 -6
  268. package/dist/collection/components/Tooltip/Tooltip.js.map +1 -1
  269. package/dist/collection/components/Tooltip/tooltip.css +24 -2
  270. package/dist/collection/components/Transfer/Transfer.js +2 -2
  271. package/dist/collection/components/Tree/Tree.js +147 -13
  272. package/dist/collection/components/Tree/Tree.js.map +1 -1
  273. package/dist/collection/components/TreeSelect/TreeSelect.js +219 -23
  274. package/dist/collection/components/TreeSelect/TreeSelect.js.map +1 -1
  275. package/dist/collection/components/TreeSelect/tree-select.css +41 -7
  276. package/dist/collection/components/Upload/Upload.js +3 -3
  277. package/dist/collection/components/Watermark/Watermark.js +19 -11
  278. package/dist/collection/components/Watermark/Watermark.js.map +1 -1
  279. package/dist/collection/utils/a11y.js +15 -1
  280. package/dist/collection/utils/a11y.js.map +1 -1
  281. package/dist/collection/utils/date-helpers.js +9 -16
  282. package/dist/collection/utils/date-helpers.js.map +1 -1
  283. package/dist/collection/utils/transition.js +29 -0
  284. package/dist/collection/utils/transition.js.map +1 -0
  285. package/dist/components/hb-affix.js +1 -1
  286. package/dist/components/hb-alert.js +2 -1
  287. package/dist/components/hb-alert.js.map +1 -1
  288. package/dist/components/hb-aside.js +1 -1
  289. package/dist/components/hb-avatar.js +1 -1
  290. package/dist/components/hb-backtop.js +2 -2
  291. package/dist/components/hb-badge.js +1 -1
  292. package/dist/components/hb-breadcrumb-item.js +1 -1
  293. package/dist/components/hb-breadcrumb.js +1 -1
  294. package/dist/components/hb-button.js +2 -2
  295. package/dist/components/hb-calendar.js +80 -11
  296. package/dist/components/hb-calendar.js.map +1 -1
  297. package/dist/components/hb-card.js +1 -1
  298. package/dist/components/hb-cascader.js +309 -146
  299. package/dist/components/hb-cascader.js.map +1 -1
  300. package/dist/components/hb-checkbox-group.js +12 -8
  301. package/dist/components/hb-checkbox-group.js.map +1 -1
  302. package/dist/components/hb-checkbox.js +9 -4
  303. package/dist/components/hb-checkbox.js.map +1 -1
  304. package/dist/components/hb-collapse-item.js +14 -4
  305. package/dist/components/hb-collapse-item.js.map +1 -1
  306. package/dist/components/hb-collapse.js +20 -15
  307. package/dist/components/hb-collapse.js.map +1 -1
  308. package/dist/components/hb-color-picker-panel.js +2 -2
  309. package/dist/components/hb-color-picker.js +110 -29
  310. package/dist/components/hb-color-picker.js.map +1 -1
  311. package/dist/components/hb-config-provider.js +1 -1
  312. package/dist/components/hb-container.js +2 -2
  313. package/dist/components/hb-date-picker-pane.js +2 -2
  314. package/dist/components/hb-date-picker.js +92 -10
  315. package/dist/components/hb-date-picker.js.map +1 -1
  316. package/dist/components/hb-date-range-picker.js +3 -3
  317. package/dist/components/hb-date-time-picker.js +3 -3
  318. package/dist/components/hb-descriptions.js +2 -2
  319. package/dist/components/hb-descriptions.js.map +1 -1
  320. package/dist/components/hb-dialog.js +53 -13
  321. package/dist/components/hb-dialog.js.map +1 -1
  322. package/dist/components/hb-divider.js +2 -2
  323. package/dist/components/hb-drawer.js +36 -5
  324. package/dist/components/hb-drawer.js.map +1 -1
  325. package/dist/components/hb-dropdown.js +94 -12
  326. package/dist/components/hb-dropdown.js.map +1 -1
  327. package/dist/components/hb-empty.js +1 -1
  328. package/dist/components/hb-float-button.js +2 -2
  329. package/dist/components/hb-footer.js +1 -1
  330. package/dist/components/hb-form-item.js +61 -9
  331. package/dist/components/hb-form-item.js.map +1 -1
  332. package/dist/components/hb-form.js +13 -8
  333. package/dist/components/hb-form.js.map +1 -1
  334. package/dist/components/hb-header.js +1 -1
  335. package/dist/components/hb-icon.js +1 -89
  336. package/dist/components/hb-icon.js.map +1 -1
  337. package/dist/components/hb-image-preview.js +13 -9
  338. package/dist/components/hb-image-preview.js.map +1 -1
  339. package/dist/components/hb-image.js +23 -3
  340. package/dist/components/hb-image.js.map +1 -1
  341. package/dist/components/hb-input-number.js +7 -7
  342. package/dist/components/hb-input-number.js.map +1 -1
  343. package/dist/components/hb-input-tag.js +2 -2
  344. package/dist/components/hb-input.js +40 -3
  345. package/dist/components/hb-input.js.map +1 -1
  346. package/dist/components/hb-layout.js +36 -14
  347. package/dist/components/hb-layout.js.map +1 -1
  348. package/dist/components/hb-link.js +2 -2
  349. package/dist/components/hb-loading.js +2 -2
  350. package/dist/components/hb-main.js +1 -1
  351. package/dist/components/hb-menu-item.js +15 -5
  352. package/dist/components/hb-menu-item.js.map +1 -1
  353. package/dist/components/hb-menu.js +3 -3
  354. package/dist/components/hb-menu.js.map +1 -1
  355. package/dist/components/hb-message.js +13 -4
  356. package/dist/components/hb-message.js.map +1 -1
  357. package/dist/components/hb-notification.js +2 -2
  358. package/dist/components/hb-page-header.js +1 -1
  359. package/dist/components/hb-pagination.js +28 -10
  360. package/dist/components/hb-pagination.js.map +1 -1
  361. package/dist/components/hb-popconfirm.js +58 -8
  362. package/dist/components/hb-popconfirm.js.map +1 -1
  363. package/dist/components/hb-popover.js +38 -5
  364. package/dist/components/hb-popover.js.map +1 -1
  365. package/dist/components/hb-progress.js +1 -1
  366. package/dist/components/hb-radio.js +8 -3
  367. package/dist/components/hb-radio.js.map +1 -1
  368. package/dist/components/hb-rate.js +46 -4
  369. package/dist/components/hb-rate.js.map +1 -1
  370. package/dist/components/hb-result.js +1 -1
  371. package/dist/components/hb-row.js +2 -2
  372. package/dist/components/hb-scrollbar.js +5 -5
  373. package/dist/components/hb-scrollbar.js.map +1 -1
  374. package/dist/components/hb-segmented.js +54 -6
  375. package/dist/components/hb-segmented.js.map +1 -1
  376. package/dist/components/hb-select.js +64 -16
  377. package/dist/components/hb-select.js.map +1 -1
  378. package/dist/components/hb-slider.js +191 -24
  379. package/dist/components/hb-slider.js.map +1 -1
  380. package/dist/components/hb-space.js +2 -2
  381. package/dist/components/hb-statistic.js +1 -1
  382. package/dist/components/hb-step.js +1 -1
  383. package/dist/components/hb-steps.js +35 -8
  384. package/dist/components/hb-steps.js.map +1 -1
  385. package/dist/components/hb-sub-menu.js +5 -5
  386. package/dist/components/hb-switch.js +9 -4
  387. package/dist/components/hb-switch.js.map +1 -1
  388. package/dist/components/hb-tab-pane.js +1 -1
  389. package/dist/components/hb-table.js +26 -17
  390. package/dist/components/hb-table.js.map +1 -1
  391. package/dist/components/hb-tabs.js +31 -10
  392. package/dist/components/hb-tabs.js.map +1 -1
  393. package/dist/components/hb-tag.js +3 -2
  394. package/dist/components/hb-tag.js.map +1 -1
  395. package/dist/components/hb-text.js +2 -2
  396. package/dist/components/hb-time-picker.js +14 -9
  397. package/dist/components/hb-time-picker.js.map +1 -1
  398. package/dist/components/hb-time-select.js +13 -4
  399. package/dist/components/hb-time-select.js.map +1 -1
  400. package/dist/components/hb-timeline.js +1 -1
  401. package/dist/components/hb-tooltip.js +44 -6
  402. package/dist/components/hb-tooltip.js.map +1 -1
  403. package/dist/components/hb-transfer.js +2 -2
  404. package/dist/components/hb-tree-select.js +219 -24
  405. package/dist/components/hb-tree-select.js.map +1 -1
  406. package/dist/components/hb-tree.js +147 -13
  407. package/dist/components/hb-tree.js.map +1 -1
  408. package/dist/components/hb-upload.js +3 -3
  409. package/dist/components/hb-watermark.js +19 -11
  410. package/dist/components/hb-watermark.js.map +1 -1
  411. package/dist/components/{p-cc0aeb50.js → p-00aa34c8.js} +17 -3
  412. package/dist/components/p-00aa34c8.js.map +1 -0
  413. package/dist/components/p-86d92faf.js +93 -0
  414. package/dist/components/p-86d92faf.js.map +1 -0
  415. package/dist/{esm/date-helpers-e4d85a67.js → components/p-e0876aca.js} +10 -17
  416. package/dist/components/p-e0876aca.js.map +1 -0
  417. package/dist/components/p-fad66d69.js +32 -0
  418. package/dist/components/p-fad66d69.js.map +1 -0
  419. package/dist/esm/{a11y-f9ab2964.js → a11y-e4cde5b0.js} +17 -3
  420. package/dist/esm/a11y-e4cde5b0.js.map +1 -0
  421. package/dist/{components/p-cf94cbf6.js → esm/date-helpers-259ed2f1.js} +10 -17
  422. package/dist/esm/date-helpers-259ed2f1.js.map +1 -0
  423. package/dist/esm/hb-affix.entry.js +1 -1
  424. package/dist/esm/hb-alert.entry.js +2 -1
  425. package/dist/esm/hb-alert.entry.js.map +1 -1
  426. package/dist/esm/hb-aside.entry.js +1 -1
  427. package/dist/esm/hb-avatar.entry.js +1 -1
  428. package/dist/esm/hb-backtop.entry.js +2 -2
  429. package/dist/esm/hb-badge.entry.js +1 -1
  430. package/dist/esm/hb-breadcrumb-item.entry.js +1 -1
  431. package/dist/esm/hb-breadcrumb.entry.js +1 -1
  432. package/dist/esm/hb-button.entry.js +2 -2
  433. package/dist/esm/hb-calendar.entry.js +78 -10
  434. package/dist/esm/hb-calendar.entry.js.map +1 -1
  435. package/dist/esm/hb-card.entry.js +1 -1
  436. package/dist/esm/hb-cascader.entry.js +306 -146
  437. package/dist/esm/hb-cascader.entry.js.map +1 -1
  438. package/dist/esm/hb-checkbox-group.entry.js +12 -8
  439. package/dist/esm/hb-checkbox-group.entry.js.map +1 -1
  440. package/dist/esm/hb-checkbox.entry.js +9 -4
  441. package/dist/esm/hb-checkbox.entry.js.map +1 -1
  442. package/dist/esm/hb-collapse-item.entry.js +13 -4
  443. package/dist/esm/hb-collapse-item.entry.js.map +1 -1
  444. package/dist/esm/hb-collapse.entry.js +20 -15
  445. package/dist/esm/hb-collapse.entry.js.map +1 -1
  446. package/dist/esm/hb-color-picker-panel.entry.js +2 -2
  447. package/dist/esm/hb-color-picker.entry.js +108 -28
  448. package/dist/esm/hb-color-picker.entry.js.map +1 -1
  449. package/dist/esm/hb-config-provider.entry.js +1 -1
  450. package/dist/esm/hb-container.entry.js +2 -2
  451. package/dist/esm/hb-date-picker-pane.entry.js +2 -2
  452. package/dist/esm/hb-date-picker.entry.js +90 -9
  453. package/dist/esm/hb-date-picker.entry.js.map +1 -1
  454. package/dist/esm/hb-date-range-picker.entry.js +3 -3
  455. package/dist/esm/hb-date-time-picker.entry.js +3 -3
  456. package/dist/esm/hb-descriptions.entry.js +2 -2
  457. package/dist/esm/hb-descriptions.entry.js.map +1 -1
  458. package/dist/esm/hb-dialog.entry.js +51 -12
  459. package/dist/esm/hb-dialog.entry.js.map +1 -1
  460. package/dist/esm/hb-divider.entry.js +2 -2
  461. package/dist/esm/hb-drawer.entry.js +34 -4
  462. package/dist/esm/hb-drawer.entry.js.map +1 -1
  463. package/dist/esm/hb-dropdown.entry.js +91 -11
  464. package/dist/esm/hb-dropdown.entry.js.map +1 -1
  465. package/dist/esm/hb-empty.entry.js +1 -1
  466. package/dist/esm/hb-float-button.entry.js +2 -2
  467. package/dist/esm/hb-footer.entry.js +1 -1
  468. package/dist/esm/hb-form-item.entry.js +61 -9
  469. package/dist/esm/hb-form-item.entry.js.map +1 -1
  470. package/dist/esm/hb-form.entry.js +13 -8
  471. package/dist/esm/hb-form.entry.js.map +1 -1
  472. package/dist/esm/hb-header.entry.js +1 -1
  473. package/dist/esm/hb-image-preview.entry.js +13 -9
  474. package/dist/esm/hb-image-preview.entry.js.map +1 -1
  475. package/dist/esm/hb-image.entry.js +21 -3
  476. package/dist/esm/hb-image.entry.js.map +1 -1
  477. package/dist/esm/hb-input-number.entry.js +7 -7
  478. package/dist/esm/hb-input-number.entry.js.map +1 -1
  479. package/dist/esm/hb-input-tag.entry.js +2 -2
  480. package/dist/esm/hb-input.entry.js +40 -3
  481. package/dist/esm/hb-input.entry.js.map +1 -1
  482. package/dist/esm/hb-layout.entry.js +36 -14
  483. package/dist/esm/hb-layout.entry.js.map +1 -1
  484. package/dist/esm/hb-link.entry.js +2 -2
  485. package/dist/esm/hb-loading.entry.js +2 -2
  486. package/dist/esm/hb-main.entry.js +1 -1
  487. package/dist/esm/hb-menu-item.entry.js +14 -5
  488. package/dist/esm/hb-menu-item.entry.js.map +1 -1
  489. package/dist/esm/hb-menu.entry.js +3 -3
  490. package/dist/esm/hb-menu.entry.js.map +1 -1
  491. package/dist/esm/hb-message.entry.js +13 -4
  492. package/dist/esm/hb-message.entry.js.map +1 -1
  493. package/dist/esm/hb-notification.entry.js +2 -2
  494. package/dist/esm/hb-page-header.entry.js +1 -1
  495. package/dist/esm/hb-pagination.entry.js +24 -8
  496. package/dist/esm/hb-pagination.entry.js.map +1 -1
  497. package/dist/esm/hb-popconfirm.entry.js +57 -8
  498. package/dist/esm/hb-popconfirm.entry.js.map +1 -1
  499. package/dist/esm/hb-popover.entry.js +37 -5
  500. package/dist/esm/hb-popover.entry.js.map +1 -1
  501. package/dist/esm/hb-progress.entry.js +1 -1
  502. package/dist/esm/hb-radio.entry.js +8 -3
  503. package/dist/esm/hb-radio.entry.js.map +1 -1
  504. package/dist/esm/hb-rate.entry.js +46 -4
  505. package/dist/esm/hb-rate.entry.js.map +1 -1
  506. package/dist/esm/hb-result.entry.js +1 -1
  507. package/dist/esm/hb-row.entry.js +2 -2
  508. package/dist/esm/hb-scrollbar.entry.js +5 -5
  509. package/dist/esm/hb-scrollbar.entry.js.map +1 -1
  510. package/dist/esm/hb-segmented.entry.js +51 -6
  511. package/dist/esm/hb-segmented.entry.js.map +1 -1
  512. package/dist/esm/hb-select.entry.js +64 -16
  513. package/dist/esm/hb-select.entry.js.map +1 -1
  514. package/dist/esm/hb-slider.entry.js +186 -23
  515. package/dist/esm/hb-slider.entry.js.map +1 -1
  516. package/dist/esm/hb-space.entry.js +2 -2
  517. package/dist/esm/hb-statistic.entry.js +1 -1
  518. package/dist/esm/hb-step.entry.js +1 -1
  519. package/dist/esm/hb-steps.entry.js +28 -7
  520. package/dist/esm/hb-steps.entry.js.map +1 -1
  521. package/dist/esm/hb-sub-menu.entry.js +5 -5
  522. package/dist/esm/hb-switch.entry.js +9 -4
  523. package/dist/esm/hb-switch.entry.js.map +1 -1
  524. package/dist/esm/hb-tab-pane.entry.js +1 -1
  525. package/dist/esm/hb-table.entry.js +26 -17
  526. package/dist/esm/hb-table.entry.js.map +1 -1
  527. package/dist/esm/hb-tabs.entry.js +31 -10
  528. package/dist/esm/hb-tabs.entry.js.map +1 -1
  529. package/dist/esm/hb-tag.entry.js +3 -2
  530. package/dist/esm/hb-tag.entry.js.map +1 -1
  531. package/dist/esm/hb-text.entry.js +2 -2
  532. package/dist/esm/hb-time-picker.entry.js +14 -9
  533. package/dist/esm/hb-time-picker.entry.js.map +1 -1
  534. package/dist/esm/hb-time-select.entry.js +13 -4
  535. package/dist/esm/hb-time-select.entry.js.map +1 -1
  536. package/dist/esm/hb-timeline.entry.js +1 -1
  537. package/dist/esm/hb-tooltip.entry.js +43 -6
  538. package/dist/esm/hb-tooltip.entry.js.map +1 -1
  539. package/dist/esm/hb-transfer.entry.js +2 -2
  540. package/dist/esm/hb-tree-select.entry.js +215 -23
  541. package/dist/esm/hb-tree-select.entry.js.map +1 -1
  542. package/dist/esm/hb-tree.entry.js +145 -12
  543. package/dist/esm/hb-tree.entry.js.map +1 -1
  544. package/dist/esm/hb-upload.entry.js +3 -3
  545. package/dist/esm/hb-watermark.entry.js +19 -11
  546. package/dist/esm/hb-watermark.entry.js.map +1 -1
  547. package/dist/esm/huibo-ui.js +1 -1
  548. package/dist/esm/loader.js +1 -1
  549. package/dist/esm/transition-4295d789.js +32 -0
  550. package/dist/esm/transition-4295d789.js.map +1 -0
  551. package/dist/huibo-ui/huibo-ui.css +1 -1
  552. package/dist/huibo-ui/huibo-ui.esm.js +1 -1
  553. package/dist/huibo-ui/huibo-ui.esm.js.map +1 -1
  554. package/dist/huibo-ui/p-00aa34c8.js +2 -0
  555. package/dist/huibo-ui/p-00aa34c8.js.map +1 -0
  556. package/dist/huibo-ui/p-02f15843.entry.js +2 -0
  557. package/dist/huibo-ui/p-0cc1e3f3.entry.js +2 -0
  558. package/dist/huibo-ui/p-0cc1e3f3.entry.js.map +1 -0
  559. package/dist/huibo-ui/{p-f1c084c5.entry.js → p-0ddae4e9.entry.js} +2 -2
  560. package/dist/huibo-ui/{p-672076c3.entry.js → p-10f6c184.entry.js} +2 -2
  561. package/dist/huibo-ui/p-10f6c184.entry.js.map +1 -0
  562. package/dist/huibo-ui/{p-6ac242fe.entry.js → p-14c3b47b.entry.js} +2 -2
  563. package/dist/huibo-ui/{p-8c80a765.entry.js → p-15db24e9.entry.js} +2 -2
  564. package/dist/huibo-ui/{p-8b027491.entry.js → p-193efdc0.entry.js} +2 -2
  565. package/dist/huibo-ui/{p-8d925e3d.entry.js → p-1b0fbe69.entry.js} +2 -2
  566. package/dist/huibo-ui/{p-85f68526.entry.js → p-1b98152b.entry.js} +2 -2
  567. package/dist/huibo-ui/p-1b98152b.entry.js.map +1 -0
  568. package/dist/huibo-ui/p-1f6d0adb.entry.js +2 -0
  569. package/dist/huibo-ui/p-1f6d0adb.entry.js.map +1 -0
  570. package/dist/huibo-ui/{p-f374d5a3.entry.js → p-20632186.entry.js} +2 -2
  571. package/dist/huibo-ui/{p-e6f2d71d.entry.js → p-20fc554b.entry.js} +2 -2
  572. package/dist/huibo-ui/{p-64ca0980.entry.js → p-29092b85.entry.js} +2 -2
  573. package/dist/huibo-ui/p-29092b85.entry.js.map +1 -0
  574. package/dist/huibo-ui/p-2bc30b1b.entry.js +2 -0
  575. package/dist/huibo-ui/p-2bc30b1b.entry.js.map +1 -0
  576. package/dist/huibo-ui/{p-fd19813c.entry.js → p-2bcda1bb.entry.js} +2 -2
  577. package/dist/huibo-ui/{p-231a7335.entry.js → p-2ca9796a.entry.js} +2 -2
  578. package/dist/huibo-ui/p-2ca9796a.entry.js.map +1 -0
  579. package/dist/huibo-ui/{p-e0768565.entry.js → p-3042f986.entry.js} +2 -2
  580. package/dist/huibo-ui/{p-be48d2aa.entry.js → p-3dacb26b.entry.js} +2 -2
  581. package/dist/huibo-ui/{p-6a1ec3ff.entry.js → p-3deff48c.entry.js} +2 -2
  582. package/dist/huibo-ui/{p-c321c4aa.entry.js → p-412ff618.entry.js} +2 -2
  583. package/dist/huibo-ui/p-415295f3.entry.js +2 -0
  584. package/dist/huibo-ui/p-415295f3.entry.js.map +1 -0
  585. package/dist/huibo-ui/p-494e6c25.entry.js +2 -0
  586. package/dist/huibo-ui/p-494e6c25.entry.js.map +1 -0
  587. package/dist/huibo-ui/p-4d87d7f4.entry.js +2 -0
  588. package/dist/huibo-ui/p-4d87d7f4.entry.js.map +1 -0
  589. package/dist/huibo-ui/p-54a28052.entry.js +2 -0
  590. package/dist/huibo-ui/p-54a28052.entry.js.map +1 -0
  591. package/dist/huibo-ui/{p-88127de1.entry.js → p-55cd13eb.entry.js} +2 -2
  592. package/dist/huibo-ui/{p-58ebb9b3.entry.js → p-5c839288.entry.js} +2 -2
  593. package/dist/huibo-ui/p-5e253c15.entry.js +2 -0
  594. package/dist/huibo-ui/p-5e253c15.entry.js.map +1 -0
  595. package/dist/huibo-ui/p-63d68c61.entry.js +2 -0
  596. package/dist/huibo-ui/p-63d68c61.entry.js.map +1 -0
  597. package/dist/huibo-ui/{p-a042e3d0.entry.js → p-6518c435.entry.js} +2 -2
  598. package/dist/huibo-ui/p-687d8dff.entry.js +2 -0
  599. package/dist/huibo-ui/p-687d8dff.entry.js.map +1 -0
  600. package/dist/huibo-ui/p-688460ce.entry.js +2 -0
  601. package/dist/huibo-ui/p-688460ce.entry.js.map +1 -0
  602. package/dist/huibo-ui/p-69bb1dd9.entry.js +2 -0
  603. package/dist/huibo-ui/p-69bb1dd9.entry.js.map +1 -0
  604. package/dist/huibo-ui/{p-a0015341.entry.js → p-6bfeab80.entry.js} +2 -2
  605. package/dist/huibo-ui/{p-4001c08d.entry.js → p-6c23fbd1.entry.js} +2 -2
  606. package/dist/huibo-ui/p-6c23fbd1.entry.js.map +1 -0
  607. package/dist/huibo-ui/p-6c8cf248.entry.js +2 -0
  608. package/dist/huibo-ui/p-6c8cf248.entry.js.map +1 -0
  609. package/dist/huibo-ui/p-6efed295.entry.js +2 -0
  610. package/dist/huibo-ui/p-6efed295.entry.js.map +1 -0
  611. package/dist/huibo-ui/{p-8b1ae77e.entry.js → p-746a11a3.entry.js} +2 -2
  612. package/dist/huibo-ui/{p-c3e8893d.entry.js → p-79b24b83.entry.js} +2 -2
  613. package/dist/huibo-ui/p-79b24b83.entry.js.map +1 -0
  614. package/dist/huibo-ui/p-7a38b3e2.entry.js +2 -0
  615. package/dist/huibo-ui/p-7a38b3e2.entry.js.map +1 -0
  616. package/dist/huibo-ui/{p-c922d672.entry.js → p-7a682c56.entry.js} +2 -2
  617. package/dist/huibo-ui/{p-8c987d57.entry.js → p-7f65dc36.entry.js} +2 -2
  618. package/dist/huibo-ui/{p-463de26d.entry.js → p-815fc943.entry.js} +2 -2
  619. package/dist/huibo-ui/{p-d87fc21a.entry.js → p-88a6c905.entry.js} +2 -2
  620. package/dist/huibo-ui/{p-77017274.entry.js → p-89be7973.entry.js} +2 -2
  621. package/dist/huibo-ui/p-8a202bc5.entry.js +2 -0
  622. package/dist/huibo-ui/p-8a202bc5.entry.js.map +1 -0
  623. package/dist/huibo-ui/{p-315feadf.entry.js → p-8c4415ed.entry.js} +2 -2
  624. package/dist/huibo-ui/p-8c4415ed.entry.js.map +1 -0
  625. package/dist/huibo-ui/{p-9319c650.entry.js → p-950e7465.entry.js} +2 -2
  626. package/dist/huibo-ui/{p-6b381d0e.entry.js → p-96cecd21.entry.js} +2 -2
  627. package/dist/huibo-ui/p-96cecd21.entry.js.map +1 -0
  628. package/dist/huibo-ui/{p-710f38de.entry.js → p-98b513cd.entry.js} +2 -2
  629. package/dist/huibo-ui/p-98b513cd.entry.js.map +1 -0
  630. package/dist/huibo-ui/{p-5df47135.entry.js → p-a190ca89.entry.js} +2 -2
  631. package/dist/huibo-ui/{p-0e65e1bd.entry.js → p-ac18c68b.entry.js} +2 -2
  632. package/dist/huibo-ui/p-ac18c68b.entry.js.map +1 -0
  633. package/dist/huibo-ui/{p-d64b91ef.entry.js → p-ac45291c.entry.js} +2 -2
  634. package/dist/huibo-ui/p-ac45291c.entry.js.map +1 -0
  635. package/dist/huibo-ui/{p-477d8568.entry.js → p-aeae83af.entry.js} +2 -2
  636. package/dist/huibo-ui/{p-b489a526.entry.js → p-b06c8020.entry.js} +2 -2
  637. package/dist/huibo-ui/{p-dfaf7e37.entry.js → p-b105cf76.entry.js} +2 -2
  638. package/dist/huibo-ui/p-b105cf76.entry.js.map +1 -0
  639. package/dist/huibo-ui/{p-c3e665f6.entry.js → p-b38802b0.entry.js} +2 -2
  640. package/dist/huibo-ui/p-b38802b0.entry.js.map +1 -0
  641. package/dist/huibo-ui/{p-ea74fcae.entry.js → p-b3fd12c7.entry.js} +2 -2
  642. package/dist/huibo-ui/p-b3fd12c7.entry.js.map +1 -0
  643. package/dist/huibo-ui/p-b5ea18ba.entry.js +2 -0
  644. package/dist/huibo-ui/p-b5ea18ba.entry.js.map +1 -0
  645. package/dist/huibo-ui/{p-e2a8a396.entry.js → p-b6afe81e.entry.js} +2 -2
  646. package/dist/huibo-ui/{p-2b286698.entry.js → p-b7885d4a.entry.js} +2 -2
  647. package/dist/huibo-ui/p-b7900dee.entry.js +2 -0
  648. package/dist/huibo-ui/p-b7900dee.entry.js.map +1 -0
  649. package/dist/huibo-ui/p-b8c83751.entry.js +2 -0
  650. package/dist/huibo-ui/p-b8c83751.entry.js.map +1 -0
  651. package/dist/huibo-ui/p-c7713947.entry.js +2 -0
  652. package/dist/huibo-ui/p-c7713947.entry.js.map +1 -0
  653. package/dist/huibo-ui/{p-e0ab9010.entry.js → p-c869842c.entry.js} +2 -2
  654. package/dist/huibo-ui/p-c869842c.entry.js.map +1 -0
  655. package/dist/huibo-ui/{p-476527c1.entry.js → p-c8e917db.entry.js} +2 -2
  656. package/dist/huibo-ui/p-c8e917db.entry.js.map +1 -0
  657. package/dist/huibo-ui/p-cb66dbef.entry.js +2 -0
  658. package/dist/huibo-ui/p-cb66dbef.entry.js.map +1 -0
  659. package/dist/huibo-ui/p-cde83f76.entry.js +2 -0
  660. package/dist/huibo-ui/p-cde83f76.entry.js.map +1 -0
  661. package/dist/huibo-ui/{p-10c088f3.entry.js → p-d9c7c378.entry.js} +2 -2
  662. package/dist/huibo-ui/{p-332c8877.entry.js → p-dd9c6459.entry.js} +2 -2
  663. package/dist/huibo-ui/{p-80aca641.entry.js → p-dfccc7aa.entry.js} +2 -2
  664. package/dist/huibo-ui/{p-21682e92.entry.js → p-dfd144d8.entry.js} +2 -2
  665. package/dist/huibo-ui/p-e0876aca.js +2 -0
  666. package/dist/huibo-ui/p-e0876aca.js.map +1 -0
  667. package/dist/huibo-ui/p-e1773c93.entry.js +2 -0
  668. package/dist/huibo-ui/p-e1773c93.entry.js.map +1 -0
  669. package/dist/huibo-ui/{p-079a4130.entry.js → p-e3155cd7.entry.js} +2 -2
  670. package/dist/huibo-ui/{p-59b2e61c.entry.js → p-e73c357f.entry.js} +2 -2
  671. package/dist/huibo-ui/p-e73c357f.entry.js.map +1 -0
  672. package/dist/huibo-ui/{p-c1b4eacb.entry.js → p-e7c73624.entry.js} +2 -2
  673. package/dist/huibo-ui/p-e7c73624.entry.js.map +1 -0
  674. package/dist/huibo-ui/{p-d7815b4f.entry.js → p-e9e7abca.entry.js} +2 -2
  675. package/dist/huibo-ui/{p-f81ec512.entry.js → p-ea0823f3.entry.js} +2 -2
  676. package/dist/huibo-ui/p-ea0823f3.entry.js.map +1 -0
  677. package/dist/huibo-ui/{p-2e6584ea.entry.js → p-f1f2483f.entry.js} +2 -2
  678. package/dist/huibo-ui/{p-465dcb4c.entry.js → p-f2c78699.entry.js} +2 -2
  679. package/dist/huibo-ui/p-fad66d69.js +2 -0
  680. package/dist/huibo-ui/p-fad66d69.js.map +1 -0
  681. package/dist/huibo-ui/{p-4d8b1404.entry.js → p-fd6831f9.entry.js} +2 -2
  682. package/dist/huibo-ui/p-ff6bc5cc.entry.js +2 -0
  683. package/dist/huibo-ui/p-ff6bc5cc.entry.js.map +1 -0
  684. package/dist/types/components/Calendar/Calendar.d.ts +13 -1
  685. package/dist/types/components/Cascader/Cascader.d.ts +80 -90
  686. package/dist/types/components/Checkbox/Checkbox.d.ts +5 -0
  687. package/dist/types/components/Checkbox/CheckboxGroup.d.ts +1 -0
  688. package/dist/types/components/Collapse/Collapse.d.ts +2 -0
  689. package/dist/types/components/Collapse/CollapseItem.d.ts +8 -1
  690. package/dist/types/components/ColorPicker/ColorPicker.d.ts +11 -0
  691. package/dist/types/components/DatePicker/DatePicker.d.ts +14 -3
  692. package/dist/types/components/Dialog/Dialog.d.ts +13 -1
  693. package/dist/types/components/Drawer/Drawer.d.ts +4 -0
  694. package/dist/types/components/Dropdown/Dropdown.d.ts +18 -1
  695. package/dist/types/components/Form/Form.d.ts +2 -0
  696. package/dist/types/components/Form/FormItem.d.ts +10 -0
  697. package/dist/types/components/Image/Image.d.ts +6 -0
  698. package/dist/types/components/ImagePreview/ImagePreview.d.ts +5 -1
  699. package/dist/types/components/Input/Input.d.ts +9 -0
  700. package/dist/types/components/Layout/Layout.d.ts +20 -10
  701. package/dist/types/components/Menu/MenuItem.d.ts +8 -1
  702. package/dist/types/components/Message/Message.d.ts +3 -0
  703. package/dist/types/components/Pagination/Pagination.d.ts +3 -0
  704. package/dist/types/components/Popconfirm/Popconfirm.d.ts +16 -0
  705. package/dist/types/components/Popover/Popover.d.ts +14 -0
  706. package/dist/types/components/Radio/Radio.d.ts +5 -0
  707. package/dist/types/components/Rate/Rate.d.ts +7 -0
  708. package/dist/types/components/Segmented/Segmented.d.ts +18 -1
  709. package/dist/types/components/Select/Select.d.ts +11 -0
  710. package/dist/types/components/Slider/Slider.d.ts +27 -1
  711. package/dist/types/components/Steps/Steps.d.ts +14 -6
  712. package/dist/types/components/Table/Table.d.ts +8 -2
  713. package/dist/types/components/Tabs/Tabs.d.ts +6 -0
  714. package/dist/types/components/Tooltip/Tooltip.d.ts +15 -1
  715. package/dist/types/components/Tree/Tree.d.ts +24 -0
  716. package/dist/types/components/TreeSelect/TreeSelect.d.ts +26 -0
  717. package/dist/types/components/Watermark/Watermark.d.ts +7 -1
  718. package/dist/types/components.d.ts +290 -98
  719. package/dist/types/utils/a11y.d.ts +9 -0
  720. package/dist/types/utils/date-helpers.d.ts +1 -1
  721. package/dist/types/utils/transition.d.ts +27 -0
  722. package/package.json +8 -2
  723. package/readme.md +88 -73
  724. package/dist/cjs/a11y-802de67a.js.map +0 -1
  725. package/dist/cjs/date-helpers-904747ff.js.map +0 -1
  726. package/dist/components/p-cc0aeb50.js.map +0 -1
  727. package/dist/components/p-cf94cbf6.js.map +0 -1
  728. package/dist/esm/a11y-f9ab2964.js.map +0 -1
  729. package/dist/esm/date-helpers-e4d85a67.js.map +0 -1
  730. package/dist/huibo-ui/p-003cee87.entry.js +0 -2
  731. package/dist/huibo-ui/p-003cee87.entry.js.map +0 -1
  732. package/dist/huibo-ui/p-0a033738.entry.js +0 -2
  733. package/dist/huibo-ui/p-0a033738.entry.js.map +0 -1
  734. package/dist/huibo-ui/p-0bef78ac.entry.js +0 -2
  735. package/dist/huibo-ui/p-0bef78ac.entry.js.map +0 -1
  736. package/dist/huibo-ui/p-0e65e1bd.entry.js.map +0 -1
  737. package/dist/huibo-ui/p-0f189251.entry.js +0 -2
  738. package/dist/huibo-ui/p-0f189251.entry.js.map +0 -1
  739. package/dist/huibo-ui/p-1b5acd6d.entry.js +0 -2
  740. package/dist/huibo-ui/p-1b5acd6d.entry.js.map +0 -1
  741. package/dist/huibo-ui/p-231a7335.entry.js.map +0 -1
  742. package/dist/huibo-ui/p-24ad7eec.entry.js +0 -2
  743. package/dist/huibo-ui/p-24ad7eec.entry.js.map +0 -1
  744. package/dist/huibo-ui/p-315feadf.entry.js.map +0 -1
  745. package/dist/huibo-ui/p-3c7f73c8.entry.js +0 -2
  746. package/dist/huibo-ui/p-3c7f73c8.entry.js.map +0 -1
  747. package/dist/huibo-ui/p-4001c08d.entry.js.map +0 -1
  748. package/dist/huibo-ui/p-44c48246.entry.js +0 -2
  749. package/dist/huibo-ui/p-44c48246.entry.js.map +0 -1
  750. package/dist/huibo-ui/p-476527c1.entry.js.map +0 -1
  751. package/dist/huibo-ui/p-4d0dff15.entry.js +0 -2
  752. package/dist/huibo-ui/p-58d20809.entry.js +0 -2
  753. package/dist/huibo-ui/p-58d20809.entry.js.map +0 -1
  754. package/dist/huibo-ui/p-59b2e61c.entry.js.map +0 -1
  755. package/dist/huibo-ui/p-64ca0980.entry.js.map +0 -1
  756. package/dist/huibo-ui/p-672076c3.entry.js.map +0 -1
  757. package/dist/huibo-ui/p-6b381d0e.entry.js.map +0 -1
  758. package/dist/huibo-ui/p-710f38de.entry.js.map +0 -1
  759. package/dist/huibo-ui/p-756acbdb.entry.js +0 -2
  760. package/dist/huibo-ui/p-756acbdb.entry.js.map +0 -1
  761. package/dist/huibo-ui/p-75a93de3.entry.js +0 -2
  762. package/dist/huibo-ui/p-75a93de3.entry.js.map +0 -1
  763. package/dist/huibo-ui/p-769960f4.entry.js +0 -2
  764. package/dist/huibo-ui/p-769960f4.entry.js.map +0 -1
  765. package/dist/huibo-ui/p-7f6975ad.entry.js +0 -2
  766. package/dist/huibo-ui/p-7f6975ad.entry.js.map +0 -1
  767. package/dist/huibo-ui/p-85f68526.entry.js.map +0 -1
  768. package/dist/huibo-ui/p-8d615521.entry.js +0 -2
  769. package/dist/huibo-ui/p-8d615521.entry.js.map +0 -1
  770. package/dist/huibo-ui/p-953b9514.entry.js +0 -2
  771. package/dist/huibo-ui/p-953b9514.entry.js.map +0 -1
  772. package/dist/huibo-ui/p-965d4d02.entry.js +0 -2
  773. package/dist/huibo-ui/p-965d4d02.entry.js.map +0 -1
  774. package/dist/huibo-ui/p-ad6b0c6e.entry.js +0 -2
  775. package/dist/huibo-ui/p-ad6b0c6e.entry.js.map +0 -1
  776. package/dist/huibo-ui/p-c1a059d9.entry.js +0 -2
  777. package/dist/huibo-ui/p-c1a059d9.entry.js.map +0 -1
  778. package/dist/huibo-ui/p-c1b4eacb.entry.js.map +0 -1
  779. package/dist/huibo-ui/p-c3e665f6.entry.js.map +0 -1
  780. package/dist/huibo-ui/p-c3e8893d.entry.js.map +0 -1
  781. package/dist/huibo-ui/p-cc0aeb50.js +0 -2
  782. package/dist/huibo-ui/p-cc0aeb50.js.map +0 -1
  783. package/dist/huibo-ui/p-cf94cbf6.js +0 -2
  784. package/dist/huibo-ui/p-cf94cbf6.js.map +0 -1
  785. package/dist/huibo-ui/p-d3939d44.entry.js +0 -2
  786. package/dist/huibo-ui/p-d3939d44.entry.js.map +0 -1
  787. package/dist/huibo-ui/p-d64b91ef.entry.js.map +0 -1
  788. package/dist/huibo-ui/p-dd05cb2c.entry.js +0 -2
  789. package/dist/huibo-ui/p-dd05cb2c.entry.js.map +0 -1
  790. package/dist/huibo-ui/p-dfaf7e37.entry.js.map +0 -1
  791. package/dist/huibo-ui/p-e0ab9010.entry.js.map +0 -1
  792. package/dist/huibo-ui/p-e9490259.entry.js +0 -2
  793. package/dist/huibo-ui/p-e9490259.entry.js.map +0 -1
  794. package/dist/huibo-ui/p-ea74fcae.entry.js.map +0 -1
  795. package/dist/huibo-ui/p-ebd04656.entry.js +0 -2
  796. package/dist/huibo-ui/p-ebd04656.entry.js.map +0 -1
  797. package/dist/huibo-ui/p-ed0ff857.entry.js +0 -2
  798. package/dist/huibo-ui/p-ed0ff857.entry.js.map +0 -1
  799. package/dist/huibo-ui/p-f0ac7db5.entry.js +0 -2
  800. package/dist/huibo-ui/p-f0ac7db5.entry.js.map +0 -1
  801. package/dist/huibo-ui/p-f81ec512.entry.js.map +0 -1
  802. /package/dist/huibo-ui/{p-4d0dff15.entry.js.map → p-02f15843.entry.js.map} +0 -0
  803. /package/dist/huibo-ui/{p-f1c084c5.entry.js.map → p-0ddae4e9.entry.js.map} +0 -0
  804. /package/dist/huibo-ui/{p-6ac242fe.entry.js.map → p-14c3b47b.entry.js.map} +0 -0
  805. /package/dist/huibo-ui/{p-8c80a765.entry.js.map → p-15db24e9.entry.js.map} +0 -0
  806. /package/dist/huibo-ui/{p-8b027491.entry.js.map → p-193efdc0.entry.js.map} +0 -0
  807. /package/dist/huibo-ui/{p-8d925e3d.entry.js.map → p-1b0fbe69.entry.js.map} +0 -0
  808. /package/dist/huibo-ui/{p-f374d5a3.entry.js.map → p-20632186.entry.js.map} +0 -0
  809. /package/dist/huibo-ui/{p-e6f2d71d.entry.js.map → p-20fc554b.entry.js.map} +0 -0
  810. /package/dist/huibo-ui/{p-fd19813c.entry.js.map → p-2bcda1bb.entry.js.map} +0 -0
  811. /package/dist/huibo-ui/{p-e0768565.entry.js.map → p-3042f986.entry.js.map} +0 -0
  812. /package/dist/huibo-ui/{p-be48d2aa.entry.js.map → p-3dacb26b.entry.js.map} +0 -0
  813. /package/dist/huibo-ui/{p-6a1ec3ff.entry.js.map → p-3deff48c.entry.js.map} +0 -0
  814. /package/dist/huibo-ui/{p-c321c4aa.entry.js.map → p-412ff618.entry.js.map} +0 -0
  815. /package/dist/huibo-ui/{p-88127de1.entry.js.map → p-55cd13eb.entry.js.map} +0 -0
  816. /package/dist/huibo-ui/{p-58ebb9b3.entry.js.map → p-5c839288.entry.js.map} +0 -0
  817. /package/dist/huibo-ui/{p-a042e3d0.entry.js.map → p-6518c435.entry.js.map} +0 -0
  818. /package/dist/huibo-ui/{p-a0015341.entry.js.map → p-6bfeab80.entry.js.map} +0 -0
  819. /package/dist/huibo-ui/{p-8b1ae77e.entry.js.map → p-746a11a3.entry.js.map} +0 -0
  820. /package/dist/huibo-ui/{p-c922d672.entry.js.map → p-7a682c56.entry.js.map} +0 -0
  821. /package/dist/huibo-ui/{p-8c987d57.entry.js.map → p-7f65dc36.entry.js.map} +0 -0
  822. /package/dist/huibo-ui/{p-463de26d.entry.js.map → p-815fc943.entry.js.map} +0 -0
  823. /package/dist/huibo-ui/{p-d87fc21a.entry.js.map → p-88a6c905.entry.js.map} +0 -0
  824. /package/dist/huibo-ui/{p-77017274.entry.js.map → p-89be7973.entry.js.map} +0 -0
  825. /package/dist/huibo-ui/{p-9319c650.entry.js.map → p-950e7465.entry.js.map} +0 -0
  826. /package/dist/huibo-ui/{p-5df47135.entry.js.map → p-a190ca89.entry.js.map} +0 -0
  827. /package/dist/huibo-ui/{p-477d8568.entry.js.map → p-aeae83af.entry.js.map} +0 -0
  828. /package/dist/huibo-ui/{p-b489a526.entry.js.map → p-b06c8020.entry.js.map} +0 -0
  829. /package/dist/huibo-ui/{p-e2a8a396.entry.js.map → p-b6afe81e.entry.js.map} +0 -0
  830. /package/dist/huibo-ui/{p-2b286698.entry.js.map → p-b7885d4a.entry.js.map} +0 -0
  831. /package/dist/huibo-ui/{p-10c088f3.entry.js.map → p-d9c7c378.entry.js.map} +0 -0
  832. /package/dist/huibo-ui/{p-332c8877.entry.js.map → p-dd9c6459.entry.js.map} +0 -0
  833. /package/dist/huibo-ui/{p-80aca641.entry.js.map → p-dfccc7aa.entry.js.map} +0 -0
  834. /package/dist/huibo-ui/{p-21682e92.entry.js.map → p-dfd144d8.entry.js.map} +0 -0
  835. /package/dist/huibo-ui/{p-079a4130.entry.js.map → p-e3155cd7.entry.js.map} +0 -0
  836. /package/dist/huibo-ui/{p-d7815b4f.entry.js.map → p-e9e7abca.entry.js.map} +0 -0
  837. /package/dist/huibo-ui/{p-2e6584ea.entry.js.map → p-f1f2483f.entry.js.map} +0 -0
  838. /package/dist/huibo-ui/{p-465dcb4c.entry.js.map → p-f2c78699.entry.js.map} +0 -0
  839. /package/dist/huibo-ui/{p-4d8b1404.entry.js.map → p-fd6831f9.entry.js.map} +0 -0
@@ -1 +1 @@
1
- {"file":"hb-dropdown.entry.js","mappings":";;;;AAAA,MAAM,WAAW,GAAG,mzNAAmzN,CAAC;AACx0N,yBAAe,WAAW;;MCoBb,QAAQ;;;;;;;IAIX,KAAK,GA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KAC/B,CAAC;IAEF,MAAM;QACJ,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,KAAK,OAAO;cAC1C,EAAE,YAAY,EAAE,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,IAAI,EAAE;cACpD,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;QAE7B,QACE,4DAAK,KAAK,EAAC,aAAa,KAAK,aAAa,IACxC,4DAAK,KAAK,EAAC,sBAAsB,IAC/B,8DAAQ,CACJ,EACL,IAAI,CAAC,MAAM,KACV,4DAAK,KAAK,EAAC,mBAAmB,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC,EAAE,IACtE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,KAClB,WACE,KAAK,EAAE;gBACL,mBAAmB,EAAE,IAAI;gBACzB,6BAA6B,EAAE,IAAI,CAAC,QAAQ;gBAC5C,4BAA4B,EAAE,IAAI,CAAC,OAAO;gBAC1C,2BAA2B,EAAE,IAAI,CAAC,MAAM;aACzC,EACD,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAErC,IAAI,CAAC,KAAK,CACP,CACP,CAAC,CACE,CACP,CACG,EACN;KACH;;;;;;","names":[],"sources":["src/components/Dropdown/dropdown.css?tag=hb-dropdown&encapsulation=shadow","src/components/Dropdown/Dropdown.tsx"],"sourcesContent":[":host {\n display: inline-block;\n position: relative;\n}\n\n.hb-dropdown__trigger {\n display: inline-block;\n cursor: pointer;\n}\n\n.hb-dropdown__menu {\n position: absolute;\n top: 100%;\n left: 0;\n min-width: 120px;\n margin-top: 4px;\n padding: 4px 0;\n background-color: var(--hb-color-bg-elevated);\n border-radius: var(--hb-border-radius-base);\n box-shadow: var(--hb-box-shadow);\n animation: hb-dropdown-fade-in 0.15s ease-out;\n}\n\n.hb-dropdown__item {\n display: flex;\n align-items: center;\n padding: 6px 16px;\n font-size: var(--hb-font-size-sm);\n color: var(--hb-color-text);\n cursor: pointer;\n white-space: nowrap;\n transition: background-color var(--hb-transition-duration);\n}\n\n.hb-dropdown__item:hover:not(.hb-dropdown__item--disabled) {\n background-color: var(--hb-color-fill-tertiary);\n color: var(--hb-color-primary);\n}\n\n.hb-dropdown__item--disabled {\n color: var(--hb-color-text-disabled);\n cursor: not-allowed;\n}\n\n.hb-dropdown__item--divided {\n margin-top: 4px;\n padding-top: 8px;\n border-top: 1px solid var(--hb-color-border-secondary);\n}\n\n.hb-dropdown__item--danger {\n color: var(--hb-color-danger);\n}\n.hb-dropdown__item--danger:hover:not(.hb-dropdown__item--disabled) {\n background-color: var(--hb-color-danger-bg);\n color: var(--hb-color-danger);\n}\n\n@keyframes hb-dropdown-fade-in {\n from { opacity: 0; transform: translateY(-4px); }\n to { opacity: 1; transform: translateY(0); }\n}\n","import { Component, h, Prop, State, Element, Event, EventEmitter } from '@stencil/core';\nimport { createClickOutsideHandler } from '../../utils/click-outside';\nimport { getNextZIndex } from '../../utils/popup-manager';\n\nexport interface DropdownItem {\n key: string;\n label: string;\n disabled?: boolean;\n divided?: boolean;\n danger?: boolean;\n}\n\n/**\n * Dropdown 下拉菜单组件\n * 将动作或菜单折叠到下拉菜单中\n */\n@Component({\n tag: 'hb-dropdown',\n styleUrl: 'dropdown.css',\n shadow: true,\n})\nexport class Dropdown {\n @Element() el: HTMLElement;\n\n /** 菜单项 */\n @Prop() items: DropdownItem[] = [];\n\n /** 触发方式 */\n @Prop() trigger: 'hover' | 'click' = 'hover';\n\n /** 是否禁用 */\n @Prop() disabled: boolean = false;\n\n @State() isOpen: boolean = false;\n\n /** 命令事件 */\n @Event() hbCommand: EventEmitter<string>;\n\n private clickOutside = createClickOutsideHandler({\n host: null as any,\n isOpen: () => this.isOpen,\n onClose: () => { this.isOpen = false; },\n });\n\n componentDidLoad() {\n this.clickOutside = createClickOutsideHandler({\n host: this.el,\n isOpen: () => this.isOpen,\n onClose: () => { this.isOpen = false; },\n });\n if (this.trigger === 'click') {\n this.clickOutside.connect();\n }\n }\n\n disconnectedCallback() {\n this.clickOutside.disconnect();\n }\n\n private show = () => {\n if (this.disabled) return;\n this.isOpen = true;\n };\n\n private hide = () => {\n this.isOpen = false;\n };\n\n private toggle = () => {\n if (this.disabled) return;\n this.isOpen = !this.isOpen;\n };\n\n private handleSelect = (item: DropdownItem) => {\n if (item.disabled) return;\n this.isOpen = false;\n this.hbCommand.emit(item.key);\n };\n\n render() {\n const triggerEvents = this.trigger === 'hover'\n ? { onMouseEnter: this.show, onMouseLeave: this.hide }\n : { onClick: this.toggle };\n\n return (\n <div class=\"hb-dropdown\" {...triggerEvents}>\n <div class=\"hb-dropdown__trigger\">\n <slot />\n </div>\n {this.isOpen && (\n <div class=\"hb-dropdown__menu\" style={{ zIndex: String(getNextZIndex()) }}>\n {this.items.map(item => (\n <div\n class={{\n 'hb-dropdown__item': true,\n 'hb-dropdown__item--disabled': item.disabled,\n 'hb-dropdown__item--divided': item.divided,\n 'hb-dropdown__item--danger': item.danger,\n }}\n onClick={() => this.handleSelect(item)}\n >\n {item.label}\n </div>\n ))}\n </div>\n )}\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"hb-dropdown.entry.js","mappings":";;;;;;AAAA,MAAM,WAAW,GAAG,+iOAA+iO,CAAC;AACpkO,yBAAe,WAAW;;MC6Bb,QAAQ;;;;;;;IAIX,KAAK,GAAmB,EAAE,CAAC;;IAG3B,OAAO,GAAsB,OAAO,CAAC;;IAGrC,QAAQ,GAAY,KAAK,CAAC;IAEzB,MAAM,GAAY,KAAK,CAAC;;IAExB,OAAO,GAAY,KAAK,CAAC;;IAEzB,WAAW,GAAW,CAAC,CAAC,CAAC;;IAGzB,SAAS,CAAuB;IAEjC,KAAK,GAAG,oBAAoB,CAClC,MAAM,IAAI,CAAC,OAAO,EAClB,CAAC,KAAK,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,EACvB,GAAG,CACJ,CAAC;IAEM,YAAY,GAAG,y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,KAChB,4DACE,KAAK,EAAE;gBACL,mBAAmB,EAAE,IAAI;gBACzB,4BAA4B,EAAE,IAAI,CAAC,OAAO;aAC3C,EACD,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC,EAAE,EAC1C,IAAI,EAAC,MAAM,EACX,SAAS,EAAE,IAAI,CAAC,iBAAiB,IAEhC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,MAC1B,WACE,KAAK,EAAE;gBACL,mBAAmB,EAAE,IAAI;gBACzB,6BAA6B,EAAE,IAAI,CAAC,QAAQ;gBAC5C,4BAA4B,EAAE,IAAI,CAAC,OAAO;gBAC1C,2BAA2B,EAAE,IAAI,CAAC,MAAM;gBACxC,2BAA2B,EAAE,KAAK,KAAK,IAAI,CAAC,WAAW;aACxD,EACD,IAAI,EAAC,UAAU,EACf,QAAQ,EAAE,CAAC,CAAC,mBACG,IAAI,CAAC,QAAQ,GAAG,MAAM,GAAG,SAAS,EACjD,YAAY,EAAE;gBACZ,IAAI,CAAC,IAAI,CAAC,QAAQ;oBAAE,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;aAC9C,EACD,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAErC,IAAI,CAAC,KAAK,CACP,CACP,CAAC,CACE,CACP,CACG,EACN;KACH;;;;;;","names":[],"sources":["src/components/Dropdown/dropdown.css?tag=hb-dropdown&encapsulation=shadow","src/components/Dropdown/Dropdown.tsx"],"sourcesContent":[":host {\n display: inline-block;\n position: relative;\n}\n\n.hb-dropdown__trigger {\n display: inline-block;\n cursor: pointer;\n}\n\n.hb-dropdown__menu {\n position: absolute;\n top: 100%;\n left: 0;\n min-width: 120px;\n margin-top: 4px;\n padding: 4px 0;\n background-color: var(--hb-color-bg-elevated);\n border-radius: var(--hb-border-radius-base);\n box-shadow: var(--hb-box-shadow);\n animation: hb-dropdown-fade-in 0.15s ease-out;\n}\n\n.hb-dropdown__item {\n display: flex;\n align-items: center;\n padding: 6px 16px;\n font-size: var(--hb-font-size-sm);\n color: var(--hb-color-text);\n cursor: pointer;\n white-space: nowrap;\n transition: background-color var(--hb-transition-duration);\n}\n\n.hb-dropdown__item:hover:not(.hb-dropdown__item--disabled),\n.hb-dropdown__item--active:not(.hb-dropdown__item--disabled) {\n background-color: var(--hb-color-fill-tertiary);\n color: var(--hb-color-primary);\n}\n\n.hb-dropdown__item--disabled {\n color: var(--hb-color-text-disabled);\n cursor: not-allowed;\n}\n\n.hb-dropdown__item--divided {\n margin-top: 4px;\n padding-top: 8px;\n border-top: 1px solid var(--hb-color-border-secondary);\n}\n\n.hb-dropdown__item--danger {\n color: var(--hb-color-danger);\n}\n.hb-dropdown__item--danger:hover:not(.hb-dropdown__item--disabled) {\n background-color: var(--hb-color-danger-bg);\n color: var(--hb-color-danger);\n}\n\n@keyframes hb-dropdown-fade-in {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n/* 离场动画 */\n.hb-dropdown__menu--leaving {\n animation: hb-dropdown-fade-out 0.15s ease-in forwards;\n}\n\n@keyframes hb-dropdown-fade-out {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n","import { Component, h, Prop, State, Element, Event, EventEmitter } from '@stencil/core';\nimport { createClickOutsideHandler } from '../../utils/click-outside';\nimport { getNextZIndex } from '../../utils/popup-manager';\nimport { handleListKeyboard, isActivationKey } from '../../utils/a11y';\nimport { createLeaveScheduler } from '../../utils/transition';\n\nexport interface DropdownItem {\n key: string;\n label: string;\n disabled?: boolean;\n divided?: boolean;\n danger?: boolean;\n}\n\n/**\n * Dropdown 下拉菜单组件\n * 将动作或菜单折叠到下拉菜单中。\n *\n * 无障碍(对齐 WAI-ARIA menu / antd):\n * - 触发器 role=button + aria-haspopup=menu + aria-expanded\n * - 菜单 role=menu,菜单项 role=menuitem + aria-disabled\n * - 键盘:trigger 上 Enter/Space/↓ 打开;菜单内 ↑↓ 导航、Enter/Space 选中、Esc 关闭\n *\n * 进出场动画:用 leaving state 延迟卸载,让 fade-out 有机会播放。\n */\n@Component({\n tag: 'hb-dropdown',\n styleUrl: 'dropdown.css',\n shadow: true,\n})\nexport class Dropdown {\n @Element() el: HTMLElement;\n\n /** 菜单项 */\n @Prop() items: DropdownItem[] = [];\n\n /** 触发方式 */\n @Prop() trigger: 'hover' | 'click' = 'hover';\n\n /** 是否禁用 */\n @Prop() disabled: boolean = false;\n\n @State() isOpen: boolean = false;\n /** 离场动画期(保留 DOM 让 fade-out 播完) */\n @State() leaving: boolean = false;\n /** 键盘高亮项索引(-1 表示无) */\n @State() activeIndex: number = -1;\n\n /** 命令事件 */\n @Event() hbCommand: EventEmitter<string>;\n\n private leave = createLeaveScheduler(\n () => this.leaving,\n v => (this.leaving = v),\n 150,\n );\n\n private clickOutside = createClickOutsideHandler({\n host: null as any,\n isOpen: () => this.isOpen,\n onClose: () => {\n this.close();\n },\n });\n\n componentDidLoad() {\n this.clickOutside = createClickOutsideHandler({\n host: this.el,\n isOpen: () => this.isOpen,\n onClose: () => {\n this.close();\n },\n });\n if (this.trigger === 'click') {\n this.clickOutside.connect();\n }\n }\n\n disconnectedCallback() {\n this.clickOutside.disconnect();\n this.leave.dispose();\n }\n\n private open = () => {\n if (this.disabled) return;\n this.leave.cancel(); // 中途又打开:取消挂起的离场\n this.isOpen = true;\n this.activeIndex = this.items.findIndex(i => !i.disabled);\n };\n\n private close = () => {\n if (!this.isOpen && !this.leaving) return;\n this.isOpen = false;\n this.activeIndex = -1;\n this.leave.start();\n };\n\n private show = () => {\n if (this.disabled) return;\n this.open();\n };\n\n private hide = () => {\n this.close();\n };\n\n private toggle = () => {\n if (this.disabled) return;\n if (this.isOpen) this.close();\n else this.open();\n };\n\n private handleSelect = (item: DropdownItem) => {\n if (item.disabled) return;\n this.close();\n this.hbCommand.emit(item.key);\n };\n\n private handleTriggerKeydown = (e: KeyboardEvent) => {\n if (this.disabled) return;\n if (this.trigger === 'hover') return;\n if (isActivationKey(e.key) || e.key === 'ArrowDown') {\n e.preventDefault();\n this.open();\n }\n };\n\n private handleMenuKeydown = (e: KeyboardEvent) => {\n const enabledCount = this.items.length;\n const action = handleListKeyboard(e, {\n activeIndex: this.activeIndex,\n itemCount: enabledCount,\n loop: true,\n });\n switch (action.type) {\n case 'navigate':\n e.preventDefault();\n {\n let idx = action.index;\n for (let i = 0; i < enabledCount; i++) {\n if (!this.items[idx]?.disabled) break;\n idx = (idx + 1) % enabledCount;\n }\n this.activeIndex = idx;\n }\n break;\n case 'select': {\n e.preventDefault();\n const item = this.items[action.index];\n if (item && !item.disabled) this.handleSelect(item);\n break;\n }\n case 'close':\n e.preventDefault();\n this.close();\n break;\n default:\n break;\n }\n };\n\n private get shouldRender(): boolean {\n return this.isOpen || this.leaving;\n }\n\n render() {\n const triggerEvents = this.trigger === 'hover' ? { onMouseEnter: this.show, onMouseLeave: this.hide } : { onClick: this.toggle };\n\n return (\n <div class=\"hb-dropdown\" {...triggerEvents} onKeyDown={this.handleTriggerKeydown}>\n <div\n class=\"hb-dropdown__trigger\"\n role=\"button\"\n tabindex={this.disabled ? -1 : 0}\n aria-haspopup=\"menu\"\n aria-expanded={this.isOpen ? 'true' : 'false'}\n aria-disabled={this.disabled ? 'true' : 'false'}\n >\n <slot />\n </div>\n {this.shouldRender && (\n <div\n class={{\n 'hb-dropdown__menu': true,\n 'hb-dropdown__menu--leaving': this.leaving,\n }}\n style={{ zIndex: String(getNextZIndex()) }}\n role=\"menu\"\n onKeyDown={this.handleMenuKeydown}\n >\n {this.items.map((item, index) => (\n <div\n class={{\n 'hb-dropdown__item': true,\n 'hb-dropdown__item--disabled': item.disabled,\n 'hb-dropdown__item--divided': item.divided,\n 'hb-dropdown__item--danger': item.danger,\n 'hb-dropdown__item--active': index === this.activeIndex,\n }}\n role=\"menuitem\"\n tabindex={-1}\n aria-disabled={item.disabled ? 'true' : undefined}\n onMouseEnter={() => {\n if (!item.disabled) this.activeIndex = index;\n }}\n onClick={() => this.handleSelect(item)}\n >\n {item.label}\n </div>\n ))}\n </div>\n )}\n </div>\n );\n }\n}\n"],"version":3}
@@ -10,7 +10,7 @@ const Empty = class {
10
10
  description = '暂无数据';
11
11
  image;
12
12
  render() {
13
- return (h("div", { key: '18b44f37a4a8cfb67405864fdc398c6fc91164c2', class: "hb-empty" }, h("div", { key: 'e30f3e869f5d0ed3b07fa470891dd3cdc3c4d24a', class: "hb-empty__image" }, this.image ? h("img", { src: this.image, alt: this.description }) : h("span", { class: "hb-empty__icon" }, "\uD83D\uDCED")), h("div", { key: '5d9df75bcb35f9df02d920e1350aeb733740f82d', class: "hb-empty__description" }, this.description), h("div", { key: 'cfd7273f7ecbf29504b66ee549de3d915a2dd98e', class: "hb-empty__footer" }, h("slot", { key: '1164418b74afa280c35c63ce807229201aceccdf' }))));
13
+ return (h("div", { key: '716385f61e4692d30d9ef0dab2671b4ee4a8381a', class: "hb-empty" }, h("div", { key: '39162ccfefa991ae63a59f585e7a91179b64523a', class: "hb-empty__image" }, this.image ? h("img", { src: this.image, alt: this.description }) : h("span", { class: "hb-empty__icon" }, "\uD83D\uDCED")), h("div", { key: '2ada1cc904ba094aaaf863d82ead88b81576590e', class: "hb-empty__description" }, this.description), h("div", { key: 'cb573d62ea4d81a66815a27be96617e0a3c3e470', class: "hb-empty__footer" }, h("slot", { key: '424ec328528ea66240ae4216e178bfc7f5ba2acd' }))));
14
14
  }
15
15
  };
16
16
  Empty.style = HbEmptyStyle0;
@@ -39,11 +39,11 @@ const FloatButton = class {
39
39
  right: `${this.right}px`,
40
40
  bottom: `${this.bottom}px`,
41
41
  };
42
- return (h("button", { key: '6457ed8d2174a9ad9e23be02a95d4cbb3952e4e0', type: "button", class: {
42
+ return (h("button", { key: '1c3836a10620e871fd54fdcacab8ed447329203f', type: "button", class: {
43
43
  'hb-float-button': true,
44
44
  [`hb-float-button--${this.type}`]: true,
45
45
  [`hb-float-button--${this.shape}`]: true,
46
- }, style: style, onClick: this.handleClick }, this.icon && h("span", { key: '21d687c58c84fdcdb74a4130cce591de92489ffc', class: "hb-float-button__icon" }, this.icon), this.description && h("span", { key: 'f8580e6a836a0004244c2d158917420a0c2e1a55', class: "hb-float-button__description" }, this.description), this.renderBadge()));
46
+ }, style: style, onClick: this.handleClick }, this.icon && h("span", { key: 'f0eaa8a4e40805f1442a55ec6830e2ed7aa54299', class: "hb-float-button__icon" }, this.icon), this.description && h("span", { key: '8f276ce89d0ace7f26ad65bb0d41dc0a4e262a45', class: "hb-float-button__description" }, this.description), this.renderBadge()));
47
47
  }
48
48
  };
49
49
  FloatButton.style = HbFloatButtonStyle0;
@@ -16,7 +16,7 @@ const Footer = class {
16
16
  if (this.height) {
17
17
  style.height = this.height;
18
18
  }
19
- return (h("footer", { key: 'a6a73df27a1e1a7891a436a0f57c337e27cb9328', class: "hb-footer", style: style }, h("slot", { key: '02927f1f9433b928f2552ef19e2e3fbd7cf69d44' })));
19
+ return (h("footer", { key: '65847074853df09c57dd2bcead1470dac15f5951', class: "hb-footer", style: style }, h("slot", { key: 'e0f976bf1b3cd1f3a7ae2609bdf9b621070dac10' })));
20
20
  }
21
21
  };
22
22
  Footer.style = HbFooterStyle0;
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, g as getElement, h } from './index-fdf7135e.js';
2
2
 
3
- const formItemCss = "/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.inline{display:inline}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}} /*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components;:host{display:block}.hb-form-item{align-items:flex-start;display:flex;gap:var(--hb-spacing-sm)}.hb-form-item__label{align-items:center;color:var(--hb-color-text);display:inline-flex;flex-shrink:0;font-size:var(--hb-font-size-sm);height:var(--hb-size-default);justify-content:flex-end;white-space:nowrap}.hb-form-item__required{color:var(--hb-color-danger);margin-right:4px}.hb-form-item__content{flex:1;position:relative}.hb-form-item__error{animation:hb-form-error-fade-in .2s ease-out;color:var(--hb-color-danger);font-size:var(--hb-font-size-xs);line-height:1;margin-top:4px}@keyframes hb-form-error-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}";
3
+ const formItemCss = "/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.inline{display:inline}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}} /*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components;:host{display:block}.hb-form-item{align-items:flex-start;display:flex;gap:var(--hb-spacing-sm)}.hb-form-item--label-top,:host([data-label-top]) .hb-form-item{align-items:stretch;flex-direction:column;gap:var(--hb-spacing-xs)}.hb-form-item__label{align-items:center;color:var(--hb-color-text);display:inline-flex;flex-shrink:0;font-size:var(--hb-font-size-sm,14px);height:var(--hb-size-default,32px);justify-content:flex-end;white-space:nowrap}.hb-form-item--label-top .hb-form-item__label,:host([data-label-top]) .hb-form-item__label{height:auto;justify-content:flex-start;padding-bottom:var(--hb-spacing-xxs,2px)}.hb-form-item--label-left .hb-form-item__label{justify-content:flex-start}.hb-form-item__required{color:var(--hb-color-danger);font-family:SimSun,sans-serif;font-size:var(--hb-font-size-sm,14px);margin-right:4px}.hb-form-item__content{flex:1;min-width:0;position:relative}.hb-form-item__error{animation:hb-form-error-fade-in .2s ease-out;color:var(--hb-color-danger);font-size:var(--hb-font-size-xs,12px);line-height:1.5;margin-top:4px;min-height:0}@keyframes hb-form-error-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@media (max-width:575.98px){.hb-form-item{align-items:stretch!important;flex-direction:column!important;gap:var(--hb-spacing-xs)!important}.hb-form-item__label{height:auto!important;justify-content:flex-start!important;padding-bottom:var(--hb-spacing-xxs,2px)!important}}";
4
4
  const HbFormItemStyle0 = formItemCss;
5
5
 
6
6
  const FormItem = class {
@@ -22,6 +22,9 @@ const FormItem = class {
22
22
  size = 'default';
23
23
  errors = [];
24
24
  isvalidating = false;
25
+ /** hb-form 在 componentWillLoad 注册的事件监听;FormItem 在 componentDidLoad 派发,
26
+ * 但 componentWillLoad 早于子组件的 componentDidLoad,因此注册一定先到。
27
+ * 这里还监听 hbFieldReset,便于 Form.resetFields 主动广播。 */
25
28
  componentDidLoad() {
26
29
  // 向父级 hb-form 注册
27
30
  this.el.dispatchEvent(new CustomEvent('hbFormFieldRegister', {
@@ -32,14 +35,37 @@ const FormItem = class {
32
35
  getValue: this.getValue,
33
36
  },
34
37
  bubbles: true,
38
+ composed: true, // 穿越 Shadow DOM 边界(FormItem 自身 shadow -> Form host)
35
39
  }));
40
+ // 子控件值变化时清错(对齐 antd:合法输入即移除错误提示)
41
+ this.el.addEventListener('hbChange', this.handleChildChange);
36
42
  }
43
+ disconnectedCallback() {
44
+ this.el.removeEventListener('hbChange', this.handleChildChange);
45
+ }
46
+ /** 子控件 hbChange 时,若当前有错误则重新校验以尽早清除错误提示 */
47
+ handleChildChange = () => {
48
+ if (this.errors.length > 0) {
49
+ void this.validate();
50
+ }
51
+ };
37
52
  get formRules() {
38
53
  // 合并 prop 对应的 form rules 和自身 rules
39
54
  const form = this.el.closest('hb-form');
40
55
  const formLevelRules = form ? form.rules?.[this.prop] || [] : [];
41
56
  return [...formLevelRules, ...this.rules];
42
57
  }
58
+ /** 是否渲染必填星号:显式 required 或任一规则带 required(对齐 antd 自动推断) */
59
+ get isRequired() {
60
+ if (this.required)
61
+ return true;
62
+ return this.formRules.some(r => r && r.required);
63
+ }
64
+ /** 继承父 hb-form 的 labelPosition(FormItem 自身无此 prop,避免与 Form 冲突时以 Form 为准) */
65
+ get resolvedLabelPosition() {
66
+ const form = this.el.closest('hb-form');
67
+ return (form && form.labelPosition) || 'right';
68
+ }
43
69
  /**
44
70
  * 验证此字段
45
71
  */
@@ -53,13 +79,27 @@ const FormItem = class {
53
79
  this.isvalidating = true;
54
80
  const errors = [];
55
81
  for (const rule of rules) {
56
- if (rule.required && (!value && value !== 0)) {
82
+ // 必填校验:空字符串 / null / undefined / 空数组均视为"未填"
83
+ const isEmpty = value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0);
84
+ if (rule.required && isEmpty) {
57
85
  errors.push(rule.message || `${this.label || this.prop}不能为空`);
58
86
  continue;
59
87
  }
60
- if (rule.pattern && !rule.pattern.test(value)) {
61
- errors.push(rule.message || `${this.label || this.prop}格式不正确`);
88
+ // 非必填且为空时,跳过后续格式校验(与 antd 行为一致)
89
+ if (isEmpty)
62
90
  continue;
91
+ if (rule.pattern) {
92
+ const ok = typeof rule.pattern === 'string' ? new RegExp(rule.pattern).test(String(value)) : rule.pattern.test(String(value));
93
+ if (!ok) {
94
+ errors.push(rule.message || `${this.label || this.prop}格式不正确`);
95
+ continue;
96
+ }
97
+ }
98
+ if (rule.type === 'email') {
99
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(value))) {
100
+ errors.push(rule.message || `${this.label || this.prop}格式不正确`);
101
+ continue;
102
+ }
63
103
  }
64
104
  if (rule.min !== undefined && typeof value === 'string' && value.length < rule.min) {
65
105
  errors.push(rule.message || `${this.label || this.prop}最少${rule.min}个字符`);
@@ -86,19 +126,31 @@ const FormItem = class {
86
126
  this.errors = [];
87
127
  };
88
128
  getValue = () => {
89
- // 尝试从子元素中获取值
90
- const input = this.el.querySelector('hb-input, hb-select, hb-cascader, hb-date-picker, hb-input-number, hb-textarea, hb-checkbox, hb-radio, hb-switch');
129
+ // 覆盖所有表单控件:input/select/cascader/date 系列/数字/checkbox/radio/switch/slider/color-picker/rate/upload
130
+ const input = this.el.querySelector('hb-input, hb-select, hb-cascader, hb-date-picker, hb-date-time-picker, hb-date-range-picker, ' +
131
+ 'hb-input-number, hb-textarea, hb-checkbox, hb-checkbox-group, hb-radio-group, hb-switch, ' +
132
+ 'hb-slider, hb-color-picker, hb-rate, hb-time-picker, hb-time-select');
91
133
  if (input) {
92
134
  return input.modelValue;
93
135
  }
94
136
  return undefined;
95
137
  };
96
138
  render() {
97
- return (h("div", { key: '9ea6c55b9159936a572eef459adea96234fbe2fa', class: {
139
+ const labelTop = this.resolvedLabelPosition === 'top';
140
+ const hasError = this.errors.length > 0;
141
+ // A4:label 与内容关联。子控件是 slot(id 未知),无法用 label.for;
142
+ // 改用 content 容器 role=group + aria-labelledby 指向 label id,
143
+ // 把 label 语义绑到整组;并用 aria-required / aria-invalid 暴露必填与校验态(读屏可感知,
144
+ // 不再仅靠红色 + 隐藏星号)。
145
+ const labelId = this.label ? `hb-form-item__label-${this.prop || 'x'}` : undefined;
146
+ return (h("div", { key: 'ad51782227c637557a1cc0a4be2397b20f63b2e2', class: {
98
147
  'hb-form-item': true,
99
- 'hb-form-item--error': this.errors.length > 0,
148
+ 'hb-form-item--error': hasError,
100
149
  'hb-form-item--validating': this.isvalidating,
101
- } }, this.label && (h("label", { key: '3f21b8777f7cddba09e797a706edfb9539fd2aa6', class: "hb-form-item__label", style: this.labelWidth ? { width: this.labelWidth } : undefined }, this.required && h("span", { key: 'fd89829e1469ff625d30e3b38624e9fc2a9566b4', class: "hb-form-item__required" }, "*"), this.label)), h("div", { key: '83ac6765623cf8c0c897ab945abdb0f1f0c3cde2', class: "hb-form-item__content" }, h("slot", { key: '83f01e59dc6f984141ff26dc58ebf72ff77a4fe1' }), this.errors.length > 0 && (h("div", { key: '17d938b71257dedb8154b4f019127f03b43f1910', class: "hb-form-item__error" }, this.errors[0])))));
150
+ 'hb-form-item--required': this.isRequired,
151
+ 'hb-form-item--label-top': labelTop,
152
+ 'hb-form-item--label-left': this.resolvedLabelPosition === 'left',
153
+ } }, this.label && (h("label", { key: '22b4830775644a315a797c91ca77045015632cf5', id: labelId, class: "hb-form-item__label", style: this.labelWidth ? { width: this.labelWidth } : undefined, title: this.label }, this.isRequired && (h("span", { key: '43c4db5f65f68f8a9db2362c8cdf724069895238', class: "hb-form-item__required", "aria-hidden": "true" }, "*")), this.label)), h("div", { key: '0fe8dda2a5b0363c55ca6e19d1c2b0e3a44e503f', class: "hb-form-item__content", role: "group", "aria-labelledby": labelId, "aria-required": this.isRequired ? 'true' : undefined, "aria-invalid": hasError ? 'true' : undefined }, h("slot", { key: '6b714ffde9c6a0f9112aef9a28519ba42df0fa96' }), hasError && (h("div", { key: '41a97ac3f7f0dccd9938d9dbf844852c085d0b72', class: "hb-form-item__error", role: "alert" }, this.errors[0])))));
102
154
  }
103
155
  };
104
156
  FormItem.style = HbFormItemStyle0;
@@ -1 +1 @@
1
- {"file":"hb-form-item.entry.js","mappings":";;AAAA,MAAM,WAAW,GAAG,qzMAAqzM,CAAC;AAC10M,yBAAe,WAAW;;MCUb,QAAQ;;;;;;IAIX,IAAI,GAAW,EAAE,CAAC;;IAGlB,KAAK,GAAW,EAAE,CAAC;;IAGnB,UAAU,CAAU;;IAGpB,QAAQ,GAAY,KAAK,CAAC;;IAG1B,KAAK,GAAU,EAAE,CAAC;;IAGlB,IAAI,GAAkC,SAAS,CAAC;IAE/C,MAAM,GAAa,EAAE,CAAC;IACtB,YAAY,GAAY,KAAK,CAAC;IAEvC,gBAAgB;;QAEd,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,qBAAqB,EAAE;YAC3D,MAAM,EAAE;gBACN,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB;YACD,OAAO,EAAE,IAAI;SACd,CAAC,CAAC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DACE,KAAK,EAAE;gBACL,cAAc,EAAE,IAAI;gBACpB,qBAAqB,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;gBAC7C,0BAA0B,EAAE,IAAI,CAAC,YAAY;aAC9C,IAEA,IAAI,CAAC,KAAK,KACT,8DACE,KAAK,EAAC,qBAAqB,EAC3B,KAAK,EAAE,IAAI,CAAC,UAAU,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,SAAS,IAE9D,IAAI,CAAC,QAAQ,IAAI,6DAAM,KAAK,EAAC,wBAAwB,QAAS,EAC9D,IAAI,CAAC,KAAK,CACL,CACT,EACD,4DAAK,KAAK,EAAC,uBAAuB,IAChC,8DAAQ,EACP,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,KACrB,4DAAK,KAAK,EAAC,qBAAqB,IAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAO,CACxD,CACG,CACF,EACN;KACH;;;;;;","names":[],"sources":["src/components/Form/form-item.css?tag=hb-form-item&encapsulation=shadow","src/components/Form/FormItem.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.hb-form-item {\n display: flex;\n align-items: flex-start;\n gap: var(--hb-spacing-sm);\n}\n\n.hb-form-item__label {\n display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n height: var(--hb-size-default);\n font-size: var(--hb-font-size-sm);\n color: var(--hb-color-text);\n white-space: nowrap;\n flex-shrink: 0;\n}\n\n.hb-form-item__required {\n color: var(--hb-color-danger);\n margin-right: 4px;\n}\n\n.hb-form-item__content {\n flex: 1;\n position: relative;\n}\n\n.hb-form-item__error {\n font-size: var(--hb-font-size-xs);\n color: var(--hb-color-danger);\n margin-top: 4px;\n line-height: 1;\n animation: hb-form-error-fade-in 0.2s ease-out;\n}\n\n@keyframes hb-form-error-fade-in {\n from { opacity: 0; transform: translateY(-4px); }\n to { opacity: 1; transform: translateY(0); }\n}\n","import { Component, h, Prop, State, Element } from '@stencil/core';\n\n/**\n * FormItem 表单项组件\n * 表单中的每一项\n */\n@Component({\n tag: 'hb-form-item',\n styleUrl: 'form-item.css',\n shadow: true,\n})\nexport class FormItem {\n @Element() el: HTMLElement;\n\n /** 字段名 */\n @Prop() prop: string = '';\n\n /** 标签文本 */\n @Prop() label: string = '';\n\n /** 标签宽度 */\n @Prop() labelWidth?: string;\n\n /** 是否必填 */\n @Prop() required: boolean = false;\n\n /** 该表单项的验证规则 */\n @Prop() rules: any[] = [];\n\n /** 表单尺寸 */\n @Prop() size: 'large' | 'default' | 'small' = 'default';\n\n @State() errors: string[] = [];\n @State() isvalidating: boolean = false;\n\n componentDidLoad() {\n // 向父级 hb-form 注册\n this.el.dispatchEvent(new CustomEvent('hbFormFieldRegister', {\n detail: {\n prop: this.prop,\n validate: this.validate,\n resetValue: this.resetValue,\n getValue: this.getValue,\n },\n bubbles: true,\n }));\n }\n\n private get formRules(): any[] {\n // 合并 prop 对应的 form rules 和自身 rules\n const form = this.el.closest('hb-form');\n const formLevelRules = form ? (form as any).rules?.[this.prop] || [] : [];\n return [...formLevelRules, ...this.rules];\n }\n\n /**\n * 验证此字段\n */\n @Prop() validate = async (): Promise<string[]> => {\n const value = this.getValue();\n const rules = this.formRules;\n\n if (rules.length === 0) {\n this.errors = [];\n return [];\n }\n\n this.isvalidating = true;\n const errors: string[] = [];\n\n for (const rule of rules) {\n if (rule.required && (!value && value !== 0)) {\n errors.push(rule.message || `${this.label || this.prop}不能为空`);\n continue;\n }\n if (rule.pattern && !rule.pattern.test(value)) {\n errors.push(rule.message || `${this.label || this.prop}格式不正确`);\n continue;\n }\n if (rule.min !== undefined && typeof value === 'string' && value.length < rule.min) {\n errors.push(rule.message || `${this.label || this.prop}最少${rule.min}个字符`);\n continue;\n }\n if (rule.max !== undefined && typeof value === 'string' && value.length > rule.max) {\n errors.push(rule.message || `${this.label || this.prop}最多${rule.max}个字符`);\n continue;\n }\n if (rule.validator) {\n try {\n await rule.validator(value, this.formRules);\n } catch (err: any) {\n errors.push(err.message || rule.message || `${this.label || this.prop}验证失败`);\n }\n }\n }\n\n this.errors = errors;\n this.isvalidating = false;\n return errors;\n };\n\n @Prop() resetValue = () => {\n this.errors = [];\n };\n\n @Prop() getValue = (): any => {\n // 尝试从子元素中获取值\n const input = this.el.querySelector('hb-input, hb-select, hb-cascader, hb-date-picker, hb-input-number, hb-textarea, hb-checkbox, hb-radio, hb-switch');\n if (input) {\n return (input as any).modelValue;\n }\n return undefined;\n };\n\n render() {\n return (\n <div\n class={{\n 'hb-form-item': true,\n 'hb-form-item--error': this.errors.length > 0,\n 'hb-form-item--validating': this.isvalidating,\n }}\n >\n {this.label && (\n <label\n class=\"hb-form-item__label\"\n style={this.labelWidth ? { width: this.labelWidth } : undefined}\n >\n {this.required && <span class=\"hb-form-item__required\">*</span>}\n {this.label}\n </label>\n )}\n <div class=\"hb-form-item__content\">\n <slot />\n {this.errors.length > 0 && (\n <div class=\"hb-form-item__error\">{this.errors[0]}</div>\n )}\n </div>\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"hb-form-item.entry.js","mappings":";;AAAA,MAAM,WAAW,GAAG,yiOAAyiO,CAAC;AAC9jO,yBAAe,WAAW;;MCUb,QAAQ;;;;;;IAIX,IAAI,GAAW,EAAE,CAAC;;IAGlB,KAAK,GAAW,EAAE,CAAC;;IAGnB,UAAU,CAAU;;IAGpB,QAAQ,GAAY,KAAK,CAAC;;IAG1B,KAAK,GAAU,EAAE,CAAC;;IAGlB,IAAI,GAAkC,SAAS,CAAC;IAE/C,MAAM,GAAa,EAAE,CAAC;IACtB,YAAY,GAAY,KAAK,CAAC;;;;IAMvC,gBAAgB;;QAEd,IAAI,CAAC,EAAE,CAAC,aAAa,CACnB,IAAI,WAAW,CAAC,qBAAqB,EAAE;YACrC,MAAM,EAAE;gBACN,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,UAAU,EAAE,IAAI,CAAC,UAAU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,QAAQ,GAAG,MAAM,GAAG,SAAS,IACxK,8DAAQ,EACP,QAAQ,KACP,4DAAK,KAAK,EAAC,qBAAqB,EAAC,IAAI,EAAC,OAAO,IAC1C,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CACX,CACP,CACG,CACF,EACN;KACH;;;;;;","names":[],"sources":["src/components/Form/form-item.css?tag=hb-form-item&encapsulation=shadow","src/components/Form/FormItem.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.hb-form-item {\n display: flex;\n align-items: flex-start;\n gap: var(--hb-spacing-sm);\n}\n\n/* label 位置:顶部(对齐 antd label-position=\"top\")——\n 需要 Form 通过 class 下发,但 FormItem 在独立使用时也支持自身包装。\n 这里用 :host([data-label-position=\"top\"]) 兜底,Form 可通过 setting attribute 生效。 */\n:host([data-label-top]) .hb-form-item,\n.hb-form-item--label-top {\n flex-direction: column;\n align-items: stretch;\n gap: var(--hb-spacing-xs);\n}\n\n.hb-form-item__label {\n display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n height: var(--hb-size-default, 32px);\n font-size: var(--hb-font-size-sm, 14px);\n color: var(--hb-color-text);\n white-space: nowrap;\n flex-shrink: 0;\n}\n\n/* label-position=top 时标签左对齐 */\n:host([data-label-top]) .hb-form-item__label,\n.hb-form-item--label-top .hb-form-item__label {\n justify-content: flex-start;\n height: auto;\n padding-bottom: var(--hb-spacing-xxs, 2px);\n}\n\n/* label-position=left 时标签左对齐 */\n.hb-form-item--label-left .hb-form-item__label {\n justify-content: flex-start;\n}\n\n.hb-form-item__required {\n color: var(--hb-color-danger);\n margin-right: 4px;\n font-size: var(--hb-font-size-sm, 14px);\n font-family: SimSun, sans-serif;\n}\n\n.hb-form-item__content {\n flex: 1;\n position: relative;\n min-width: 0;\n}\n\n.hb-form-item__error {\n font-size: var(--hb-font-size-xs, 12px);\n color: var(--hb-color-danger);\n margin-top: 4px;\n line-height: 1.5;\n min-height: 0;\n animation: hb-form-error-fade-in 0.2s ease-out;\n}\n\n@keyframes hb-form-error-fade-in {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n/* ============================================================\n * 响应式(移动端):小屏强制 label 顶部布局,\n * 避免标签列在窄屏被挤压。覆盖 hb-form-item--label-left/right。\n * ============================================================ */\n@media (max-width: 575.98px) {\n .hb-form-item {\n flex-direction: column !important;\n align-items: stretch !important;\n gap: var(--hb-spacing-xs) !important;\n }\n\n .hb-form-item__label {\n justify-content: flex-start !important;\n height: auto !important;\n padding-bottom: var(--hb-spacing-xxs, 2px) !important;\n }\n}\n","import { Component, h, Prop, State, Element } from '@stencil/core';\n\n/**\n * FormItem 表单项组件\n * 表单中的每一项\n */\n@Component({\n tag: 'hb-form-item',\n styleUrl: 'form-item.css',\n shadow: true,\n})\nexport class FormItem {\n @Element() el: HTMLElement;\n\n /** 字段名 */\n @Prop() prop: string = '';\n\n /** 标签文本 */\n @Prop() label: string = '';\n\n /** 标签宽度 */\n @Prop() labelWidth?: string;\n\n /** 是否必填 */\n @Prop() required: boolean = false;\n\n /** 该表单项的验证规则 */\n @Prop() rules: any[] = [];\n\n /** 表单尺寸 */\n @Prop() size: 'large' | 'default' | 'small' = 'default';\n\n @State() errors: string[] = [];\n @State() isvalidating: boolean = false;\n\n /** hb-form 在 componentWillLoad 注册的事件监听;FormItem 在 componentDidLoad 派发,\n * 但 componentWillLoad 早于子组件的 componentDidLoad,因此注册一定先到。\n * 这里还监听 hbFieldReset,便于 Form.resetFields 主动广播。 */\n\n componentDidLoad() {\n // 向父级 hb-form 注册\n this.el.dispatchEvent(\n new CustomEvent('hbFormFieldRegister', {\n detail: {\n prop: this.prop,\n validate: this.validate,\n resetValue: this.resetValue,\n getValue: this.getValue,\n },\n bubbles: true,\n composed: true, // 穿越 Shadow DOM 边界(FormItem 自身 shadow -> Form host)\n }),\n );\n\n // 子控件值变化时清错(对齐 antd:合法输入即移除错误提示)\n this.el.addEventListener('hbChange', this.handleChildChange);\n }\n\n disconnectedCallback() {\n this.el.removeEventListener('hbChange', this.handleChildChange);\n }\n\n /** 子控件 hbChange 时,若当前有错误则重新校验以尽早清除错误提示 */\n private handleChildChange = () => {\n if (this.errors.length > 0) {\n void this.validate();\n }\n };\n\n private get formRules(): any[] {\n // 合并 prop 对应的 form rules 和自身 rules\n const form = this.el.closest('hb-form');\n const formLevelRules = form ? (form as any).rules?.[this.prop] || [] : [];\n return [...formLevelRules, ...this.rules];\n }\n\n /** 是否渲染必填星号:显式 required 或任一规则带 required(对齐 antd 自动推断) */\n private get isRequired(): boolean {\n if (this.required) return true;\n return this.formRules.some(r => r && r.required);\n }\n\n /** 继承父 hb-form 的 labelPosition(FormItem 自身无此 prop,避免与 Form 冲突时以 Form 为准) */\n private get resolvedLabelPosition(): 'left' | 'right' | 'top' {\n const form = this.el.closest('hb-form') as any;\n return (form && form.labelPosition) || 'right';\n }\n\n /**\n * 验证此字段\n */\n @Prop() validate = async (): Promise<string[]> => {\n const value = this.getValue();\n const rules = this.formRules;\n\n if (rules.length === 0) {\n this.errors = [];\n return [];\n }\n\n this.isvalidating = true;\n const errors: string[] = [];\n\n for (const rule of rules) {\n // 必填校验:空字符串 / null / undefined / 空数组均视为\"未填\"\n const isEmpty = value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0);\n if (rule.required && isEmpty) {\n errors.push(rule.message || `${this.label || this.prop}不能为空`);\n continue;\n }\n // 非必填且为空时,跳过后续格式校验(与 antd 行为一致)\n if (isEmpty) continue;\n if (rule.pattern) {\n const ok = typeof rule.pattern === 'string' ? new RegExp(rule.pattern).test(String(value)) : rule.pattern.test(String(value));\n if (!ok) {\n errors.push(rule.message || `${this.label || this.prop}格式不正确`);\n continue;\n }\n }\n if (rule.type === 'email') {\n if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(String(value))) {\n errors.push(rule.message || `${this.label || this.prop}格式不正确`);\n continue;\n }\n }\n if (rule.min !== undefined && typeof value === 'string' && value.length < rule.min) {\n errors.push(rule.message || `${this.label || this.prop}最少${rule.min}个字符`);\n continue;\n }\n if (rule.max !== undefined && typeof value === 'string' && value.length > rule.max) {\n errors.push(rule.message || `${this.label || this.prop}最多${rule.max}个字符`);\n continue;\n }\n if (rule.validator) {\n try {\n await rule.validator(value, this.formRules);\n } catch (err: any) {\n errors.push(err.message || rule.message || `${this.label || this.prop}验证失败`);\n }\n }\n }\n\n this.errors = errors;\n this.isvalidating = false;\n return errors;\n };\n\n @Prop() resetValue = () => {\n this.errors = [];\n };\n\n @Prop() getValue = (): any => {\n // 覆盖所有表单控件:input/select/cascader/date 系列/数字/checkbox/radio/switch/slider/color-picker/rate/upload\n const input = this.el.querySelector(\n 'hb-input, hb-select, hb-cascader, hb-date-picker, hb-date-time-picker, hb-date-range-picker, ' +\n 'hb-input-number, hb-textarea, hb-checkbox, hb-checkbox-group, hb-radio-group, hb-switch, ' +\n 'hb-slider, hb-color-picker, hb-rate, hb-time-picker, hb-time-select',\n );\n if (input) {\n return (input as any).modelValue;\n }\n return undefined;\n };\n\n render() {\n const labelTop = this.resolvedLabelPosition === 'top';\n const hasError = this.errors.length > 0;\n // A4:label 与内容关联。子控件是 slot(id 未知),无法用 label.for;\n // 改用 content 容器 role=group + aria-labelledby 指向 label id,\n // 把 label 语义绑到整组;并用 aria-required / aria-invalid 暴露必填与校验态(读屏可感知,\n // 不再仅靠红色 + 隐藏星号)。\n const labelId = this.label ? `hb-form-item__label-${this.prop || 'x'}` : undefined;\n return (\n <div\n class={{\n 'hb-form-item': true,\n 'hb-form-item--error': hasError,\n 'hb-form-item--validating': this.isvalidating,\n 'hb-form-item--required': this.isRequired,\n 'hb-form-item--label-top': labelTop,\n 'hb-form-item--label-left': this.resolvedLabelPosition === 'left',\n }}\n >\n {this.label && (\n <label id={labelId} class=\"hb-form-item__label\" style={this.labelWidth ? { width: this.labelWidth } : undefined} title={this.label}>\n {this.isRequired && (\n <span class=\"hb-form-item__required\" aria-hidden=\"true\">\n *\n </span>\n )}\n {this.label}\n </label>\n )}\n <div class=\"hb-form-item__content\" role=\"group\" aria-labelledby={labelId} aria-required={this.isRequired ? 'true' : undefined} aria-invalid={hasError ? 'true' : undefined}>\n <slot />\n {hasError && (\n <div class=\"hb-form-item__error\" role=\"alert\">\n {this.errors[0]}\n </div>\n )}\n </div>\n </div>\n );\n }\n}\n"],"version":3}
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, g as getElement, h } from './index-fdf7135e.js';
2
2
 
3
- const formCss = "/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.inline{display:inline}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}} /*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components;:host{display:block}.hb-form{display:flex;flex-direction:column;gap:var(--hb-spacing-md)}.hb-form--inline{flex-flow:wrap;gap:var(--hb-spacing-sm)var(--hb-spacing-lg)}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}";
3
+ const formCss = "/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.inline{display:inline}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}} /*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components;:host{display:block}.hb-form{display:flex;flex-direction:column;gap:var(--hb-spacing-md)}.hb-form--inline{align-items:flex-start;flex-flow:wrap;gap:var(--hb-spacing-sm)var(--hb-spacing-lg)}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}";
4
4
  const HbFormStyle0 = formCss;
5
5
 
6
6
  const Form = class {
@@ -28,11 +28,16 @@ const Form = class {
28
28
  // Stencil 生命周期里子组件(FormItem)的 componentDidLoad 先于父组件(Form)触发,
29
29
  // 若在 componentDidLoad 才挂监听,会错过子项派发的 hbFormFieldRegister,
30
30
  // 导致 fieldRegistry 为空、validate() 永远返回 true(真实浏览器里复现,mock-doc 被 waitForChanges 掩盖)。
31
+ // L1:抽命名 handler 以便 disconnectedCallback 正确 remove(修复前匿名箭头无法 remove)。
32
+ handleFieldRegister = ((e) => {
33
+ const { prop, validate, resetValue, getValue } = e.detail;
34
+ this.fieldRegistry.set(prop, { prop, validate, resetValue, getValue });
35
+ });
31
36
  componentWillLoad() {
32
- this.el.addEventListener('hbFormFieldRegister', ((e) => {
33
- const { prop, validate, resetValue, getValue } = e.detail;
34
- this.fieldRegistry.set(prop, { prop, validate, resetValue, getValue });
35
- }));
37
+ this.el.addEventListener('hbFormFieldRegister', this.handleFieldRegister);
38
+ }
39
+ disconnectedCallback() {
40
+ this.el.removeEventListener('hbFormFieldRegister', this.handleFieldRegister);
36
41
  }
37
42
  /**
38
43
  * 验证整个表单
@@ -49,14 +54,14 @@ const Form = class {
49
54
  * 重置表单
50
55
  */
51
56
  resetFields = () => {
52
- this.fieldRegistry.forEach((field) => field.resetValue());
57
+ this.fieldRegistry.forEach(field => field.resetValue());
53
58
  };
54
59
  render() {
55
- return (h("form", { key: '233f774fd2e6a7331ce01d7b729c3a77dd5793a9', class: {
60
+ return (h("form", { key: '4e5a8f5d54c6760936fa8735e9a41d7956d631b1', class: {
56
61
  'hb-form': true,
57
62
  [`hb-form--label-${this.labelPosition}`]: true,
58
63
  'hb-form--inline': this.inline,
59
- }, onSubmit: (e) => e.preventDefault(), novalidate: true }, h("slot", { key: '99055d1a239483acc153523aeb218ad420bd9610' })));
64
+ }, onSubmit: e => e.preventDefault(), novalidate: true }, h("slot", { key: 'd2e9a364e36387770dc8deb4c42c0e66542cd6a0' })));
60
65
  }
61
66
  };
62
67
  Form.style = HbFormStyle0;
@@ -1 +1 @@
1
- {"file":"hb-form.entry.js","mappings":";;AAAA,MAAM,OAAO,GAAG,0yLAA0yL,CAAC;AAC3zL,qBAAe,OAAO;;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IAAI;gBACf,CAAC,kBAAkB,IAAI,CAAC,aAAa,EAAE,GAAG,IAAI;gBAC9C,iBAAiB,EAAE,IAAI,CAAC,MAAM;aAC/B,EACD,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,EAAE,EACnC,UAAU,UAEV,8DAAQ,CACH,EACP;KACH;;;;;;","names":[],"sources":["src/components/Form/form.css?tag=hb-form&encapsulation=shadow","src/components/Form/Form.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.hb-form {\n display: flex;\n flex-direction: column;\n gap: var(--hb-spacing-md);\n}\n\n.hb-form--inline {\n flex-direction: row;\n flex-wrap: wrap;\n gap: var(--hb-spacing-sm) var(--hb-spacing-lg);\n}\n","import { Component, h, Prop, State, Element } from '@stencil/core';\n\ninterface FormFieldRegistration {\n prop: string;\n validate: () => Promise<string[]>;\n resetValue: () => void;\n getValue: () => any;\n}\n\n/**\n * Form 表单组件\n * 由输入框、选择器、单选框、多选框等控件组成,配合表单校验\n */\n@Component({\n tag: 'hb-form',\n styleUrl: 'form.css',\n shadow: true,\n})\nexport class Form {\n @Element() el: HTMLElement;\n\n /** 表单数据对象 */\n @Prop() model: Record<string, any> = {};\n\n /** 表单验证规则 */\n @Prop() rules: Record<string, any[]> = {};\n\n /** 标签位置 */\n @Prop() labelPosition: 'left' | 'right' | 'top' = 'right';\n\n /** 标签宽度 */\n @Prop() labelWidth: string = '80px';\n\n /** 是否行内表单 */\n @Prop() inline: boolean = false;\n\n /** 表单尺寸 */\n @Prop() size: 'large' | 'default' | 'small' = 'default';\n\n /** 是否禁用 */\n @Prop() disabled: boolean = false;\n\n @State() fields: FormFieldRegistration[] = [];\n\n private fieldRegistry = new Map<string, FormFieldRegistration>();\n\n // 用 componentWillLoad 而非 componentDidLoad 注册监听器:\n // Stencil 生命周期里子组件(FormItem)的 componentDidLoad 先于父组件(Form)触发,\n // 若在 componentDidLoad 才挂监听,会错过子项派发的 hbFormFieldRegister,\n // 导致 fieldRegistry 为空、validate() 永远返回 true(真实浏览器里复现,mock-doc 被 waitForChanges 掩盖)。\n componentWillLoad() {\n this.el.addEventListener('hbFormFieldRegister', ((e: CustomEvent) => {\n const { prop, validate, resetValue, getValue } = e.detail;\n this.fieldRegistry.set(prop, { prop, validate, resetValue, getValue });\n }) as EventListener);\n }\n\n /**\n * 验证整个表单\n * @returns 是否验证通过\n */\n @Prop() validate = async (): Promise<boolean> => {\n const results = await Promise.all(\n Array.from(this.fieldRegistry.values()).map(async (field) => {\n const errors = await field.validate();\n return errors.length === 0;\n })\n );\n return results.every(Boolean);\n };\n\n /**\n * 重置表单\n */\n @Prop() resetFields = (): void => {\n this.fieldRegistry.forEach((field) => field.resetValue());\n };\n\n render() {\n return (\n <form\n class={{\n 'hb-form': true,\n [`hb-form--label-${this.labelPosition}`]: true,\n 'hb-form--inline': this.inline,\n }}\n onSubmit={(e) => e.preventDefault()}\n novalidate\n >\n <slot />\n </form>\n );\n }\n}\n"],"version":3}
1
+ {"file":"hb-form.entry.js","mappings":";;AAAA,MAAM,OAAO,GAAG,i0LAAi0L,CAAC;AACl1L,qBAAe,OAAO;;MCiBT,IAAI;;;;;;IAIP,KAAK,GAAwB,EAAE,CAAC;;IAGhC,KAAK,GAA0B,EAAE,CAAC;;IAGlC,aAAa,GAA6B,OAAO,CAAC;;IAGlD,UAAU,GAAW,MAAM,CAAC;;IAG5B,MAAM,GAAY,KAAK,CAAC;;IAGxB,IAAI,GAAkC,SAAS,CAAC;;IAGhD,QAAQ,GAAY,KAAK,CAAC;IAEzB,MAAM,GAA4B,EAAE,CAAC;IAEtC,aAAa,GAAG,IAAI,GAAG,EAAiC,CAAC;;;;;;IAOzD,mBAAmB,IAAI,CAAC,CAAc;QAC5C,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC;QAC1D,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;KACxE,EAAmB;IAEpB,iBAAiB;QACf,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,qBAAqB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;KAC3E;IAED,oBAAoB;QAClB,IAAI,CAAC,EAAE,CAAC,mBAAmB,CAAC,qBAAqB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;KAC9E;;;;;IAMO,QAAQ,GAAG;QACjB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,OAAM,KAAK;YACrD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC;YACtC,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;SAC5B,CAAC,CACH,CAAC;QACF,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC/B,CAAC;;;;IAKM,WAAW,GAAG;QACpB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;KACzD,CAAC;IAEF,MAAM;QACJ,QACE,6DACE,KAAK,EAAE;gBACL,SAAS,EAAE,IAAI;gBACf,CAAC,kBAAkB,IAAI,CAAC,aAAa,EAAE,GAAG,IAAI;gBAC9C,iBAAiB,EAAE,IAAI,CAAC,MAAM;aAC/B,EACD,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,EACjC,UAAU,UAEV,8DAAQ,CACH,EACP;KACH;;;;;;","names":[],"sources":["src/components/Form/form.css?tag=hb-form&encapsulation=shadow","src/components/Form/Form.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.hb-form {\n display: flex;\n flex-direction: column;\n gap: var(--hb-spacing-md);\n}\n\n.hb-form--inline {\n flex-direction: row;\n flex-wrap: wrap;\n gap: var(--hb-spacing-sm) var(--hb-spacing-lg);\n align-items: flex-start;\n}\n","import { Component, h, Prop, State, Element } from '@stencil/core';\n\ninterface FormFieldRegistration {\n prop: string;\n validate: () => Promise<string[]>;\n resetValue: () => void;\n getValue: () => any;\n}\n\n/**\n * Form 表单组件\n * 由输入框、选择器、单选框、多选框等控件组成,配合表单校验\n */\n@Component({\n tag: 'hb-form',\n styleUrl: 'form.css',\n shadow: true,\n})\nexport class Form {\n @Element() el: HTMLElement;\n\n /** 表单数据对象 */\n @Prop() model: Record<string, any> = {};\n\n /** 表单验证规则 */\n @Prop() rules: Record<string, any[]> = {};\n\n /** 标签位置 */\n @Prop() labelPosition: 'left' | 'right' | 'top' = 'right';\n\n /** 标签宽度 */\n @Prop() labelWidth: string = '80px';\n\n /** 是否行内表单 */\n @Prop() inline: boolean = false;\n\n /** 表单尺寸 */\n @Prop() size: 'large' | 'default' | 'small' = 'default';\n\n /** 是否禁用 */\n @Prop() disabled: boolean = false;\n\n @State() fields: FormFieldRegistration[] = [];\n\n private fieldRegistry = new Map<string, FormFieldRegistration>();\n\n // 用 componentWillLoad 而非 componentDidLoad 注册监听器:\n // Stencil 生命周期里子组件(FormItem)的 componentDidLoad 先于父组件(Form)触发,\n // 若在 componentDidLoad 才挂监听,会错过子项派发的 hbFormFieldRegister,\n // 导致 fieldRegistry 为空、validate() 永远返回 true(真实浏览器里复现,mock-doc 被 waitForChanges 掩盖)。\n // L1:抽命名 handler 以便 disconnectedCallback 正确 remove(修复前匿名箭头无法 remove)。\n private handleFieldRegister = ((e: CustomEvent) => {\n const { prop, validate, resetValue, getValue } = e.detail;\n this.fieldRegistry.set(prop, { prop, validate, resetValue, getValue });\n }) as EventListener;\n\n componentWillLoad() {\n this.el.addEventListener('hbFormFieldRegister', this.handleFieldRegister);\n }\n\n disconnectedCallback() {\n this.el.removeEventListener('hbFormFieldRegister', this.handleFieldRegister);\n }\n\n /**\n * 验证整个表单\n * @returns 是否验证通过\n */\n @Prop() validate = async (): Promise<boolean> => {\n const results = await Promise.all(\n Array.from(this.fieldRegistry.values()).map(async field => {\n const errors = await field.validate();\n return errors.length === 0;\n }),\n );\n return results.every(Boolean);\n };\n\n /**\n * 重置表单\n */\n @Prop() resetFields = (): void => {\n this.fieldRegistry.forEach(field => field.resetValue());\n };\n\n render() {\n return (\n <form\n class={{\n 'hb-form': true,\n [`hb-form--label-${this.labelPosition}`]: true,\n 'hb-form--inline': this.inline,\n }}\n onSubmit={e => e.preventDefault()}\n novalidate\n >\n <slot />\n </form>\n );\n }\n}\n"],"version":3}
@@ -16,7 +16,7 @@ const Header = class {
16
16
  if (this.height) {
17
17
  style.height = this.height;
18
18
  }
19
- return (h("header", { key: '86042705286a6d135858982b34cdb19da71b6744', class: "hb-header", style: style }, h("slot", { key: '96d5152e19c88d4cbc4c30bc136b27b6b8388331' })));
19
+ return (h("header", { key: 'b0f4403c73f20d13b4513dd21266e5fea1004f7b', class: "hb-header", style: style }, h("slot", { key: '15f9743951c0183e7ee10124c0e3d2e8d071bee0' })));
20
20
  }
21
21
  };
22
22
  Header.style = HbHeaderStyle0;
@@ -134,16 +134,20 @@ const ImagePreview = class {
134
134
  handleRotateRight = () => {
135
135
  this.rotate = this.rotate + 90;
136
136
  };
137
- /** 滚轮缩放 */
137
+ /**
138
+ * 滚轮缩放(平滑 + 像素级响应):
139
+ * 按 deltaY 的绝对值映射缩放因子(小滚幅小步、大滚幅大步),
140
+ * 并夹取到 [minZoom, maxZoom],避免抖动与越界。
141
+ */
138
142
  handleWheel = (e) => {
139
- // TODO: 平滑缩放 + 图片中心锚点;当前实现为基础步长缩放
140
143
  e.preventDefault();
141
- if (e.deltaY < 0) {
142
- this.zoomIn();
143
- }
144
- else {
145
- this.zoomOut();
146
- }
144
+ // deltaY 映射成指数缩放系数:wheel 越快缩放越激进,但单次不超 zoomStep*2
145
+ const dir = e.deltaY < 0 ? 1 : -1;
146
+ const intensity = Math.min(Math.abs(e.deltaY) / 100, 2); // 0~2
147
+ const factor = 1 + dir * this.zoomStep * Math.max(1, intensity);
148
+ const next = Math.max(this.minZoom, Math.min(this.zoom * factor, this.maxZoom));
149
+ // 平滑:小数位保留两位,避免浮点累积误差
150
+ this.zoom = Math.round(next * 100) / 100;
147
151
  };
148
152
  /** 点击遮罩空白处关闭 */
149
153
  handleOverlayClick = (e) => {
@@ -161,7 +165,7 @@ const ImagePreview = class {
161
165
  const imgStyle = {
162
166
  transform: `scale(${this.zoom}) rotate(${this.rotate}deg)`,
163
167
  };
164
- return (h("div", { class: "hb-image-preview", onClick: this.handleOverlayClick }, h("div", { class: "hb-image-preview__wrapper" }, h("img", { class: "hb-image-preview__img", src: this.currentSrc, alt: "", style: imgStyle, onWheel: this.handleWheel })), this.isMulti && (h("button", { type: "button", class: "hb-image-preview__btn hb-image-preview__btn--prev", onClick: this.prev, "aria-label": "\u4E0A\u4E00\u5F20" }, "\u2039")), this.isMulti && (h("button", { type: "button", class: "hb-image-preview__btn hb-image-preview__btn--next", onClick: this.next, "aria-label": "\u4E0B\u4E00\u5F20" }, "\u203A")), h("div", { class: "hb-image-preview__toolbar", onClick: (e) => e.stopPropagation() }, h("button", { type: "button", class: "hb-image-preview__tool", onClick: this.zoomOut, "aria-label": "\u7F29\u5C0F" }, "\uFF0D"), h("span", { class: "hb-image-preview__tool-label" }, Math.round(this.zoom * 100), "%"), h("button", { type: "button", class: "hb-image-preview__tool", onClick: this.zoomIn, "aria-label": "\u653E\u5927" }, "\uFF0B"), h("button", { type: "button", class: "hb-image-preview__tool", onClick: this.handleRotateLeft, "aria-label": "\u5DE6\u65CB" }, "\u21BA"), h("button", { type: "button", class: "hb-image-preview__tool", onClick: this.handleRotateRight, "aria-label": "\u53F3\u65CB" }, "\u21BB"), h("button", { type: "button", class: "hb-image-preview__tool", onClick: this.handleReset, "aria-label": "\u91CD\u7F6E" }, "\u27F2"), h("button", { type: "button", class: "hb-image-preview__tool", onClick: this.stopAndClose, "aria-label": "\u5173\u95ED" }, "\u2715")), h("button", { type: "button", class: "hb-image-preview__close", onClick: this.stopAndClose, "aria-label": "\u5173\u95ED" }, "\u00D7")));
168
+ return (h("div", { class: "hb-image-preview", onClick: this.handleOverlayClick }, h("div", { class: "hb-image-preview__wrapper" }, h("img", { class: "hb-image-preview__img", src: this.currentSrc, alt: "", style: imgStyle, onWheel: this.handleWheel })), this.isMulti && (h("button", { type: "button", class: "hb-image-preview__btn hb-image-preview__btn--prev", onClick: this.prev, "aria-label": "\u4E0A\u4E00\u5F20" }, "\u2039")), this.isMulti && (h("button", { type: "button", class: "hb-image-preview__btn hb-image-preview__btn--next", onClick: this.next, "aria-label": "\u4E0B\u4E00\u5F20" }, "\u203A")), h("div", { class: "hb-image-preview__toolbar", onClick: e => e.stopPropagation() }, h("button", { type: "button", class: "hb-image-preview__tool", onClick: this.zoomOut, "aria-label": "\u7F29\u5C0F" }, "\uFF0D"), h("span", { class: "hb-image-preview__tool-label" }, Math.round(this.zoom * 100), "%"), h("button", { type: "button", class: "hb-image-preview__tool", onClick: this.zoomIn, "aria-label": "\u653E\u5927" }, "\uFF0B"), h("button", { type: "button", class: "hb-image-preview__tool", onClick: this.handleRotateLeft, "aria-label": "\u5DE6\u65CB" }, "\u21BA"), h("button", { type: "button", class: "hb-image-preview__tool", onClick: this.handleRotateRight, "aria-label": "\u53F3\u65CB" }, "\u21BB"), h("button", { type: "button", class: "hb-image-preview__tool", onClick: this.handleReset, "aria-label": "\u91CD\u7F6E" }, "\u27F2"), h("button", { type: "button", class: "hb-image-preview__tool", onClick: this.stopAndClose, "aria-label": "\u5173\u95ED" }, "\u2715")), h("button", { type: "button", class: "hb-image-preview__close", onClick: this.stopAndClose, "aria-label": "\u5173\u95ED" }, "\u00D7")));
165
169
  }
166
170
  static get watchers() { return {
167
171
  "modelValue": ["handleVisibleChange"],
@@ -1 +1 @@
1
- {"file":"hb-image-preview.entry.js","mappings":";;AAAA,MAAM,eAAe,GAAG,unQAAunQ,CAAC;AAChpQ,6BA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hb-image-preview&encapsulation=shadow","src/components/ImagePreview/ImagePreview.tsx"],"sourcesContent":[":host {\n display: contents;\n}\n\n.hb-image-preview {\n position: fixed;\n inset: 0;\n z-index: var(--hb-z-index-modal-mask, 2000);\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--hb-color-bg-mask, rgba(0, 0, 0, 0.5));\n}\n\n.hb-image-preview__wrapper {\n max-width: 90vw;\n max-height: 90vh;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.hb-image-preview__img {\n max-width: 90vw;\n max-height: 90vh;\n object-fit: contain;\n user-select: none;\n transition: transform 0.2s ease;\n pointer-events: none;\n}\n\n.hb-image-preview__btn {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n width: 44px;\n height: 44px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 50%;\n background-color: rgba(0, 0, 0, 0.4);\n color: var(--hb-color-text-inverse, #ffffff);\n font-size: 28px;\n line-height: 1;\n cursor: pointer;\n transition: background-color var(--hb-transition-duration, 0.2s) ease;\n}\n\n.hb-image-preview__btn:hover {\n background-color: rgba(0, 0, 0, 0.6);\n}\n\n.hb-image-preview__btn--prev {\n left: 24px;\n}\n\n.hb-image-preview__btn--next {\n right: 24px;\n}\n\n.hb-image-preview__toolbar {\n position: absolute;\n bottom: 32px;\n left: 50%;\n transform: translateX(-50%);\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 8px 12px;\n border-radius: var(--hb-border-radius-base, 4px);\n background-color: rgba(0, 0, 0, 0.5);\n color: var(--hb-color-text-inverse, #ffffff);\n}\n\n.hb-image-preview__tool {\n min-width: 32px;\n height: 32px;\n padding: 0 8px;\n border: none;\n border-radius: var(--hb-border-radius-sm, 2px);\n background: transparent;\n color: var(--hb-color-text-inverse, #ffffff);\n font-size: 16px;\n cursor: pointer;\n transition: background-color var(--hb-transition-duration, 0.2s) ease;\n}\n\n.hb-image-preview__tool:hover {\n background-color: rgba(255, 255, 255, 0.15);\n}\n\n.hb-image-preview__tool-label {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 48px;\n padding: 0 4px;\n font-size: 13px;\n color: var(--hb-color-text-inverse, #ffffff);\n}\n\n.hb-image-preview__close {\n position: absolute;\n top: 24px;\n right: 24px;\n width: 40px;\n height: 40px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 50%;\n background-color: rgba(0, 0, 0, 0.4);\n color: var(--hb-color-text-inverse, #ffffff);\n font-size: 28px;\n line-height: 1;\n cursor: pointer;\n transition: background-color var(--hb-transition-duration, 0.2s) ease;\n}\n\n.hb-image-preview__close:hover {\n background-color: rgba(0, 0, 0, 0.6);\n}\n","import { Component, h, Prop, Event, EventEmitter, State, Watch, Element } from '@stencil/core';\n\nexport interface ImagePreviewChangeDetail {\n src: string;\n index: number;\n}\n\n/**\n * ImagePreview 图片预览组件\n * 点击图片后展示大图,支持缩放、旋转、多图切换\n */\n@Component({\n tag: 'hb-image-preview',\n styleUrl: 'image-preview.css',\n shadow: true,\n})\nexport class ImagePreview {\n @Element() el: HTMLElement;\n\n /** 是否显示预览(受控,可双向) */\n @Prop({ mutable: true }) modelValue: boolean = false;\n\n /** 单图源(srcList 为空时使用) */\n @Prop() src: string = '';\n\n /** 多图源列表 */\n @Prop() srcList: string[] = [];\n\n /** 多图当前索引 */\n @Prop({ mutable: true }) current: number = 0;\n\n /** 单次缩放步长 */\n @Prop() zoomStep: number = 0.2;\n\n /** 最小缩放比例 */\n @Prop() minZoom: number = 0.5;\n\n /** 最大缩放比例 */\n @Prop() maxZoom: number = 3;\n\n /** 关闭事件 */\n @Event() hbClose: EventEmitter<void>;\n\n /** 切换事件,detail 为 { src, index } */\n @Event() hbChange: EventEmitter<ImagePreviewChangeDetail>;\n\n /** 当前缩放比例 */\n @State() zoom: number = 1;\n\n /** 当前旋转角度 */\n @State() rotate: number = 0;\n\n private keyDownHandler = (e: KeyboardEvent) => {\n if (!this.modelValue) return;\n if (e.key === 'Escape') {\n this.close();\n } else if (e.key === 'ArrowLeft') {\n this.prev();\n } else if (e.key === 'ArrowRight') {\n this.next();\n }\n };\n\n @Watch('modelValue')\n handleVisibleChange(newVal: boolean) {\n if (newVal) {\n // 打开时重置缩放与旋转\n this.zoom = 1;\n this.rotate = 0;\n document.addEventListener('keydown', this.keyDownHandler);\n } else {\n document.removeEventListener('keydown', this.keyDownHandler);\n }\n }\n\n @Watch('current')\n handleCurrentChange() {\n // 切换图片时重置变换\n this.zoom = 1;\n this.rotate = 0;\n }\n\n componentDidLoad() {\n if (this.modelValue) {\n document.addEventListener('keydown', this.keyDownHandler);\n }\n }\n\n disconnectedCallback() {\n document.removeEventListener('keydown', this.keyDownHandler);\n }\n\n /** 实际可切换的图片列表 */\n private get imageList(): string[] {\n if (this.srcList && this.srcList.length > 0) {\n return this.srcList;\n }\n return this.src ? [this.src] : [];\n }\n\n private get currentIndex(): number {\n const list = this.imageList;\n if (list.length === 0) return 0;\n if (this.current < 0) return 0;\n if (this.current >= list.length) return list.length - 1;\n return this.current;\n }\n\n private get currentSrc(): string {\n const list = this.imageList;\n if (list.length === 0) return '';\n return list[this.currentIndex] || '';\n }\n\n private get isMulti(): boolean {\n return this.imageList.length > 1;\n }\n\n private close = () => {\n this.modelValue = false;\n this.hbClose.emit();\n };\n\n private emitChange() {\n this.hbChange.emit({ src: this.currentSrc, index: this.currentIndex });\n }\n\n private next = () => {\n const list = this.imageList;\n if (list.length <= 1) return;\n this.current = (this.currentIndex + 1) % list.length;\n this.emitChange();\n };\n\n private prev = () => {\n const list = this.imageList;\n if (list.length <= 1) return;\n this.current = (this.currentIndex - 1 + list.length) % list.length;\n this.emitChange();\n };\n\n private zoomIn = () => {\n const next = Math.min(this.zoom + this.zoomStep, this.maxZoom);\n this.zoom = Math.round(next * 100) / 100;\n };\n\n private zoomOut = () => {\n const next = Math.max(this.zoom - this.zoomStep, this.minZoom);\n this.zoom = Math.round(next * 100) / 100;\n };\n\n private handleReset = () => {\n this.zoom = 1;\n this.rotate = 0;\n };\n\n private handleRotateLeft = () => {\n this.rotate = this.rotate - 90;\n };\n\n private handleRotateRight = () => {\n this.rotate = this.rotate + 90;\n };\n\n /** 滚轮缩放 */\n private handleWheel = (e: WheelEvent) => {\n // TODO: 平滑缩放 + 图片中心锚点;当前实现为基础步长缩放\n e.preventDefault();\n if (e.deltaY < 0) {\n this.zoomIn();\n } else {\n this.zoomOut();\n }\n };\n\n /** 点击遮罩空白处关闭 */\n private handleOverlayClick = (e: MouseEvent) => {\n if (e.target === e.currentTarget) {\n this.close();\n }\n };\n\n private stopAndClose = (e: MouseEvent) => {\n e.stopPropagation();\n this.close();\n };\n\n render() {\n if (!this.modelValue) return null;\n\n const imgStyle = {\n transform: `scale(${this.zoom}) rotate(${this.rotate}deg)`,\n };\n\n return (\n <div class=\"hb-image-preview\" onClick={this.handleOverlayClick}>\n <div class=\"hb-image-preview__wrapper\">\n <img\n class=\"hb-image-preview__img\"\n src={this.currentSrc}\n alt=\"\"\n style={imgStyle}\n onWheel={this.handleWheel}\n />\n </div>\n\n {this.isMulti && (\n <button\n type=\"button\"\n class=\"hb-image-preview__btn hb-image-preview__btn--prev\"\n onClick={this.prev}\n aria-label=\"上一张\"\n >\n ‹\n </button>\n )}\n {this.isMulti && (\n <button\n type=\"button\"\n class=\"hb-image-preview__btn hb-image-preview__btn--next\"\n onClick={this.next}\n aria-label=\"下一张\"\n >\n ›\n </button>\n )}\n\n <div class=\"hb-image-preview__toolbar\" onClick={(e) => e.stopPropagation()}>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.zoomOut} aria-label=\"缩小\">\n -\n </button>\n <span class=\"hb-image-preview__tool-label\">{Math.round(this.zoom * 100)}%</span>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.zoomIn} aria-label=\"放大\">\n +\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.handleRotateLeft} aria-label=\"左旋\">\n ↺\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.handleRotateRight} aria-label=\"右旋\">\n ↻\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.handleReset} aria-label=\"重置\">\n ⟲\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.stopAndClose} aria-label=\"关闭\">\n ✕\n </button>\n </div>\n\n <button\n type=\"button\"\n class=\"hb-image-preview__close\"\n onClick={this.stopAndClose}\n aria-label=\"关闭\"\n >\n ×\n </button>\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"hb-image-preview.entry.js","mappings":";;AAAA,MAAM,eAAe,GAAG,unQAAunQ,CAAC;AAChpQ,6BAAe,eAAe;;MCejB,YAAY;;;;;;;;IAIE,UAAU,GAAY,KAAK,CAAC;;IAG7C,GAAG,GAAW,EAAE,CAAC;;IAGjB,OAAO,GAAa,EAAE,CAAC;;IAGN,OAAO,GAAW,CAAC,CAAC;;IAGrC,QAAQ,GAAW,GAAG,CAAC;;IAGvB,OAAO,GAAW,GAAG,CAAC;;IAGtB,OAAO,GAAW,CAAC,CAAC;;IAGnB,OAAO,CAAqB;;IAG5B,QAAQ,CAAyC;;IAGjD,IAAI,GAAW,CAAC,CAAC;;IAGjB,MAAM,GAAW,CAAC,CAAC;IAEpB,cAAc,GAAG,CAAC,CAAgB;QACxC,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO;QAC7B,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,EAAE;YACtB,IAAI,CAAC,KAAK,EAAE,CAAC;SACd;aAAM,IAAI,CAAC,CAAC,GAAG,KAAK,WAAW,EAAE;YAChC,IAAI,CAAC,IAAI,EAAE,CAAC;SACb;aAAM,IAAI,CAAC,CAAC,GAAG,KAAK,YAAY,EAAE;YACjC,IAAI,CAAC,IAAI,EAAE,CAAC;SACb;KACF,CAAC;IAGF,mBAAmB,CAAC,MAAe;QACjC,IAAI,MAAM,EAAE;;YAEV,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;YACd,IAAI,CAAC,MAA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,CAAC,OAAO,gBAAa,cAAI,aAElF,EACT,YAAM,KAAK,EAAC,8BAA8B,IAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAS,EAChF,cAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,wBAAwB,EAAC,OAAO,EAAE,IAAI,CAAC,MAAM,gBAAa,cAAI,aAEjF,EACT,cAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,wBAAwB,EAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,gBAAa,cAAI,aAE3F,EACT,cAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,wBAAwB,EAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,gBAAa,cAAI,aAE5F,EACT,cAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,wBAAwB,EAAC,OAAO,EAAE,IAAI,CAAC,WAAW,gBAAa,cAAI,aAEtF,EACT,cAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,wBAAwB,EAAC,OAAO,EAAE,IAAI,CAAC,YAAY,gBAAa,cAAI,aAEvF,CACL,EAEN,cAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,yBAAyB,EAAC,OAAO,EAAE,IAAI,CAAC,YAAY,gBAAa,cAAI,aAExF,CACL,EACN;KACH;;;;;;;;;;","names":[],"sources":["src/components/ImagePreview/image-preview.css?tag=hb-image-preview&encapsulation=shadow","src/components/ImagePreview/ImagePreview.tsx"],"sourcesContent":[":host {\n display: contents;\n}\n\n.hb-image-preview {\n position: fixed;\n inset: 0;\n z-index: var(--hb-z-index-modal-mask, 2000);\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--hb-color-bg-mask, rgba(0, 0, 0, 0.5));\n}\n\n.hb-image-preview__wrapper {\n max-width: 90vw;\n max-height: 90vh;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.hb-image-preview__img {\n max-width: 90vw;\n max-height: 90vh;\n object-fit: contain;\n user-select: none;\n transition: transform 0.2s ease;\n pointer-events: none;\n}\n\n.hb-image-preview__btn {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n width: 44px;\n height: 44px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 50%;\n background-color: rgba(0, 0, 0, 0.4);\n color: var(--hb-color-text-inverse, #ffffff);\n font-size: 28px;\n line-height: 1;\n cursor: pointer;\n transition: background-color var(--hb-transition-duration, 0.2s) ease;\n}\n\n.hb-image-preview__btn:hover {\n background-color: rgba(0, 0, 0, 0.6);\n}\n\n.hb-image-preview__btn--prev {\n left: 24px;\n}\n\n.hb-image-preview__btn--next {\n right: 24px;\n}\n\n.hb-image-preview__toolbar {\n position: absolute;\n bottom: 32px;\n left: 50%;\n transform: translateX(-50%);\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 8px 12px;\n border-radius: var(--hb-border-radius-base, 4px);\n background-color: rgba(0, 0, 0, 0.5);\n color: var(--hb-color-text-inverse, #ffffff);\n}\n\n.hb-image-preview__tool {\n min-width: 32px;\n height: 32px;\n padding: 0 8px;\n border: none;\n border-radius: var(--hb-border-radius-sm, 2px);\n background: transparent;\n color: var(--hb-color-text-inverse, #ffffff);\n font-size: 16px;\n cursor: pointer;\n transition: background-color var(--hb-transition-duration, 0.2s) ease;\n}\n\n.hb-image-preview__tool:hover {\n background-color: rgba(255, 255, 255, 0.15);\n}\n\n.hb-image-preview__tool-label {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 48px;\n padding: 0 4px;\n font-size: 13px;\n color: var(--hb-color-text-inverse, #ffffff);\n}\n\n.hb-image-preview__close {\n position: absolute;\n top: 24px;\n right: 24px;\n width: 40px;\n height: 40px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 50%;\n background-color: rgba(0, 0, 0, 0.4);\n color: var(--hb-color-text-inverse, #ffffff);\n font-size: 28px;\n line-height: 1;\n cursor: pointer;\n transition: background-color var(--hb-transition-duration, 0.2s) ease;\n}\n\n.hb-image-preview__close:hover {\n background-color: rgba(0, 0, 0, 0.6);\n}\n","import { Component, h, Prop, Event, EventEmitter, State, Watch, Element } from '@stencil/core';\n\nexport interface ImagePreviewChangeDetail {\n src: string;\n index: number;\n}\n\n/**\n * ImagePreview 图片预览组件\n * 点击图片后展示大图,支持缩放、旋转、多图切换\n */\n@Component({\n tag: 'hb-image-preview',\n styleUrl: 'image-preview.css',\n shadow: true,\n})\nexport class ImagePreview {\n @Element() el: HTMLElement;\n\n /** 是否显示预览(受控,可双向) */\n @Prop({ mutable: true }) modelValue: boolean = false;\n\n /** 单图源(srcList 为空时使用) */\n @Prop() src: string = '';\n\n /** 多图源列表 */\n @Prop() srcList: string[] = [];\n\n /** 多图当前索引 */\n @Prop({ mutable: true }) current: number = 0;\n\n /** 单次缩放步长 */\n @Prop() zoomStep: number = 0.2;\n\n /** 最小缩放比例 */\n @Prop() minZoom: number = 0.5;\n\n /** 最大缩放比例 */\n @Prop() maxZoom: number = 3;\n\n /** 关闭事件 */\n @Event() hbClose: EventEmitter<void>;\n\n /** 切换事件,detail 为 { src, index } */\n @Event() hbChange: EventEmitter<ImagePreviewChangeDetail>;\n\n /** 当前缩放比例 */\n @State() zoom: number = 1;\n\n /** 当前旋转角度 */\n @State() rotate: number = 0;\n\n private keyDownHandler = (e: KeyboardEvent) => {\n if (!this.modelValue) return;\n if (e.key === 'Escape') {\n this.close();\n } else if (e.key === 'ArrowLeft') {\n this.prev();\n } else if (e.key === 'ArrowRight') {\n this.next();\n }\n };\n\n @Watch('modelValue')\n handleVisibleChange(newVal: boolean) {\n if (newVal) {\n // 打开时重置缩放与旋转\n this.zoom = 1;\n this.rotate = 0;\n document.addEventListener('keydown', this.keyDownHandler);\n } else {\n document.removeEventListener('keydown', this.keyDownHandler);\n }\n }\n\n @Watch('current')\n handleCurrentChange() {\n // 切换图片时重置变换\n this.zoom = 1;\n this.rotate = 0;\n }\n\n componentDidLoad() {\n if (this.modelValue) {\n document.addEventListener('keydown', this.keyDownHandler);\n }\n }\n\n disconnectedCallback() {\n document.removeEventListener('keydown', this.keyDownHandler);\n }\n\n /** 实际可切换的图片列表 */\n private get imageList(): string[] {\n if (this.srcList && this.srcList.length > 0) {\n return this.srcList;\n }\n return this.src ? [this.src] : [];\n }\n\n private get currentIndex(): number {\n const list = this.imageList;\n if (list.length === 0) return 0;\n if (this.current < 0) return 0;\n if (this.current >= list.length) return list.length - 1;\n return this.current;\n }\n\n private get currentSrc(): string {\n const list = this.imageList;\n if (list.length === 0) return '';\n return list[this.currentIndex] || '';\n }\n\n private get isMulti(): boolean {\n return this.imageList.length > 1;\n }\n\n private close = () => {\n this.modelValue = false;\n this.hbClose.emit();\n };\n\n private emitChange() {\n this.hbChange.emit({ src: this.currentSrc, index: this.currentIndex });\n }\n\n private next = () => {\n const list = this.imageList;\n if (list.length <= 1) return;\n this.current = (this.currentIndex + 1) % list.length;\n this.emitChange();\n };\n\n private prev = () => {\n const list = this.imageList;\n if (list.length <= 1) return;\n this.current = (this.currentIndex - 1 + list.length) % list.length;\n this.emitChange();\n };\n\n private zoomIn = () => {\n const next = Math.min(this.zoom + this.zoomStep, this.maxZoom);\n this.zoom = Math.round(next * 100) / 100;\n };\n\n private zoomOut = () => {\n const next = Math.max(this.zoom - this.zoomStep, this.minZoom);\n this.zoom = Math.round(next * 100) / 100;\n };\n\n private handleReset = () => {\n this.zoom = 1;\n this.rotate = 0;\n };\n\n private handleRotateLeft = () => {\n this.rotate = this.rotate - 90;\n };\n\n private handleRotateRight = () => {\n this.rotate = this.rotate + 90;\n };\n\n /**\n * 滚轮缩放(平滑 + 像素级响应):\n * 按 deltaY 的绝对值映射缩放因子(小滚幅小步、大滚幅大步),\n * 并夹取到 [minZoom, maxZoom],避免抖动与越界。\n */\n private handleWheel = (e: WheelEvent) => {\n e.preventDefault();\n // 把 deltaY 映射成指数缩放系数:wheel 越快缩放越激进,但单次不超 zoomStep*2\n const dir = e.deltaY < 0 ? 1 : -1;\n const intensity = Math.min(Math.abs(e.deltaY) / 100, 2); // 0~2\n const factor = 1 + dir * this.zoomStep * Math.max(1, intensity);\n const next = Math.max(this.minZoom, Math.min(this.zoom * factor, this.maxZoom));\n // 平滑:小数位保留两位,避免浮点累积误差\n this.zoom = Math.round(next * 100) / 100;\n };\n\n /** 点击遮罩空白处关闭 */\n private handleOverlayClick = (e: MouseEvent) => {\n if (e.target === e.currentTarget) {\n this.close();\n }\n };\n\n private stopAndClose = (e: MouseEvent) => {\n e.stopPropagation();\n this.close();\n };\n\n render() {\n if (!this.modelValue) return null;\n\n const imgStyle = {\n transform: `scale(${this.zoom}) rotate(${this.rotate}deg)`,\n };\n\n return (\n <div class=\"hb-image-preview\" onClick={this.handleOverlayClick}>\n <div class=\"hb-image-preview__wrapper\">\n <img class=\"hb-image-preview__img\" src={this.currentSrc} alt=\"\" style={imgStyle} onWheel={this.handleWheel} />\n </div>\n\n {this.isMulti && (\n <button type=\"button\" class=\"hb-image-preview__btn hb-image-preview__btn--prev\" onClick={this.prev} aria-label=\"上一张\">\n ‹\n </button>\n )}\n {this.isMulti && (\n <button type=\"button\" class=\"hb-image-preview__btn hb-image-preview__btn--next\" onClick={this.next} aria-label=\"下一张\">\n ›\n </button>\n )}\n\n <div class=\"hb-image-preview__toolbar\" onClick={e => e.stopPropagation()}>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.zoomOut} aria-label=\"缩小\">\n -\n </button>\n <span class=\"hb-image-preview__tool-label\">{Math.round(this.zoom * 100)}%</span>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.zoomIn} aria-label=\"放大\">\n +\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.handleRotateLeft} aria-label=\"左旋\">\n ↺\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.handleRotateRight} aria-label=\"右旋\">\n ↻\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.handleReset} aria-label=\"重置\">\n ⟲\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.stopAndClose} aria-label=\"关闭\">\n ✕\n </button>\n </div>\n\n <button type=\"button\" class=\"hb-image-preview__close\" onClick={this.stopAndClose} aria-label=\"关闭\">\n ×\n </button>\n </div>\n );\n }\n}\n"],"version":3}
@@ -18,11 +18,29 @@ const Image = class {
18
18
  loaded = false;
19
19
  error = false;
20
20
  previewVisible = false;
21
- handleLoad = () => { this.loaded = true; };
22
- handleError = () => { this.error = true; };
21
+ /**
22
+ * src 时重置 loaded/error
23
+ * 修复 B5——修复前换 src 不清状态:坏图换好图卡在错误占位(error 不清零),
24
+ * 好图换坏图 loaded 仍 true 造成短暂状态错乱。
25
+ */
26
+ handleSrcChange() {
27
+ this.loaded = false;
28
+ this.error = false;
29
+ }
30
+ handleLoad = () => {
31
+ this.loaded = true;
32
+ };
33
+ handleError = () => {
34
+ this.error = true;
35
+ };
23
36
  render() {
24
- return (h("div", { key: 'c6ededfba4d6a1d4b9356c1b18dc7b19aa8c8631', class: "hb-image", style: { width: this.width, height: this.height, borderRadius: this.radius } }, !this.error ? (h("img", { src: this.src, alt: this.alt, class: { 'hb-image__inner': true, 'hb-image__inner--loaded': this.loaded }, style: { objectFit: this.fit }, loading: this.lazy ? 'lazy' : undefined, onLoad: this.handleLoad, onError: this.handleError, onClick: () => this.preview && (this.previewVisible = true) })) : (h("div", { class: "hb-image__error" }, "\u56FE\u7247\u52A0\u8F7D\u5931\u8D25")), this.previewVisible && (h("div", { key: 'b32748bc6a54360e9cfab47ee06671f4568bae8c', class: "hb-image__preview", onClick: () => { this.previewVisible = false; } }, h("img", { key: '7bcc5a1f9b34756827fb8566a953296f808febea', src: this.src, alt: this.alt, class: "hb-image__preview-img" })))));
37
+ return (h("div", { key: 'c9bbb745e78918ca3659138a91e7472911ac4c09', class: "hb-image", style: { width: this.width, height: this.height, borderRadius: this.radius } }, !this.error ? (h("img", { src: this.src, alt: this.alt, class: { 'hb-image__inner': true, 'hb-image__inner--loaded': this.loaded }, style: { objectFit: this.fit }, loading: this.lazy ? 'lazy' : undefined, onLoad: this.handleLoad, onError: this.handleError, onClick: () => this.preview && (this.previewVisible = true) })) : (h("div", { class: "hb-image__error" }, "\u56FE\u7247\u52A0\u8F7D\u5931\u8D25")), this.previewVisible && (h("div", { key: '7d3b00d09c919169eab62ab6f525b2ef2f038a4c', class: "hb-image__preview", onClick: () => {
38
+ this.previewVisible = false;
39
+ } }, h("img", { key: '7c05ea33e51493d3a297f0e1c7d3511efae46a6c', src: this.src, alt: this.alt, class: "hb-image__preview-img" })))));
25
40
  }
41
+ static get watchers() { return {
42
+ "src": ["handleSrcChange"]
43
+ }; }
26
44
  };
27
45
  Image.style = HbImageStyle0;
28
46