huibo-ui 0.3.0 → 0.4.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 (668) hide show
  1. package/dist/cjs/{date-helpers-904747ff.js → date-helpers-1ffddc59.js} +7 -3
  2. package/dist/cjs/date-helpers-1ffddc59.js.map +1 -0
  3. package/dist/cjs/hb-affix.cjs.entry.js +1 -1
  4. package/dist/cjs/hb-aside.cjs.entry.js +1 -1
  5. package/dist/cjs/hb-avatar.cjs.entry.js +1 -1
  6. package/dist/cjs/hb-backtop.cjs.entry.js +2 -2
  7. package/dist/cjs/hb-badge.cjs.entry.js +1 -1
  8. package/dist/cjs/hb-breadcrumb-item.cjs.entry.js +1 -1
  9. package/dist/cjs/hb-breadcrumb.cjs.entry.js +1 -1
  10. package/dist/cjs/hb-button.cjs.entry.js +2 -2
  11. package/dist/cjs/hb-calendar.cjs.entry.js +78 -10
  12. package/dist/cjs/hb-calendar.cjs.entry.js.map +1 -1
  13. package/dist/cjs/hb-card.cjs.entry.js +1 -1
  14. package/dist/cjs/hb-cascader.cjs.entry.js +270 -146
  15. package/dist/cjs/hb-cascader.cjs.entry.js.map +1 -1
  16. package/dist/cjs/hb-checkbox-group.cjs.entry.js +2 -2
  17. package/dist/cjs/hb-checkbox.cjs.entry.js +3 -3
  18. package/dist/cjs/hb-collapse-item.cjs.entry.js +1 -1
  19. package/dist/cjs/hb-collapse.cjs.entry.js +1 -1
  20. package/dist/cjs/hb-color-picker-panel.cjs.entry.js +2 -2
  21. package/dist/cjs/hb-color-picker.cjs.entry.js +91 -14
  22. package/dist/cjs/hb-color-picker.cjs.entry.js.map +1 -1
  23. package/dist/cjs/hb-config-provider.cjs.entry.js +1 -1
  24. package/dist/cjs/hb-container.cjs.entry.js +2 -2
  25. package/dist/cjs/hb-date-picker-pane.cjs.entry.js +2 -2
  26. package/dist/cjs/hb-date-picker.cjs.entry.js +85 -7
  27. package/dist/cjs/hb-date-picker.cjs.entry.js.map +1 -1
  28. package/dist/cjs/hb-date-range-picker.cjs.entry.js +3 -3
  29. package/dist/cjs/hb-date-time-picker.cjs.entry.js +3 -3
  30. package/dist/cjs/hb-descriptions.cjs.entry.js +2 -2
  31. package/dist/cjs/hb-descriptions.cjs.entry.js.map +1 -1
  32. package/dist/cjs/hb-divider.cjs.entry.js +2 -2
  33. package/dist/cjs/hb-drawer.cjs.entry.js +1 -1
  34. package/dist/cjs/hb-dropdown.cjs.entry.js +74 -6
  35. package/dist/cjs/hb-dropdown.cjs.entry.js.map +1 -1
  36. package/dist/cjs/hb-empty.cjs.entry.js +1 -1
  37. package/dist/cjs/hb-float-button.cjs.entry.js +2 -2
  38. package/dist/cjs/hb-footer.cjs.entry.js +1 -1
  39. package/dist/cjs/hb-form-item.cjs.entry.js +59 -8
  40. package/dist/cjs/hb-form-item.cjs.entry.js.map +1 -1
  41. package/dist/cjs/hb-form.cjs.entry.js +3 -3
  42. package/dist/cjs/hb-form.cjs.entry.js.map +1 -1
  43. package/dist/cjs/hb-header.cjs.entry.js +1 -1
  44. package/dist/cjs/hb-image-preview.cjs.entry.js +12 -8
  45. package/dist/cjs/hb-image-preview.cjs.entry.js.map +1 -1
  46. package/dist/cjs/hb-image.cjs.entry.js +1 -1
  47. package/dist/cjs/hb-input-number.cjs.entry.js +5 -5
  48. package/dist/cjs/hb-input-tag.cjs.entry.js +2 -2
  49. package/dist/cjs/hb-input.cjs.entry.js +39 -3
  50. package/dist/cjs/hb-input.cjs.entry.js.map +1 -1
  51. package/dist/cjs/hb-layout.cjs.entry.js +36 -14
  52. package/dist/cjs/hb-layout.cjs.entry.js.map +1 -1
  53. package/dist/cjs/hb-link.cjs.entry.js +2 -2
  54. package/dist/cjs/hb-loading.cjs.entry.js +2 -2
  55. package/dist/cjs/hb-main.cjs.entry.js +1 -1
  56. package/dist/cjs/hb-menu-item.cjs.entry.js +2 -2
  57. package/dist/cjs/hb-menu.cjs.entry.js +3 -3
  58. package/dist/cjs/hb-menu.cjs.entry.js.map +1 -1
  59. package/dist/cjs/hb-message.cjs.entry.js +2 -2
  60. package/dist/cjs/hb-notification.cjs.entry.js +2 -2
  61. package/dist/cjs/hb-page-header.cjs.entry.js +1 -1
  62. package/dist/cjs/hb-pagination.cjs.entry.js +21 -8
  63. package/dist/cjs/hb-pagination.cjs.entry.js.map +1 -1
  64. package/dist/cjs/hb-popconfirm.cjs.entry.js +37 -7
  65. package/dist/cjs/hb-popconfirm.cjs.entry.js.map +1 -1
  66. package/dist/cjs/hb-popover.cjs.entry.js +22 -2
  67. package/dist/cjs/hb-popover.cjs.entry.js.map +1 -1
  68. package/dist/cjs/hb-progress.cjs.entry.js +1 -1
  69. package/dist/cjs/hb-radio.cjs.entry.js +2 -2
  70. package/dist/cjs/hb-rate.cjs.entry.js +45 -3
  71. package/dist/cjs/hb-rate.cjs.entry.js.map +1 -1
  72. package/dist/cjs/hb-result.cjs.entry.js +1 -1
  73. package/dist/cjs/hb-row.cjs.entry.js +2 -2
  74. package/dist/cjs/hb-segmented.cjs.entry.js +39 -5
  75. package/dist/cjs/hb-segmented.cjs.entry.js.map +1 -1
  76. package/dist/cjs/hb-select.cjs.entry.js +47 -8
  77. package/dist/cjs/hb-select.cjs.entry.js.map +1 -1
  78. package/dist/cjs/hb-slider.cjs.entry.js +189 -20
  79. package/dist/cjs/hb-slider.cjs.entry.js.map +1 -1
  80. package/dist/cjs/hb-space.cjs.entry.js +2 -2
  81. package/dist/cjs/hb-statistic.cjs.entry.js +1 -1
  82. package/dist/cjs/hb-step.cjs.entry.js +1 -1
  83. package/dist/cjs/hb-steps.cjs.entry.js +30 -9
  84. package/dist/cjs/hb-steps.cjs.entry.js.map +1 -1
  85. package/dist/cjs/hb-sub-menu.cjs.entry.js +4 -4
  86. package/dist/cjs/hb-switch.cjs.entry.js +9 -4
  87. package/dist/cjs/hb-switch.cjs.entry.js.map +1 -1
  88. package/dist/cjs/hb-tab-pane.cjs.entry.js +1 -1
  89. package/dist/cjs/hb-table.cjs.entry.js +1 -1
  90. package/dist/cjs/hb-table.cjs.entry.js.map +1 -1
  91. package/dist/cjs/hb-tabs.cjs.entry.js +2 -2
  92. package/dist/cjs/hb-tag.cjs.entry.js +2 -2
  93. package/dist/cjs/hb-text.cjs.entry.js +2 -2
  94. package/dist/cjs/hb-time-picker.cjs.entry.js +4 -4
  95. package/dist/cjs/hb-time-select.cjs.entry.js +2 -2
  96. package/dist/cjs/hb-timeline.cjs.entry.js +1 -1
  97. package/dist/cjs/hb-tooltip.cjs.entry.js +18 -1
  98. package/dist/cjs/hb-tooltip.cjs.entry.js.map +1 -1
  99. package/dist/cjs/hb-transfer.cjs.entry.js +2 -2
  100. package/dist/cjs/hb-tree-select.cjs.entry.js +95 -18
  101. package/dist/cjs/hb-tree-select.cjs.entry.js.map +1 -1
  102. package/dist/cjs/hb-tree.cjs.entry.js +1 -1
  103. package/dist/cjs/hb-upload.cjs.entry.js +3 -3
  104. package/dist/cjs/hb-watermark.cjs.entry.js +1 -1
  105. package/dist/cjs/huibo-ui.cjs.js +1 -1
  106. package/dist/cjs/loader.cjs.js +1 -1
  107. package/dist/collection/collection-manifest.json +3 -3
  108. package/dist/collection/components/Affix/Affix.js +1 -1
  109. package/dist/collection/components/Avatar/Avatar.js +1 -1
  110. package/dist/collection/components/Backtop/Backtop.js +2 -2
  111. package/dist/collection/components/Badge/Badge.js +1 -1
  112. package/dist/collection/components/Breadcrumb/Breadcrumb.js +1 -1
  113. package/dist/collection/components/Breadcrumb/BreadcrumbItem.js +1 -1
  114. package/dist/collection/components/Button/Button.js +2 -2
  115. package/dist/collection/components/Calendar/Calendar.js +84 -10
  116. package/dist/collection/components/Calendar/Calendar.js.map +1 -1
  117. package/dist/collection/components/Calendar/calendar.css +16 -0
  118. package/dist/collection/components/Card/Card.js +1 -1
  119. package/dist/collection/components/Cascader/Cascader.js +374 -194
  120. package/dist/collection/components/Cascader/Cascader.js.map +1 -1
  121. package/dist/collection/components/Cascader/cascader.css +170 -16
  122. package/dist/collection/components/Checkbox/Checkbox.js +3 -3
  123. package/dist/collection/components/Checkbox/CheckboxGroup.js +2 -2
  124. package/dist/collection/components/Collapse/Collapse.js +1 -1
  125. package/dist/collection/components/Collapse/CollapseItem.js +1 -1
  126. package/dist/collection/components/ColorPicker/ColorPicker.js +92 -14
  127. package/dist/collection/components/ColorPicker/ColorPicker.js.map +1 -1
  128. package/dist/collection/components/ColorPicker/color-picker.css +13 -0
  129. package/dist/collection/components/ColorPickerPanel/ColorPickerPanel.js +2 -2
  130. package/dist/collection/components/ConfigProvider/ConfigProvider.js +1 -1
  131. package/dist/collection/components/Container/Aside.js +1 -1
  132. package/dist/collection/components/Container/Container.js +2 -2
  133. package/dist/collection/components/Container/Footer.js +1 -1
  134. package/dist/collection/components/Container/Header.js +1 -1
  135. package/dist/collection/components/Container/Main.js +1 -1
  136. package/dist/collection/components/DatePicker/DatePicker.js +89 -10
  137. package/dist/collection/components/DatePicker/DatePicker.js.map +1 -1
  138. package/dist/collection/components/DatePicker/date-picker.css +62 -2
  139. package/dist/collection/components/DatePickerPane/DatePickerPane.js +1 -1
  140. package/dist/collection/components/DateRangePicker/DateRangePicker.js +2 -2
  141. package/dist/collection/components/DateTimePicker/DateTimePicker.js +2 -2
  142. package/dist/collection/components/Descriptions/Descriptions.js +1 -1
  143. package/dist/collection/components/Descriptions/descriptions.css +22 -0
  144. package/dist/collection/components/Divider/Divider.js +2 -2
  145. package/dist/collection/components/Drawer/Drawer.js +1 -1
  146. package/dist/collection/components/Dropdown/Dropdown.js +83 -7
  147. package/dist/collection/components/Dropdown/Dropdown.js.map +1 -1
  148. package/dist/collection/components/Dropdown/dropdown.css +2 -1
  149. package/dist/collection/components/Empty/Empty.js +1 -1
  150. package/dist/collection/components/FloatButton/FloatButton.js +2 -2
  151. package/dist/collection/components/Form/Form.js +2 -2
  152. package/dist/collection/components/Form/FormItem.js +60 -9
  153. package/dist/collection/components/Form/FormItem.js.map +1 -1
  154. package/dist/collection/components/Form/form-item.css +49 -4
  155. package/dist/collection/components/Form/form.css +1 -0
  156. package/dist/collection/components/Image/Image.js +1 -1
  157. package/dist/collection/components/ImagePreview/ImagePreview.js +12 -8
  158. package/dist/collection/components/ImagePreview/ImagePreview.js.map +1 -1
  159. package/dist/collection/components/Input/Input.js +38 -2
  160. package/dist/collection/components/Input/Input.js.map +1 -1
  161. package/dist/collection/components/Input/input.css +21 -2
  162. package/dist/collection/components/InputNumber/InputNumber.js +5 -5
  163. package/dist/collection/components/InputTag/InputTag.js +2 -2
  164. package/dist/collection/components/Layout/Layout.js +87 -34
  165. package/dist/collection/components/Layout/Layout.js.map +1 -1
  166. package/dist/collection/components/Layout/Row.js +2 -2
  167. package/dist/collection/components/Layout/layout.css +524 -0
  168. package/dist/collection/components/Link/Link.js +2 -2
  169. package/dist/collection/components/Loading/Loading.js +2 -2
  170. package/dist/collection/components/Menu/Menu.js +2 -2
  171. package/dist/collection/components/Menu/MenuItem.js +2 -2
  172. package/dist/collection/components/Menu/SubMenu.js +4 -4
  173. package/dist/collection/components/Menu/menu.css +25 -0
  174. package/dist/collection/components/Message/Message.js +2 -2
  175. package/dist/collection/components/Notification/Notification.js +2 -2
  176. package/dist/collection/components/PageHeader/PageHeader.js +1 -1
  177. package/dist/collection/components/Pagination/Pagination.js +23 -7
  178. package/dist/collection/components/Pagination/Pagination.js.map +1 -1
  179. package/dist/collection/components/Pagination/pagination.css +23 -0
  180. package/dist/collection/components/Popconfirm/Popconfirm.js +44 -7
  181. package/dist/collection/components/Popconfirm/Popconfirm.js.map +1 -1
  182. package/dist/collection/components/Popover/Popover.js +29 -2
  183. package/dist/collection/components/Popover/Popover.js.map +1 -1
  184. package/dist/collection/components/Progress/Progress.js +1 -1
  185. package/dist/collection/components/Radio/Radio.js +2 -2
  186. package/dist/collection/components/Rate/Rate.js +45 -3
  187. package/dist/collection/components/Rate/Rate.js.map +1 -1
  188. package/dist/collection/components/Result/Result.js +1 -1
  189. package/dist/collection/components/Segmented/Segmented.js +51 -6
  190. package/dist/collection/components/Segmented/Segmented.js.map +1 -1
  191. package/dist/collection/components/Select/Select.js +46 -7
  192. package/dist/collection/components/Select/Select.js.map +1 -1
  193. package/dist/collection/components/Select/select.css +50 -4
  194. package/dist/collection/components/Slider/Slider.js +221 -21
  195. package/dist/collection/components/Slider/Slider.js.map +1 -1
  196. package/dist/collection/components/Slider/slider.css +58 -7
  197. package/dist/collection/components/Space/Space.js +2 -2
  198. package/dist/collection/components/Statistic/Statistic.js +1 -1
  199. package/dist/collection/components/Steps/Step.js +1 -1
  200. package/dist/collection/components/Steps/Steps.js +35 -8
  201. package/dist/collection/components/Steps/Steps.js.map +1 -1
  202. package/dist/collection/components/Switch/Switch.js +8 -3
  203. package/dist/collection/components/Switch/Switch.js.map +1 -1
  204. package/dist/collection/components/Switch/switch.css +45 -0
  205. package/dist/collection/components/Table/table.css +20 -0
  206. package/dist/collection/components/Tabs/TabPane.js +1 -1
  207. package/dist/collection/components/Tabs/Tabs.js +2 -2
  208. package/dist/collection/components/Tag/Tag.js +2 -2
  209. package/dist/collection/components/Text/Text.js +2 -2
  210. package/dist/collection/components/TimePicker/TimePicker.js +4 -4
  211. package/dist/collection/components/TimeSelect/TimeSelect.js +2 -2
  212. package/dist/collection/components/Timeline/Timeline.js +1 -1
  213. package/dist/collection/components/Tooltip/Tooltip.js +25 -2
  214. package/dist/collection/components/Tooltip/Tooltip.js.map +1 -1
  215. package/dist/collection/components/Transfer/Transfer.js +2 -2
  216. package/dist/collection/components/Tree/Tree.js +1 -1
  217. package/dist/collection/components/TreeSelect/TreeSelect.js +94 -17
  218. package/dist/collection/components/TreeSelect/TreeSelect.js.map +1 -1
  219. package/dist/collection/components/TreeSelect/tree-select.css +41 -7
  220. package/dist/collection/components/Upload/Upload.js +3 -3
  221. package/dist/collection/components/Watermark/Watermark.js +1 -1
  222. package/dist/collection/utils/date-helpers.js +6 -2
  223. package/dist/collection/utils/date-helpers.js.map +1 -1
  224. package/dist/components/hb-affix.js +1 -1
  225. package/dist/components/hb-aside.js +1 -1
  226. package/dist/components/hb-avatar.js +1 -1
  227. package/dist/components/hb-backtop.js +2 -2
  228. package/dist/components/hb-badge.js +1 -1
  229. package/dist/components/hb-breadcrumb-item.js +1 -1
  230. package/dist/components/hb-breadcrumb.js +1 -1
  231. package/dist/components/hb-button.js +2 -2
  232. package/dist/components/hb-calendar.js +80 -11
  233. package/dist/components/hb-calendar.js.map +1 -1
  234. package/dist/components/hb-card.js +1 -1
  235. package/dist/components/hb-cascader.js +273 -146
  236. package/dist/components/hb-cascader.js.map +1 -1
  237. package/dist/components/hb-checkbox-group.js +2 -2
  238. package/dist/components/hb-checkbox.js +3 -3
  239. package/dist/components/hb-collapse-item.js +1 -1
  240. package/dist/components/hb-collapse.js +1 -1
  241. package/dist/components/hb-color-picker-panel.js +2 -2
  242. package/dist/components/hb-color-picker.js +93 -15
  243. package/dist/components/hb-color-picker.js.map +1 -1
  244. package/dist/components/hb-config-provider.js +1 -1
  245. package/dist/components/hb-container.js +2 -2
  246. package/dist/components/hb-date-picker-pane.js +2 -2
  247. package/dist/components/hb-date-picker.js +87 -8
  248. package/dist/components/hb-date-picker.js.map +1 -1
  249. package/dist/components/hb-date-range-picker.js +3 -3
  250. package/dist/components/hb-date-time-picker.js +3 -3
  251. package/dist/components/hb-descriptions.js +2 -2
  252. package/dist/components/hb-descriptions.js.map +1 -1
  253. package/dist/components/hb-divider.js +2 -2
  254. package/dist/components/hb-drawer.js +1 -1
  255. package/dist/components/hb-dropdown.js +76 -7
  256. package/dist/components/hb-dropdown.js.map +1 -1
  257. package/dist/components/hb-empty.js +1 -1
  258. package/dist/components/hb-float-button.js +2 -2
  259. package/dist/components/hb-footer.js +1 -1
  260. package/dist/components/hb-form-item.js +59 -8
  261. package/dist/components/hb-form-item.js.map +1 -1
  262. package/dist/components/hb-form.js +3 -3
  263. package/dist/components/hb-form.js.map +1 -1
  264. package/dist/components/hb-header.js +1 -1
  265. package/dist/components/hb-icon.js +1 -89
  266. package/dist/components/hb-icon.js.map +1 -1
  267. package/dist/components/hb-image-preview.js +12 -8
  268. package/dist/components/hb-image-preview.js.map +1 -1
  269. package/dist/components/hb-image.js +1 -1
  270. package/dist/components/hb-input-number.js +5 -5
  271. package/dist/components/hb-input-tag.js +2 -2
  272. package/dist/components/hb-input.js +39 -3
  273. package/dist/components/hb-input.js.map +1 -1
  274. package/dist/components/hb-layout.js +36 -14
  275. package/dist/components/hb-layout.js.map +1 -1
  276. package/dist/components/hb-link.js +2 -2
  277. package/dist/components/hb-loading.js +2 -2
  278. package/dist/components/hb-main.js +1 -1
  279. package/dist/components/hb-menu-item.js +2 -2
  280. package/dist/components/hb-menu.js +3 -3
  281. package/dist/components/hb-menu.js.map +1 -1
  282. package/dist/components/hb-message.js +2 -2
  283. package/dist/components/hb-notification.js +2 -2
  284. package/dist/components/hb-page-header.js +1 -1
  285. package/dist/components/hb-pagination.js +25 -10
  286. package/dist/components/hb-pagination.js.map +1 -1
  287. package/dist/components/hb-popconfirm.js +37 -7
  288. package/dist/components/hb-popconfirm.js.map +1 -1
  289. package/dist/components/hb-popover.js +22 -2
  290. package/dist/components/hb-popover.js.map +1 -1
  291. package/dist/components/hb-progress.js +1 -1
  292. package/dist/components/hb-radio.js +2 -2
  293. package/dist/components/hb-rate.js +45 -3
  294. package/dist/components/hb-rate.js.map +1 -1
  295. package/dist/components/hb-result.js +1 -1
  296. package/dist/components/hb-row.js +2 -2
  297. package/dist/components/hb-segmented.js +41 -6
  298. package/dist/components/hb-segmented.js.map +1 -1
  299. package/dist/components/hb-select.js +47 -8
  300. package/dist/components/hb-select.js.map +1 -1
  301. package/dist/components/hb-slider.js +194 -21
  302. package/dist/components/hb-slider.js.map +1 -1
  303. package/dist/components/hb-space.js +2 -2
  304. package/dist/components/hb-statistic.js +1 -1
  305. package/dist/components/hb-step.js +1 -1
  306. package/dist/components/hb-steps.js +35 -8
  307. package/dist/components/hb-steps.js.map +1 -1
  308. package/dist/components/hb-sub-menu.js +4 -4
  309. package/dist/components/hb-switch.js +9 -4
  310. package/dist/components/hb-switch.js.map +1 -1
  311. package/dist/components/hb-tab-pane.js +1 -1
  312. package/dist/components/hb-table.js +1 -1
  313. package/dist/components/hb-table.js.map +1 -1
  314. package/dist/components/hb-tabs.js +2 -2
  315. package/dist/components/hb-tag.js +2 -2
  316. package/dist/components/hb-text.js +2 -2
  317. package/dist/components/hb-time-picker.js +4 -4
  318. package/dist/components/hb-time-select.js +2 -2
  319. package/dist/components/hb-timeline.js +1 -1
  320. package/dist/components/hb-tooltip.js +18 -1
  321. package/dist/components/hb-tooltip.js.map +1 -1
  322. package/dist/components/hb-transfer.js +2 -2
  323. package/dist/components/hb-tree-select.js +95 -18
  324. package/dist/components/hb-tree-select.js.map +1 -1
  325. package/dist/components/hb-tree.js +1 -1
  326. package/dist/components/hb-upload.js +3 -3
  327. package/dist/components/hb-watermark.js +1 -1
  328. package/dist/components/{p-cf94cbf6.js → p-08b4005c.js} +7 -3
  329. package/dist/components/p-08b4005c.js.map +1 -0
  330. package/dist/components/p-86d92faf.js +93 -0
  331. package/dist/components/p-86d92faf.js.map +1 -0
  332. package/dist/esm/{date-helpers-e4d85a67.js → date-helpers-44507189.js} +7 -3
  333. package/dist/esm/date-helpers-44507189.js.map +1 -0
  334. package/dist/esm/hb-affix.entry.js +1 -1
  335. package/dist/esm/hb-aside.entry.js +1 -1
  336. package/dist/esm/hb-avatar.entry.js +1 -1
  337. package/dist/esm/hb-backtop.entry.js +2 -2
  338. package/dist/esm/hb-badge.entry.js +1 -1
  339. package/dist/esm/hb-breadcrumb-item.entry.js +1 -1
  340. package/dist/esm/hb-breadcrumb.entry.js +1 -1
  341. package/dist/esm/hb-button.entry.js +2 -2
  342. package/dist/esm/hb-calendar.entry.js +78 -10
  343. package/dist/esm/hb-calendar.entry.js.map +1 -1
  344. package/dist/esm/hb-card.entry.js +1 -1
  345. package/dist/esm/hb-cascader.entry.js +270 -146
  346. package/dist/esm/hb-cascader.entry.js.map +1 -1
  347. package/dist/esm/hb-checkbox-group.entry.js +2 -2
  348. package/dist/esm/hb-checkbox.entry.js +3 -3
  349. package/dist/esm/hb-collapse-item.entry.js +1 -1
  350. package/dist/esm/hb-collapse.entry.js +1 -1
  351. package/dist/esm/hb-color-picker-panel.entry.js +2 -2
  352. package/dist/esm/hb-color-picker.entry.js +91 -14
  353. package/dist/esm/hb-color-picker.entry.js.map +1 -1
  354. package/dist/esm/hb-config-provider.entry.js +1 -1
  355. package/dist/esm/hb-container.entry.js +2 -2
  356. package/dist/esm/hb-date-picker-pane.entry.js +2 -2
  357. package/dist/esm/hb-date-picker.entry.js +85 -7
  358. package/dist/esm/hb-date-picker.entry.js.map +1 -1
  359. package/dist/esm/hb-date-range-picker.entry.js +3 -3
  360. package/dist/esm/hb-date-time-picker.entry.js +3 -3
  361. package/dist/esm/hb-descriptions.entry.js +2 -2
  362. package/dist/esm/hb-descriptions.entry.js.map +1 -1
  363. package/dist/esm/hb-divider.entry.js +2 -2
  364. package/dist/esm/hb-drawer.entry.js +1 -1
  365. package/dist/esm/hb-dropdown.entry.js +74 -6
  366. package/dist/esm/hb-dropdown.entry.js.map +1 -1
  367. package/dist/esm/hb-empty.entry.js +1 -1
  368. package/dist/esm/hb-float-button.entry.js +2 -2
  369. package/dist/esm/hb-footer.entry.js +1 -1
  370. package/dist/esm/hb-form-item.entry.js +59 -8
  371. package/dist/esm/hb-form-item.entry.js.map +1 -1
  372. package/dist/esm/hb-form.entry.js +3 -3
  373. package/dist/esm/hb-form.entry.js.map +1 -1
  374. package/dist/esm/hb-header.entry.js +1 -1
  375. package/dist/esm/hb-image-preview.entry.js +12 -8
  376. package/dist/esm/hb-image-preview.entry.js.map +1 -1
  377. package/dist/esm/hb-image.entry.js +1 -1
  378. package/dist/esm/hb-input-number.entry.js +5 -5
  379. package/dist/esm/hb-input-tag.entry.js +2 -2
  380. package/dist/esm/hb-input.entry.js +39 -3
  381. package/dist/esm/hb-input.entry.js.map +1 -1
  382. package/dist/esm/hb-layout.entry.js +36 -14
  383. package/dist/esm/hb-layout.entry.js.map +1 -1
  384. package/dist/esm/hb-link.entry.js +2 -2
  385. package/dist/esm/hb-loading.entry.js +2 -2
  386. package/dist/esm/hb-main.entry.js +1 -1
  387. package/dist/esm/hb-menu-item.entry.js +2 -2
  388. package/dist/esm/hb-menu.entry.js +3 -3
  389. package/dist/esm/hb-menu.entry.js.map +1 -1
  390. package/dist/esm/hb-message.entry.js +2 -2
  391. package/dist/esm/hb-notification.entry.js +2 -2
  392. package/dist/esm/hb-page-header.entry.js +1 -1
  393. package/dist/esm/hb-pagination.entry.js +21 -8
  394. package/dist/esm/hb-pagination.entry.js.map +1 -1
  395. package/dist/esm/hb-popconfirm.entry.js +37 -7
  396. package/dist/esm/hb-popconfirm.entry.js.map +1 -1
  397. package/dist/esm/hb-popover.entry.js +22 -2
  398. package/dist/esm/hb-popover.entry.js.map +1 -1
  399. package/dist/esm/hb-progress.entry.js +1 -1
  400. package/dist/esm/hb-radio.entry.js +2 -2
  401. package/dist/esm/hb-rate.entry.js +45 -3
  402. package/dist/esm/hb-rate.entry.js.map +1 -1
  403. package/dist/esm/hb-result.entry.js +1 -1
  404. package/dist/esm/hb-row.entry.js +2 -2
  405. package/dist/esm/hb-segmented.entry.js +40 -6
  406. package/dist/esm/hb-segmented.entry.js.map +1 -1
  407. package/dist/esm/hb-select.entry.js +47 -8
  408. package/dist/esm/hb-select.entry.js.map +1 -1
  409. package/dist/esm/hb-slider.entry.js +189 -20
  410. package/dist/esm/hb-slider.entry.js.map +1 -1
  411. package/dist/esm/hb-space.entry.js +2 -2
  412. package/dist/esm/hb-statistic.entry.js +1 -1
  413. package/dist/esm/hb-step.entry.js +1 -1
  414. package/dist/esm/hb-steps.entry.js +28 -7
  415. package/dist/esm/hb-steps.entry.js.map +1 -1
  416. package/dist/esm/hb-sub-menu.entry.js +4 -4
  417. package/dist/esm/hb-switch.entry.js +9 -4
  418. package/dist/esm/hb-switch.entry.js.map +1 -1
  419. package/dist/esm/hb-tab-pane.entry.js +1 -1
  420. package/dist/esm/hb-table.entry.js +1 -1
  421. package/dist/esm/hb-table.entry.js.map +1 -1
  422. package/dist/esm/hb-tabs.entry.js +2 -2
  423. package/dist/esm/hb-tag.entry.js +2 -2
  424. package/dist/esm/hb-text.entry.js +2 -2
  425. package/dist/esm/hb-time-picker.entry.js +4 -4
  426. package/dist/esm/hb-time-select.entry.js +2 -2
  427. package/dist/esm/hb-timeline.entry.js +1 -1
  428. package/dist/esm/hb-tooltip.entry.js +18 -1
  429. package/dist/esm/hb-tooltip.entry.js.map +1 -1
  430. package/dist/esm/hb-transfer.entry.js +2 -2
  431. package/dist/esm/hb-tree-select.entry.js +95 -18
  432. package/dist/esm/hb-tree-select.entry.js.map +1 -1
  433. package/dist/esm/hb-tree.entry.js +1 -1
  434. package/dist/esm/hb-upload.entry.js +3 -3
  435. package/dist/esm/hb-watermark.entry.js +1 -1
  436. package/dist/esm/huibo-ui.js +1 -1
  437. package/dist/esm/loader.js +1 -1
  438. package/dist/huibo-ui/huibo-ui.css +1 -1
  439. package/dist/huibo-ui/huibo-ui.esm.js +1 -1
  440. package/dist/huibo-ui/huibo-ui.esm.js.map +1 -1
  441. package/dist/huibo-ui/p-02f15843.entry.js +2 -0
  442. package/dist/huibo-ui/p-08b4005c.js +2 -0
  443. package/dist/huibo-ui/p-08b4005c.js.map +1 -0
  444. package/dist/huibo-ui/{p-fd19813c.entry.js → p-0d4b2997.entry.js} +2 -2
  445. package/dist/huibo-ui/{p-672076c3.entry.js → p-10f6c184.entry.js} +2 -2
  446. package/dist/huibo-ui/p-10f6c184.entry.js.map +1 -0
  447. package/dist/huibo-ui/{p-d7815b4f.entry.js → p-13010da2.entry.js} +2 -2
  448. package/dist/huibo-ui/{p-8c80a765.entry.js → p-15db24e9.entry.js} +2 -2
  449. package/dist/huibo-ui/{p-8d925e3d.entry.js → p-1b0fbe69.entry.js} +2 -2
  450. package/dist/huibo-ui/p-1f8db37a.entry.js +2 -0
  451. package/dist/huibo-ui/p-1f8db37a.entry.js.map +1 -0
  452. package/dist/huibo-ui/{p-f374d5a3.entry.js → p-20632186.entry.js} +2 -2
  453. package/dist/huibo-ui/{p-e6f2d71d.entry.js → p-20fc554b.entry.js} +2 -2
  454. package/dist/huibo-ui/{p-315feadf.entry.js → p-213b9de7.entry.js} +2 -2
  455. package/dist/huibo-ui/p-25fd7d5c.entry.js +2 -0
  456. package/dist/huibo-ui/p-25fd7d5c.entry.js.map +1 -0
  457. package/dist/huibo-ui/p-2811e603.entry.js +2 -0
  458. package/dist/huibo-ui/p-2811e603.entry.js.map +1 -0
  459. package/dist/huibo-ui/{p-64ca0980.entry.js → p-2943f5d0.entry.js} +2 -2
  460. package/dist/huibo-ui/p-2943f5d0.entry.js.map +1 -0
  461. package/dist/huibo-ui/{p-710f38de.entry.js → p-2b4556ff.entry.js} +2 -2
  462. package/dist/huibo-ui/{p-e0ab9010.entry.js → p-33de6878.entry.js} +2 -2
  463. package/dist/huibo-ui/{p-ebd04656.entry.js → p-3807da71.entry.js} +2 -2
  464. package/dist/huibo-ui/{p-6a1ec3ff.entry.js → p-3deff48c.entry.js} +2 -2
  465. package/dist/huibo-ui/{p-e2a8a396.entry.js → p-41d9c846.entry.js} +2 -2
  466. package/dist/huibo-ui/{p-0a033738.entry.js → p-47ef7a86.entry.js} +2 -2
  467. package/dist/huibo-ui/p-4d34e43e.entry.js +2 -0
  468. package/dist/huibo-ui/p-4d34e43e.entry.js.map +1 -0
  469. package/dist/huibo-ui/p-54aa2fd8.entry.js +2 -0
  470. package/dist/huibo-ui/p-54aa2fd8.entry.js.map +1 -0
  471. package/dist/huibo-ui/{p-88127de1.entry.js → p-55cd13eb.entry.js} +2 -2
  472. package/dist/huibo-ui/{p-58ebb9b3.entry.js → p-5c839288.entry.js} +2 -2
  473. package/dist/huibo-ui/{p-c1b4eacb.entry.js → p-60532a1f.entry.js} +2 -2
  474. package/dist/huibo-ui/{p-59b2e61c.entry.js → p-626b48f1.entry.js} +2 -2
  475. package/dist/huibo-ui/p-626b48f1.entry.js.map +1 -0
  476. package/dist/huibo-ui/p-639f167d.entry.js +2 -0
  477. package/dist/huibo-ui/p-639f167d.entry.js.map +1 -0
  478. package/dist/huibo-ui/{p-f1c084c5.entry.js → p-678b4212.entry.js} +2 -2
  479. package/dist/huibo-ui/p-6beb5b81.entry.js +2 -0
  480. package/dist/huibo-ui/p-6beb5b81.entry.js.map +1 -0
  481. package/dist/huibo-ui/{p-a0015341.entry.js → p-6bfeab80.entry.js} +2 -2
  482. package/dist/huibo-ui/p-6c8cf248.entry.js +2 -0
  483. package/dist/huibo-ui/p-6c8cf248.entry.js.map +1 -0
  484. package/dist/huibo-ui/{p-85f68526.entry.js → p-735bceef.entry.js} +2 -2
  485. package/dist/huibo-ui/{p-8b1ae77e.entry.js → p-746a11a3.entry.js} +2 -2
  486. package/dist/huibo-ui/p-76519752.entry.js +2 -0
  487. package/dist/huibo-ui/{p-d3939d44.entry.js → p-79af2efa.entry.js} +2 -2
  488. package/dist/huibo-ui/{p-e0768565.entry.js → p-7da14d7c.entry.js} +2 -2
  489. package/dist/huibo-ui/{p-8c987d57.entry.js → p-7f65dc36.entry.js} +2 -2
  490. package/dist/huibo-ui/{p-0e65e1bd.entry.js → p-86bdc48a.entry.js} +2 -2
  491. package/dist/huibo-ui/p-86bdc48a.entry.js.map +1 -0
  492. package/dist/huibo-ui/{p-d87fc21a.entry.js → p-88a6c905.entry.js} +2 -2
  493. package/dist/huibo-ui/{p-d64b91ef.entry.js → p-89ea1141.entry.js} +2 -2
  494. package/dist/huibo-ui/p-89ea1141.entry.js.map +1 -0
  495. package/dist/huibo-ui/p-8a202bc5.entry.js +2 -0
  496. package/dist/huibo-ui/p-8a202bc5.entry.js.map +1 -0
  497. package/dist/huibo-ui/p-8a8443b8.entry.js +2 -0
  498. package/dist/huibo-ui/p-8a8443b8.entry.js.map +1 -0
  499. package/dist/huibo-ui/p-8fd788c9.entry.js +2 -0
  500. package/dist/huibo-ui/p-8fd788c9.entry.js.map +1 -0
  501. package/dist/huibo-ui/{p-9319c650.entry.js → p-8fdbd17c.entry.js} +2 -2
  502. package/dist/huibo-ui/p-92521c31.entry.js +2 -0
  503. package/dist/huibo-ui/p-92521c31.entry.js.map +1 -0
  504. package/dist/huibo-ui/{p-c3e665f6.entry.js → p-9a5406f0.entry.js} +2 -2
  505. package/dist/huibo-ui/p-9a5406f0.entry.js.map +1 -0
  506. package/dist/huibo-ui/{p-c321c4aa.entry.js → p-a084b8e5.entry.js} +2 -2
  507. package/dist/huibo-ui/{p-5df47135.entry.js → p-a190ca89.entry.js} +2 -2
  508. package/dist/huibo-ui/{p-463de26d.entry.js → p-a8996d22.entry.js} +2 -2
  509. package/dist/huibo-ui/p-aa5e5e02.entry.js +2 -0
  510. package/dist/huibo-ui/p-aa5e5e02.entry.js.map +1 -0
  511. package/dist/huibo-ui/{p-6b381d0e.entry.js → p-ab9cf0e4.entry.js} +2 -2
  512. package/dist/huibo-ui/{p-477d8568.entry.js → p-aeae83af.entry.js} +2 -2
  513. package/dist/huibo-ui/{p-77017274.entry.js → p-af74667d.entry.js} +2 -2
  514. package/dist/huibo-ui/{p-b489a526.entry.js → p-b06c8020.entry.js} +2 -2
  515. package/dist/huibo-ui/{p-2e6584ea.entry.js → p-b468858e.entry.js} +2 -2
  516. package/dist/huibo-ui/{p-2b286698.entry.js → p-b7885d4a.entry.js} +2 -2
  517. package/dist/huibo-ui/{p-231a7335.entry.js → p-b8d87f7e.entry.js} +2 -2
  518. package/dist/huibo-ui/{p-8b027491.entry.js → p-c50ad398.entry.js} +2 -2
  519. package/dist/huibo-ui/p-c6c91664.entry.js +2 -0
  520. package/dist/huibo-ui/{p-c3e8893d.entry.js → p-c80f8ace.entry.js} +2 -2
  521. package/dist/huibo-ui/p-c80f8ace.entry.js.map +1 -0
  522. package/dist/huibo-ui/{p-476527c1.entry.js → p-c8e917db.entry.js} +2 -2
  523. package/dist/huibo-ui/p-c8e917db.entry.js.map +1 -0
  524. package/dist/huibo-ui/{p-c922d672.entry.js → p-cad57c2d.entry.js} +2 -2
  525. package/dist/huibo-ui/{p-a042e3d0.entry.js → p-ccd09d5a.entry.js} +2 -2
  526. package/dist/huibo-ui/p-d79a15b1.entry.js +2 -0
  527. package/dist/huibo-ui/p-d79a15b1.entry.js.map +1 -0
  528. package/dist/huibo-ui/{p-10c088f3.entry.js → p-d9c7c378.entry.js} +2 -2
  529. package/dist/huibo-ui/{p-80aca641.entry.js → p-dfccc7aa.entry.js} +2 -2
  530. package/dist/huibo-ui/{p-21682e92.entry.js → p-dfd144d8.entry.js} +2 -2
  531. package/dist/huibo-ui/{p-be48d2aa.entry.js → p-e039155d.entry.js} +2 -2
  532. package/dist/huibo-ui/{p-dfaf7e37.entry.js → p-e10fcfbe.entry.js} +2 -2
  533. package/dist/huibo-ui/{p-079a4130.entry.js → p-e3155cd7.entry.js} +2 -2
  534. package/dist/huibo-ui/{p-4001c08d.entry.js → p-e5cbfa9e.entry.js} +2 -2
  535. package/dist/huibo-ui/p-e5cbfa9e.entry.js.map +1 -0
  536. package/dist/huibo-ui/p-edbda423.entry.js +2 -0
  537. package/dist/huibo-ui/p-edbda423.entry.js.map +1 -0
  538. package/dist/huibo-ui/{p-465dcb4c.entry.js → p-f2c78699.entry.js} +2 -2
  539. package/dist/huibo-ui/{p-6ac242fe.entry.js → p-f4336be9.entry.js} +2 -2
  540. package/dist/huibo-ui/{p-332c8877.entry.js → p-f5969181.entry.js} +2 -2
  541. package/dist/huibo-ui/{p-f81ec512.entry.js → p-f6889710.entry.js} +2 -2
  542. package/dist/huibo-ui/{p-24ad7eec.entry.js → p-f9bb5217.entry.js} +2 -2
  543. package/dist/huibo-ui/{p-4d8b1404.entry.js → p-fd8301c6.entry.js} +2 -2
  544. package/dist/huibo-ui/{p-dd05cb2c.entry.js → p-fea20295.entry.js} +2 -2
  545. package/dist/types/components/Calendar/Calendar.d.ts +13 -1
  546. package/dist/types/components/Cascader/Cascader.d.ts +68 -90
  547. package/dist/types/components/ColorPicker/ColorPicker.d.ts +11 -0
  548. package/dist/types/components/DatePicker/DatePicker.d.ts +14 -3
  549. package/dist/types/components/Dropdown/Dropdown.d.ts +14 -1
  550. package/dist/types/components/Form/FormItem.d.ts +10 -0
  551. package/dist/types/components/ImagePreview/ImagePreview.d.ts +5 -1
  552. package/dist/types/components/Input/Input.d.ts +9 -0
  553. package/dist/types/components/Layout/Layout.d.ts +20 -10
  554. package/dist/types/components/Pagination/Pagination.d.ts +3 -0
  555. package/dist/types/components/Popconfirm/Popconfirm.d.ts +12 -0
  556. package/dist/types/components/Popover/Popover.d.ts +9 -0
  557. package/dist/types/components/Rate/Rate.d.ts +7 -0
  558. package/dist/types/components/Segmented/Segmented.d.ts +12 -1
  559. package/dist/types/components/Select/Select.d.ts +6 -0
  560. package/dist/types/components/Slider/Slider.d.ts +27 -1
  561. package/dist/types/components/Steps/Steps.d.ts +14 -6
  562. package/dist/types/components/Tooltip/Tooltip.d.ts +9 -1
  563. package/dist/types/components/TreeSelect/TreeSelect.d.ts +9 -0
  564. package/dist/types/components.d.ts +250 -94
  565. package/dist/types/utils/date-helpers.d.ts +1 -1
  566. package/package.json +8 -2
  567. package/readme.md +88 -73
  568. package/dist/cjs/date-helpers-904747ff.js.map +0 -1
  569. package/dist/components/p-cf94cbf6.js.map +0 -1
  570. package/dist/esm/date-helpers-e4d85a67.js.map +0 -1
  571. package/dist/huibo-ui/p-003cee87.entry.js +0 -2
  572. package/dist/huibo-ui/p-003cee87.entry.js.map +0 -1
  573. package/dist/huibo-ui/p-0bef78ac.entry.js +0 -2
  574. package/dist/huibo-ui/p-0bef78ac.entry.js.map +0 -1
  575. package/dist/huibo-ui/p-0e65e1bd.entry.js.map +0 -1
  576. package/dist/huibo-ui/p-0f189251.entry.js +0 -2
  577. package/dist/huibo-ui/p-0f189251.entry.js.map +0 -1
  578. package/dist/huibo-ui/p-1b5acd6d.entry.js +0 -2
  579. package/dist/huibo-ui/p-1b5acd6d.entry.js.map +0 -1
  580. package/dist/huibo-ui/p-3c7f73c8.entry.js +0 -2
  581. package/dist/huibo-ui/p-3c7f73c8.entry.js.map +0 -1
  582. package/dist/huibo-ui/p-4001c08d.entry.js.map +0 -1
  583. package/dist/huibo-ui/p-44c48246.entry.js +0 -2
  584. package/dist/huibo-ui/p-44c48246.entry.js.map +0 -1
  585. package/dist/huibo-ui/p-476527c1.entry.js.map +0 -1
  586. package/dist/huibo-ui/p-4d0dff15.entry.js +0 -2
  587. package/dist/huibo-ui/p-58d20809.entry.js +0 -2
  588. package/dist/huibo-ui/p-58d20809.entry.js.map +0 -1
  589. package/dist/huibo-ui/p-59b2e61c.entry.js.map +0 -1
  590. package/dist/huibo-ui/p-64ca0980.entry.js.map +0 -1
  591. package/dist/huibo-ui/p-672076c3.entry.js.map +0 -1
  592. package/dist/huibo-ui/p-756acbdb.entry.js +0 -2
  593. package/dist/huibo-ui/p-756acbdb.entry.js.map +0 -1
  594. package/dist/huibo-ui/p-75a93de3.entry.js +0 -2
  595. package/dist/huibo-ui/p-75a93de3.entry.js.map +0 -1
  596. package/dist/huibo-ui/p-769960f4.entry.js +0 -2
  597. package/dist/huibo-ui/p-8d615521.entry.js +0 -2
  598. package/dist/huibo-ui/p-8d615521.entry.js.map +0 -1
  599. package/dist/huibo-ui/p-953b9514.entry.js +0 -2
  600. package/dist/huibo-ui/p-ad6b0c6e.entry.js +0 -2
  601. package/dist/huibo-ui/p-ad6b0c6e.entry.js.map +0 -1
  602. package/dist/huibo-ui/p-c1a059d9.entry.js +0 -2
  603. package/dist/huibo-ui/p-c1a059d9.entry.js.map +0 -1
  604. package/dist/huibo-ui/p-c3e665f6.entry.js.map +0 -1
  605. package/dist/huibo-ui/p-c3e8893d.entry.js.map +0 -1
  606. package/dist/huibo-ui/p-cf94cbf6.js +0 -2
  607. package/dist/huibo-ui/p-cf94cbf6.js.map +0 -1
  608. package/dist/huibo-ui/p-d64b91ef.entry.js.map +0 -1
  609. package/dist/huibo-ui/p-e9490259.entry.js +0 -2
  610. package/dist/huibo-ui/p-e9490259.entry.js.map +0 -1
  611. package/dist/huibo-ui/p-ed0ff857.entry.js +0 -2
  612. package/dist/huibo-ui/p-ed0ff857.entry.js.map +0 -1
  613. package/dist/huibo-ui/p-f0ac7db5.entry.js +0 -2
  614. package/dist/huibo-ui/p-f0ac7db5.entry.js.map +0 -1
  615. /package/dist/huibo-ui/{p-4d0dff15.entry.js.map → p-02f15843.entry.js.map} +0 -0
  616. /package/dist/huibo-ui/{p-fd19813c.entry.js.map → p-0d4b2997.entry.js.map} +0 -0
  617. /package/dist/huibo-ui/{p-d7815b4f.entry.js.map → p-13010da2.entry.js.map} +0 -0
  618. /package/dist/huibo-ui/{p-8c80a765.entry.js.map → p-15db24e9.entry.js.map} +0 -0
  619. /package/dist/huibo-ui/{p-8d925e3d.entry.js.map → p-1b0fbe69.entry.js.map} +0 -0
  620. /package/dist/huibo-ui/{p-f374d5a3.entry.js.map → p-20632186.entry.js.map} +0 -0
  621. /package/dist/huibo-ui/{p-e6f2d71d.entry.js.map → p-20fc554b.entry.js.map} +0 -0
  622. /package/dist/huibo-ui/{p-315feadf.entry.js.map → p-213b9de7.entry.js.map} +0 -0
  623. /package/dist/huibo-ui/{p-710f38de.entry.js.map → p-2b4556ff.entry.js.map} +0 -0
  624. /package/dist/huibo-ui/{p-e0ab9010.entry.js.map → p-33de6878.entry.js.map} +0 -0
  625. /package/dist/huibo-ui/{p-ebd04656.entry.js.map → p-3807da71.entry.js.map} +0 -0
  626. /package/dist/huibo-ui/{p-6a1ec3ff.entry.js.map → p-3deff48c.entry.js.map} +0 -0
  627. /package/dist/huibo-ui/{p-e2a8a396.entry.js.map → p-41d9c846.entry.js.map} +0 -0
  628. /package/dist/huibo-ui/{p-0a033738.entry.js.map → p-47ef7a86.entry.js.map} +0 -0
  629. /package/dist/huibo-ui/{p-88127de1.entry.js.map → p-55cd13eb.entry.js.map} +0 -0
  630. /package/dist/huibo-ui/{p-58ebb9b3.entry.js.map → p-5c839288.entry.js.map} +0 -0
  631. /package/dist/huibo-ui/{p-c1b4eacb.entry.js.map → p-60532a1f.entry.js.map} +0 -0
  632. /package/dist/huibo-ui/{p-f1c084c5.entry.js.map → p-678b4212.entry.js.map} +0 -0
  633. /package/dist/huibo-ui/{p-a0015341.entry.js.map → p-6bfeab80.entry.js.map} +0 -0
  634. /package/dist/huibo-ui/{p-85f68526.entry.js.map → p-735bceef.entry.js.map} +0 -0
  635. /package/dist/huibo-ui/{p-8b1ae77e.entry.js.map → p-746a11a3.entry.js.map} +0 -0
  636. /package/dist/huibo-ui/{p-953b9514.entry.js.map → p-76519752.entry.js.map} +0 -0
  637. /package/dist/huibo-ui/{p-d3939d44.entry.js.map → p-79af2efa.entry.js.map} +0 -0
  638. /package/dist/huibo-ui/{p-e0768565.entry.js.map → p-7da14d7c.entry.js.map} +0 -0
  639. /package/dist/huibo-ui/{p-8c987d57.entry.js.map → p-7f65dc36.entry.js.map} +0 -0
  640. /package/dist/huibo-ui/{p-d87fc21a.entry.js.map → p-88a6c905.entry.js.map} +0 -0
  641. /package/dist/huibo-ui/{p-9319c650.entry.js.map → p-8fdbd17c.entry.js.map} +0 -0
  642. /package/dist/huibo-ui/{p-c321c4aa.entry.js.map → p-a084b8e5.entry.js.map} +0 -0
  643. /package/dist/huibo-ui/{p-5df47135.entry.js.map → p-a190ca89.entry.js.map} +0 -0
  644. /package/dist/huibo-ui/{p-463de26d.entry.js.map → p-a8996d22.entry.js.map} +0 -0
  645. /package/dist/huibo-ui/{p-6b381d0e.entry.js.map → p-ab9cf0e4.entry.js.map} +0 -0
  646. /package/dist/huibo-ui/{p-477d8568.entry.js.map → p-aeae83af.entry.js.map} +0 -0
  647. /package/dist/huibo-ui/{p-77017274.entry.js.map → p-af74667d.entry.js.map} +0 -0
  648. /package/dist/huibo-ui/{p-b489a526.entry.js.map → p-b06c8020.entry.js.map} +0 -0
  649. /package/dist/huibo-ui/{p-2e6584ea.entry.js.map → p-b468858e.entry.js.map} +0 -0
  650. /package/dist/huibo-ui/{p-2b286698.entry.js.map → p-b7885d4a.entry.js.map} +0 -0
  651. /package/dist/huibo-ui/{p-231a7335.entry.js.map → p-b8d87f7e.entry.js.map} +0 -0
  652. /package/dist/huibo-ui/{p-8b027491.entry.js.map → p-c50ad398.entry.js.map} +0 -0
  653. /package/dist/huibo-ui/{p-769960f4.entry.js.map → p-c6c91664.entry.js.map} +0 -0
  654. /package/dist/huibo-ui/{p-c922d672.entry.js.map → p-cad57c2d.entry.js.map} +0 -0
  655. /package/dist/huibo-ui/{p-a042e3d0.entry.js.map → p-ccd09d5a.entry.js.map} +0 -0
  656. /package/dist/huibo-ui/{p-10c088f3.entry.js.map → p-d9c7c378.entry.js.map} +0 -0
  657. /package/dist/huibo-ui/{p-80aca641.entry.js.map → p-dfccc7aa.entry.js.map} +0 -0
  658. /package/dist/huibo-ui/{p-21682e92.entry.js.map → p-dfd144d8.entry.js.map} +0 -0
  659. /package/dist/huibo-ui/{p-be48d2aa.entry.js.map → p-e039155d.entry.js.map} +0 -0
  660. /package/dist/huibo-ui/{p-dfaf7e37.entry.js.map → p-e10fcfbe.entry.js.map} +0 -0
  661. /package/dist/huibo-ui/{p-079a4130.entry.js.map → p-e3155cd7.entry.js.map} +0 -0
  662. /package/dist/huibo-ui/{p-465dcb4c.entry.js.map → p-f2c78699.entry.js.map} +0 -0
  663. /package/dist/huibo-ui/{p-6ac242fe.entry.js.map → p-f4336be9.entry.js.map} +0 -0
  664. /package/dist/huibo-ui/{p-332c8877.entry.js.map → p-f5969181.entry.js.map} +0 -0
  665. /package/dist/huibo-ui/{p-f81ec512.entry.js.map → p-f6889710.entry.js.map} +0 -0
  666. /package/dist/huibo-ui/{p-24ad7eec.entry.js.map → p-f9bb5217.entry.js.map} +0 -0
  667. /package/dist/huibo-ui/{p-4d8b1404.entry.js.map → p-fd8301c6.entry.js.map} +0 -0
  668. /package/dist/huibo-ui/{p-dd05cb2c.entry.js.map → p-fea20295.entry.js.map} +0 -0
@@ -44,12 +44,12 @@ export class Notification {
44
44
  this.hbClose.emit(this.id);
45
45
  };
46
46
  render() {
47
- return (h("div", { key: '9848b6a924f89df2fa9996742f06986ad8c33da5', class: {
47
+ return (h("div", { key: '9be96a5baeb818da2c93a36e47c25aaa64bc5cfa', class: {
48
48
  'hb-notification': true,
49
49
  [`hb-notification--${this.type}`]: true,
50
50
  [`hb-notification--${this.position}`]: true,
51
51
  'hb-notification--visible': this.visible,
52
- }, role: "alert" }, h("div", { key: 'a15adaf1401116e0dd462fa2a9abf56595052069', class: "hb-notification__icon", "aria-hidden": "true" }, h("span", { key: '7d56d7ce4760963f1bd7c214c5d19c9003e302ee', class: `hb-notification__icon-sign hb-notification__icon-sign--${this.type}` })), h("div", { key: '881c23e049f6870a4f2a4db347fdfaedc331708e', class: "hb-notification__content" }, this.title && h("div", { key: '034c55a3d5b0b4bbb27657db8f2f35bf917caf91', class: "hb-notification__title" }, this.title), this.message && h("div", { key: '0d49cebbf4e1db0baa953691c7519a2a8469563d', class: "hb-notification__message" }, this.message)), this.showClose && (h("button", { key: '180dc1d07aa4993a25ef97e92eb8ab4700e6c120', type: "button", class: "hb-notification__close", onClick: this.close, "aria-label": "\u5173\u95ED" }, "\u00D7"))));
52
+ }, role: "alert" }, h("div", { key: '81e28521a930f9dfabe4c5cdc821bf25fe15fc6a', class: "hb-notification__icon", "aria-hidden": "true" }, h("span", { key: '5023ecaabb4a12ecc2c7dbc1ce0f5ff9d979ced9', class: `hb-notification__icon-sign hb-notification__icon-sign--${this.type}` })), h("div", { key: '525ed80909f70b304eb4460bd2ad70e1ee969a8e', class: "hb-notification__content" }, this.title && h("div", { key: '5c7ff54e7c91a0df0e476db31f6df33262cf15ec', class: "hb-notification__title" }, this.title), this.message && h("div", { key: '25b34f64119a5ac609deab1633b8876036fd73df', class: "hb-notification__message" }, this.message)), this.showClose && (h("button", { key: '5999ff418c3e232e74257be4ea3d8cfe619cb401', type: "button", class: "hb-notification__close", onClick: this.close, "aria-label": "\u5173\u95ED" }, "\u00D7"))));
53
53
  }
54
54
  static get is() { return "hb-notification"; }
55
55
  static get encapsulation() { return "shadow"; }
@@ -19,7 +19,7 @@ export class PageHeader {
19
19
  this.hbBack.emit();
20
20
  };
21
21
  render() {
22
- return (h("div", { key: '1b030e60e77df9e97b6d60f704e521c05ae7af51', class: { 'hb-page-header': true, 'hb-page-header--ghost': this.ghost } }, h("div", { key: '2ee91ddf333fe5e771c9cbb0a62b14b03a3b1663', class: "hb-page-header__main" }, this.back && (h("button", { key: '225309da83f36a22e5e75200344399bcb94a3391', type: "button", class: "hb-page-header__back", onClick: this.handleBack, "aria-label": "\u8FD4\u56DE" }, h("span", { key: '1f67010455c9c682df8cefbb2dd81b1a41a73457', class: "hb-page-header__back-arrow" }, "\u2190"))), h("div", { key: '50ec1439869c987330e4536fe6f12e62416b1527', class: "hb-page-header__titles" }, this.title && h("span", { key: 'cdfde7eb8f6b643ea01327c87cab94db474b0825', class: "hb-page-header__title" }, this.title), this.subtitle && h("span", { key: '21756140f35d3fb19cea52d6c5a9e759641c0118', class: "hb-page-header__subtitle" }, this.subtitle))), h("div", { key: '59b5e1c8a71f17e9bb647394048ffe9484a85a5a', class: "hb-page-header__extra" }, h("slot", { key: '2c0543b118ac038e47b0aad6b389b996bf4f163c' }))));
22
+ return (h("div", { key: 'd0a12aabf3367b79a6b772519747bf8a1bc4b6a6', class: { 'hb-page-header': true, 'hb-page-header--ghost': this.ghost } }, h("div", { key: 'a1b06d2e308104ac47c6ef8fea494d50f11491ba', class: "hb-page-header__main" }, this.back && (h("button", { key: '9bff3ddc9271167a63b1abca030299a09fa92281', type: "button", class: "hb-page-header__back", onClick: this.handleBack, "aria-label": "\u8FD4\u56DE" }, h("span", { key: '099fa0f3b3c5aa3da46e72b1341589f90406ac85', class: "hb-page-header__back-arrow" }, "\u2190"))), h("div", { key: '17ab5366d4b9e0ccc5a3ed593a2564afdf7a333b', class: "hb-page-header__titles" }, this.title && h("span", { key: '587984784445116a7a20485d405fb8e8920fd631', class: "hb-page-header__title" }, this.title), this.subtitle && h("span", { key: '36d2e8452515ae043d87fb8371b5d6c3f7fd5121', class: "hb-page-header__subtitle" }, this.subtitle))), h("div", { key: '1cda5981edc21edafe737c1b8b4c922a14676787', class: "hb-page-header__extra" }, h("slot", { key: '67e7fa41c6467e676e7e46a11a2d3fe6bf7db413' }))));
23
23
  }
24
24
  static get is() { return "hb-page-header"; }
25
25
  static get encapsulation() { return "shadow"; }
@@ -21,6 +21,8 @@ export class Pagination {
21
21
  /** 是否显示每页条数选择器 */
22
22
  showPageSize = false;
23
23
  internalCurrent = 1;
24
+ /** 内部每页条数:pageSize 变更时同步;size 切换后立即生效重算 totalPages */
25
+ internalPageSize = 10;
24
26
  /** 当前页改变事件 */
25
27
  hbCurrentChange;
26
28
  /** 每页条数改变事件 */
@@ -28,11 +30,15 @@ export class Pagination {
28
30
  handleCurrentPageChange() {
29
31
  this.internalCurrent = this.currentPage;
30
32
  }
33
+ handlePageSizeChange() {
34
+ this.internalPageSize = this.pageSize;
35
+ }
31
36
  componentDidLoad() {
32
37
  this.internalCurrent = this.currentPage;
38
+ this.internalPageSize = this.pageSize;
33
39
  }
34
40
  get totalPages() {
35
- return Math.max(1, Math.ceil(this.total / this.pageSize));
41
+ return Math.max(1, Math.ceil(this.total / this.internalPageSize));
36
42
  }
37
43
  handlePageClick(page) {
38
44
  if (this.disabled || page === this.internalCurrent || page < 1 || page > this.totalPages)
@@ -44,10 +50,16 @@ export class Pagination {
44
50
  handleSizeChange(e) {
45
51
  const target = e.target;
46
52
  const size = parseInt(target.value, 10);
53
+ // 切 pageSize 后立即重算 totalPages,并防止 currentPage 越界
54
+ this.internalPageSize = size;
55
+ const newTotal = Math.max(1, Math.ceil(this.total / size));
56
+ const safePage = Math.min(this.internalCurrent, newTotal);
47
57
  this.hbSizeChange.emit(size);
48
- this.internalCurrent = 1;
49
- this.currentPage = 1;
50
- this.hbCurrentChange.emit(1);
58
+ this.internalCurrent = safePage;
59
+ this.currentPage = safePage;
60
+ if (safePage !== this.internalCurrent) {
61
+ this.hbCurrentChange.emit(safePage);
62
+ }
51
63
  }
52
64
  getPages() {
53
65
  const pages = [];
@@ -82,10 +94,10 @@ export class Pagination {
82
94
  }
83
95
  render() {
84
96
  const pages = this.getPages();
85
- return (h("div", { key: '889d6db49b4a7af7ad353fcc36de1aed8499708a', class: { 'hb-pagination': true, 'hb-pagination--disabled': this.disabled } }, this.showTotal && (h("span", { key: 'f914032da52a9919a81087d627a67e68456dc89d', class: "hb-pagination__total" }, "\u5171 ", this.total, " \u6761")), this.showPageSize && (h("select", { key: '30b748ffd520e94a1a1c512e49393c3065f89216', class: "hb-pagination__sizes", onChange: this.handleSizeChange, disabled: this.disabled }, this.pageSizes.map(size => (h("option", { value: size, selected: size === this.pageSize }, size, " \u6761/\u9875"))))), h("button", { key: '2a7ba780e83f94d476b340d2d47b20e772132dd4', type: "button", class: "hb-pagination__btn hb-pagination__prev", disabled: this.disabled || this.internalCurrent <= 1, onClick: () => this.handlePageClick(this.internalCurrent - 1) }, "\u2039"), pages.map(page => page === '...' ? (h("span", { class: "hb-pagination__ellipsis" }, "...")) : (h("button", { type: "button", class: {
97
+ return (h("nav", { key: '1ad5e15f959e5d71db7c55ad58407ace19a2ceb6', class: { 'hb-pagination': true, 'hb-pagination--disabled': this.disabled }, role: "navigation", "aria-label": "\u5206\u9875" }, this.showTotal && (h("span", { key: '182f0f2e1c1b5f76a1d3f9bd3c2273c7344d2caf', class: "hb-pagination__total", "aria-live": "polite" }, "\u5171 ", this.total, " \u6761")), this.showPageSize && (h("select", { key: 'ecec24301264fbdc4b60c21bd16ba95c02b918b3', class: "hb-pagination__sizes", onChange: this.handleSizeChange, disabled: this.disabled, "aria-label": "\u6BCF\u9875\u6761\u6570" }, this.pageSizes.map(size => (h("option", { value: size, selected: size === this.internalPageSize }, size, " \u6761/\u9875"))))), h("button", { key: '59241c75873ddfa529e868d5660d3d00ad83009b', type: "button", class: "hb-pagination__btn hb-pagination__prev", disabled: this.disabled || this.internalCurrent <= 1, onClick: () => this.handlePageClick(this.internalCurrent - 1), "aria-label": "\u4E0A\u4E00\u9875" }, "\u2039"), pages.map(page => page === '...' ? (h("span", { class: "hb-pagination__ellipsis", "aria-hidden": "true" }, "...")) : (h("button", { type: "button", class: {
86
98
  'hb-pagination__btn': true,
87
99
  'hb-pagination__btn--active': page === this.internalCurrent,
88
- }, disabled: this.disabled, onClick: () => this.handlePageClick(page) }, page))), h("button", { key: '7a5e6cd5eb1c3db595708687cebe52b5e0e0d88a', type: "button", class: "hb-pagination__btn hb-pagination__next", disabled: this.disabled || this.internalCurrent >= this.totalPages, onClick: () => this.handlePageClick(this.internalCurrent + 1) }, "\u203A")));
100
+ }, disabled: this.disabled, onClick: () => this.handlePageClick(page), "aria-label": `第 ${page} 页`, "aria-current": page === this.internalCurrent ? 'page' : undefined }, page))), h("button", { key: 'c9009112a278b270b164ea7ac805a8f2903d2d55', type: "button", class: "hb-pagination__btn hb-pagination__next", disabled: this.disabled || this.internalCurrent >= this.totalPages, onClick: () => this.handlePageClick(this.internalCurrent + 1), "aria-label": "\u4E0B\u4E00\u9875" }, "\u203A")));
89
101
  }
90
102
  static get is() { return "hb-pagination"; }
91
103
  static get encapsulation() { return "shadow"; }
@@ -263,7 +275,8 @@ export class Pagination {
263
275
  }
264
276
  static get states() {
265
277
  return {
266
- "internalCurrent": {}
278
+ "internalCurrent": {},
279
+ "internalPageSize": {}
267
280
  };
268
281
  }
269
282
  static get events() {
@@ -303,6 +316,9 @@ export class Pagination {
303
316
  return [{
304
317
  "propName": "currentPage",
305
318
  "methodName": "handleCurrentPageChange"
319
+ }, {
320
+ "propName": "pageSize",
321
+ "methodName": "handlePageSizeChange"
306
322
  }];
307
323
  }
308
324
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../../../src/components/Pagination/Pagination.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,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AQ,IAAI,IAAI,CAAC,eAAe,IAAI,CAAC,EACpD,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,aAGtD;YAER,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAChB,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CACf,YAAM,KAAK,EAAC,yBAAyB,UAAW,CACjD,CAAC,CAAC,CAAC,CACF,cACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE;oBACL,oBAAoB,EAAE,IAAI;oBAC1B,4BAA4B,EAAE,IAAI,KAAK,IAAI,CAAC,eAAe;iBAC5D,EACD,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,IAAc,CAAC,IAElD,IAAI,CACE,CACV,CACF;YAED,+DACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,wCAAwC,EAC9C,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,UAAU,EAClE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,aAGtD,CACL,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, Event, EventEmitter, State, Watch } from '@stencil/core';\n\n/**\n * Pagination 分页组件\n * 当数据量过多时,使用分页分解数据\n */\n@Component({\n tag: 'hb-pagination',\n styleUrl: 'pagination.css',\n shadow: true,\n})\nexport class Pagination {\n /** 总条目数 */\n @Prop() total: number = 0;\n\n /** 每页显示条目数 */\n @Prop() pageSize: number = 10;\n\n /** 当前页数 */\n @Prop({ mutable: true }) currentPage: number = 1;\n\n /** 每页显示个数选择器的选项设置 */\n @Prop() pageSizes: number[] = [10, 20, 50, 100];\n\n /** 最大页码按钮数 */\n @Prop() pagerCount: number = 7;\n\n /** 是否禁用 */\n @Prop() disabled: boolean = false;\n\n /** 是否显示总条数 */\n @Prop() showTotal: boolean = false;\n\n /** 是否显示每页条数选择器 */\n @Prop() showPageSize: boolean = false;\n\n @State() internalCurrent: number = 1;\n\n /** 当前页改变事件 */\n @Event() hbCurrentChange: EventEmitter<number>;\n\n /** 每页条数改变事件 */\n @Event() hbSizeChange: EventEmitter<number>;\n\n @Watch('currentPage')\n handleCurrentPageChange() {\n this.internalCurrent = this.currentPage;\n }\n\n componentDidLoad() {\n this.internalCurrent = this.currentPage;\n }\n\n private get totalPages(): number {\n return Math.max(1, Math.ceil(this.total / this.pageSize));\n }\n\n private handlePageClick(page: number) {\n if (this.disabled || page === this.internalCurrent || page < 1 || page > this.totalPages) return;\n this.internalCurrent = page;\n this.currentPage = page;\n this.hbCurrentChange.emit(page);\n }\n\n private handleSizeChange(e: Event) {\n const target = e.target as HTMLSelectElement;\n const size = parseInt(target.value, 10);\n this.hbSizeChange.emit(size);\n this.internalCurrent = 1;\n this.currentPage = 1;\n this.hbCurrentChange.emit(1);\n }\n\n private getPages(): (number | '...')[] {\n const pages: (number | '...')[] = [];\n const total = this.totalPages;\n const current = this.internalCurrent;\n const pager = this.pagerCount;\n\n if (total <= pager) {\n for (let i = 1; i <= total; i++) pages.push(i);\n return pages;\n }\n\n const half = Math.floor((pager - 2) / 2);\n let start = current - half;\n let end = current + half;\n\n if (start < 2) {\n start = 2;\n end = Math.min(pager - 1, total - 1);\n }\n if (end > total - 1) {\n end = total - 1;\n start = Math.max(2, total - pager + 2);\n }\n\n pages.push(1);\n if (start > 2) pages.push('...');\n for (let i = start; i <= end; i++) pages.push(i);\n if (end < total - 1) pages.push('...');\n pages.push(total);\n\n return pages;\n }\n\n render() {\n const pages = this.getPages();\n\n return (\n <div class={{ 'hb-pagination': true, 'hb-pagination--disabled': this.disabled }}>\n {this.showTotal && (\n <span class=\"hb-pagination__total\">共 {this.total} 条</span>\n )}\n\n {this.showPageSize && (\n <select class=\"hb-pagination__sizes\" onChange={this.handleSizeChange} disabled={this.disabled}>\n {this.pageSizes.map(size => (\n <option value={size} selected={size === this.pageSize}>{size} 条/页</option>\n ))}\n </select>\n )}\n\n <button\n type=\"button\"\n class=\"hb-pagination__btn hb-pagination__prev\"\n disabled={this.disabled || this.internalCurrent <= 1}\n onClick={() => this.handlePageClick(this.internalCurrent - 1)}\n >\n ‹\n </button>\n\n {pages.map(page =>\n page === '...' ? (\n <span class=\"hb-pagination__ellipsis\">...</span>\n ) : (\n <button\n type=\"button\"\n class={{\n 'hb-pagination__btn': true,\n 'hb-pagination__btn--active': page === this.internalCurrent,\n }}\n disabled={this.disabled}\n onClick={() => this.handlePageClick(page as number)}\n >\n {page}\n </button>\n )\n )}\n\n <button\n type=\"button\"\n class=\"hb-pagination__btn hb-pagination__next\"\n disabled={this.disabled || this.internalCurrent >= this.totalPages}\n onClick={() => this.handlePageClick(this.internalCurrent + 1)}\n >\n ›\n </button>\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../../../src/components/Pagination/Pagination.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtF;;;GAGG;AAMH,MAAM,OAAO,UAAU;IACrB,WAAW;IACH,KAAK,GAAW,CAAC,CAAC;IAE1B,cAAc;IACN,QAAQ,GAAW,EAAE,CAAC;IAE9B,WAAW;IACc,WAAW,GAAW,CAAC,CAAC;IAEjD,qBAA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AC,UAAU,EAClE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,gBAClD,oBAAK,aAGT,CACL,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, Event, EventEmitter, State, Watch } from '@stencil/core';\n\n/**\n * Pagination 分页组件\n * 当数据量过多时,使用分页分解数据\n */\n@Component({\n tag: 'hb-pagination',\n styleUrl: 'pagination.css',\n shadow: true,\n})\nexport class Pagination {\n /** 总条目数 */\n @Prop() total: number = 0;\n\n /** 每页显示条目数 */\n @Prop() pageSize: number = 10;\n\n /** 当前页数 */\n @Prop({ mutable: true }) currentPage: number = 1;\n\n /** 每页显示个数选择器的选项设置 */\n @Prop() pageSizes: number[] = [10, 20, 50, 100];\n\n /** 最大页码按钮数 */\n @Prop() pagerCount: number = 7;\n\n /** 是否禁用 */\n @Prop() disabled: boolean = false;\n\n /** 是否显示总条数 */\n @Prop() showTotal: boolean = false;\n\n /** 是否显示每页条数选择器 */\n @Prop() showPageSize: boolean = false;\n\n @State() internalCurrent: number = 1;\n /** 内部每页条数:pageSize 变更时同步;size 切换后立即生效重算 totalPages */\n @State() internalPageSize: number = 10;\n\n /** 当前页改变事件 */\n @Event() hbCurrentChange: EventEmitter<number>;\n\n /** 每页条数改变事件 */\n @Event() hbSizeChange: EventEmitter<number>;\n\n @Watch('currentPage')\n handleCurrentPageChange() {\n this.internalCurrent = this.currentPage;\n }\n\n @Watch('pageSize')\n handlePageSizeChange() {\n this.internalPageSize = this.pageSize;\n }\n\n componentDidLoad() {\n this.internalCurrent = this.currentPage;\n this.internalPageSize = this.pageSize;\n }\n\n private get totalPages(): number {\n return Math.max(1, Math.ceil(this.total / this.internalPageSize));\n }\n\n private handlePageClick(page: number) {\n if (this.disabled || page === this.internalCurrent || page < 1 || page > this.totalPages) return;\n this.internalCurrent = page;\n this.currentPage = page;\n this.hbCurrentChange.emit(page);\n }\n\n private handleSizeChange(e: Event) {\n const target = e.target as HTMLSelectElement;\n const size = parseInt(target.value, 10);\n // 切 pageSize 后立即重算 totalPages,并防止 currentPage 越界\n this.internalPageSize = size;\n const newTotal = Math.max(1, Math.ceil(this.total / size));\n const safePage = Math.min(this.internalCurrent, newTotal);\n this.hbSizeChange.emit(size);\n this.internalCurrent = safePage;\n this.currentPage = safePage;\n if (safePage !== this.internalCurrent) {\n this.hbCurrentChange.emit(safePage);\n }\n }\n\n private getPages(): (number | '...')[] {\n const pages: (number | '...')[] = [];\n const total = this.totalPages;\n const current = this.internalCurrent;\n const pager = this.pagerCount;\n\n if (total <= pager) {\n for (let i = 1; i <= total; i++) pages.push(i);\n return pages;\n }\n\n const half = Math.floor((pager - 2) / 2);\n let start = current - half;\n let end = current + half;\n\n if (start < 2) {\n start = 2;\n end = Math.min(pager - 1, total - 1);\n }\n if (end > total - 1) {\n end = total - 1;\n start = Math.max(2, total - pager + 2);\n }\n\n pages.push(1);\n if (start > 2) pages.push('...');\n for (let i = start; i <= end; i++) pages.push(i);\n if (end < total - 1) pages.push('...');\n pages.push(total);\n\n return pages;\n }\n\n render() {\n const pages = this.getPages();\n\n return (\n <nav\n class={{ 'hb-pagination': true, 'hb-pagination--disabled': this.disabled }}\n role=\"navigation\"\n aria-label=\"分页\"\n >\n {this.showTotal && (\n <span class=\"hb-pagination__total\" aria-live=\"polite\">共 {this.total} 条</span>\n )}\n\n {this.showPageSize && (\n <select\n class=\"hb-pagination__sizes\"\n onChange={this.handleSizeChange}\n disabled={this.disabled}\n aria-label=\"每页条数\"\n >\n {this.pageSizes.map(size => (\n <option value={size} selected={size === this.internalPageSize}>{size} 条/页</option>\n ))}\n </select>\n )}\n\n <button\n type=\"button\"\n class=\"hb-pagination__btn hb-pagination__prev\"\n disabled={this.disabled || this.internalCurrent <= 1}\n onClick={() => this.handlePageClick(this.internalCurrent - 1)}\n aria-label=\"上一页\"\n >\n ‹\n </button>\n\n {pages.map(page =>\n page === '...' ? (\n <span class=\"hb-pagination__ellipsis\" aria-hidden=\"true\">...</span>\n ) : (\n <button\n type=\"button\"\n class={{\n 'hb-pagination__btn': true,\n 'hb-pagination__btn--active': page === this.internalCurrent,\n }}\n disabled={this.disabled}\n onClick={() => this.handlePageClick(page as number)}\n aria-label={`第 ${page} 页`}\n aria-current={page === this.internalCurrent ? 'page' : undefined}\n >\n {page}\n </button>\n )\n )}\n\n <button\n type=\"button\"\n class=\"hb-pagination__btn hb-pagination__next\"\n disabled={this.disabled || this.internalCurrent >= this.totalPages}\n onClick={() => this.handlePageClick(this.internalCurrent + 1)}\n aria-label=\"下一页\"\n >\n ›\n </button>\n </nav>\n );\n }\n}\n"]}
@@ -81,3 +81,26 @@
81
81
  color: var(--hb-color-text-secondary);
82
82
  letter-spacing: 2px;
83
83
  }
84
+
85
+ /* ============================================================
86
+ * 响应式(移动端):小屏简化分页,
87
+ * 隐藏非相邻页码与省略号,仅保留 首页/上一页/当前页/下一页/末页。
88
+ * 通过 aria-hidden 而非 display:none,保持键盘可达性由 active 决定。
89
+ * ============================================================ */
90
+ @media (max-width: 575.98px) {
91
+ /* 隐藏中间页码(保留 active 与首末按钮) */
92
+ .hb-pagination__btn:not(.hb-pagination__btn--active):not(.hb-pagination__prev):not(.hb-pagination__next) {
93
+ display: none;
94
+ }
95
+
96
+ /* 隐藏省略号 */
97
+ .hb-pagination__ellipsis {
98
+ display: none;
99
+ }
100
+
101
+ /* 隐藏"共 N 条"和"每页 N 条"选择器以节省空间(信息保留在 aria-label) */
102
+ .hb-pagination__total,
103
+ .hb-pagination__sizes {
104
+ display: none;
105
+ }
106
+ }
@@ -1,5 +1,13 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { computePosition, getNextZIndex } from "../../utils/popup-manager";
3
+ import { isActivationKey } from "../../utils/a11y";
4
+ /**
5
+ * Popconfirm 气泡确认框
6
+ * 无障碍(对齐 antd / WAI-ARIA):
7
+ * - 触发器 role=button + aria-haspopup=dialog + aria-expanded + aria-describedby
8
+ * - 浮层 role=dialog + aria-live=polite(确认文屏幕阅读器实时播报)
9
+ * - 键盘:trigger Enter/Space 打开;Esc=取消关闭;打开时自动聚焦确认按钮
10
+ */
3
11
  export class Popconfirm {
4
12
  el;
5
13
  title = '确定执行此操作?';
@@ -12,13 +20,34 @@ export class Popconfirm {
12
20
  popupStyle = {};
13
21
  triggerRef;
14
22
  popupRef;
23
+ confirmBtnRef;
15
24
  show = () => {
16
- if (!this.disabled) {
17
- this.visible = true;
18
- requestAnimationFrame(() => this.updatePosition());
19
- }
25
+ if (this.disabled)
26
+ return;
27
+ this.visible = true;
28
+ requestAnimationFrame(() => {
29
+ this.updatePosition();
30
+ // 打开后自动聚焦确认按钮(对齐 antd:Enter 直接确认)
31
+ this.confirmBtnRef?.focus();
32
+ });
20
33
  };
21
34
  hide = () => { this.visible = false; };
35
+ /** 键盘:Esc 取消关闭(Enter 由聚焦的确认按钮原生处理) */
36
+ handleKeydown = (e) => {
37
+ if (e.key === 'Escape' && this.visible) {
38
+ e.preventDefault();
39
+ this.handleCancel(e);
40
+ }
41
+ };
42
+ /** 触发器键盘:Enter/Space 打开 */
43
+ handleTriggerKeydown = (e) => {
44
+ if (this.disabled)
45
+ return;
46
+ if (isActivationKey(e.key)) {
47
+ e.preventDefault();
48
+ this.show();
49
+ }
50
+ };
22
51
  updatePosition() {
23
52
  if (!this.triggerRef || !this.popupRef)
24
53
  return;
@@ -27,10 +56,18 @@ export class Popconfirm {
27
56
  const pos = computePosition(rect, pw, ph, this.placement, 8);
28
57
  this.popupStyle = { top: `${pos.top}px`, left: `${pos.left}px`, zIndex: String(getNextZIndex()) };
29
58
  }
30
- handleConfirm = (e) => { e.stopPropagation(); this.hide(); this.el.dispatchEvent(new CustomEvent('hbConfirm', { bubbles: true })); };
31
- handleCancel = (e) => { e.stopPropagation(); this.hide(); this.el.dispatchEvent(new CustomEvent('hbCancel', { bubbles: true })); };
59
+ handleConfirm = (e) => {
60
+ e.stopPropagation();
61
+ this.hide();
62
+ this.el.dispatchEvent(new CustomEvent('hbConfirm', { bubbles: true }));
63
+ };
64
+ handleCancel = (e) => {
65
+ e.stopPropagation();
66
+ this.hide();
67
+ this.el.dispatchEvent(new CustomEvent('hbCancel', { bubbles: true }));
68
+ };
32
69
  render() {
33
- return (h("div", { key: 'd4817c4b90b135f3dc911259760ec6135c014882', class: "hb-popconfirm", onClick: this.show }, h("div", { key: 'bc992147604a6b601b9bfd1848fbd9fd425bcc65', ref: (el) => { this.triggerRef = el; }, class: "hb-popconfirm__trigger" }, h("slot", { key: 'a5be9404aa726abc5c1c40292bfa3adef7793fa7' })), this.visible && (h("div", { key: '4d9794a39fe67cae8d61b6ddf421eb922e89ed4e', ref: (el) => { this.popupRef = el; }, class: "hb-popconfirm__popup", style: this.popupStyle }, h("div", { key: '15b32d88525e57064aa6c98ab5d409a86bce1a48', class: "hb-popconfirm__main" }, h("span", { key: 'a958b70e2ce984d8a87f278dcc13831778a37ddb', class: "hb-popconfirm__icon" }, this.icon), h("span", { key: 'd965d258313cf129d8d07a4085897b750cfe046b', class: "hb-popconfirm__title" }, this.title)), h("div", { key: '184c808d11c9c987d7cc8d419133f5cdc5655466', class: "hb-popconfirm__action" }, h("button", { key: '4c2f7eb3b996bd5231a1df845a6e6422a189293f', type: "button", class: "hb-popconfirm__btn hb-popconfirm__btn--cancel", onClick: this.handleCancel }, this.cancelButtonText), h("button", { key: 'de7a86643978c024e780061b775035488e879faf', type: "button", class: "hb-popconfirm__btn hb-popconfirm__btn--confirm", onClick: this.handleConfirm }, this.confirmButtonText))))));
70
+ return (h("div", { key: 'a3610b2320192960baa690acf9f0127fb36d206f', class: "hb-popconfirm", onClick: this.show, onKeyDown: this.handleKeydown }, h("div", { key: '7164d998c2d989ed702d7dac318ef4e354e74dba', ref: (el) => { this.triggerRef = el; }, class: "hb-popconfirm__trigger", role: "button", tabindex: this.disabled ? -1 : 0, "aria-haspopup": "dialog", "aria-expanded": this.visible ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', onKeyDown: this.handleTriggerKeydown }, h("slot", { key: '0c62f0d5fe58d4aec55aa22c64b7f7f66aa7780d' })), this.visible && (h("div", { key: '450446dc51b40f62b3496bea2717e95b6807a7ca', ref: (el) => { this.popupRef = el; }, class: "hb-popconfirm__popup", style: this.popupStyle, role: "dialog", "aria-live": "polite", "aria-labelledby": "hb-popconfirm__title" }, h("div", { key: '4fb63a0a1c89c0866b30acadcfeea20d6936f39a', class: "hb-popconfirm__main" }, h("span", { key: '9cb5583abfc8822f0217a43b809ca9766c35b63e', class: "hb-popconfirm__icon", "aria-hidden": "true" }, this.icon), h("span", { key: '75419c7cecb35e91134f62d9d0cfb71331813e0a', id: "hb-popconfirm__title", class: "hb-popconfirm__title" }, this.title)), h("div", { key: '6cf55c098e1926b418869ce9015ae2f25e4b41c0', class: "hb-popconfirm__action" }, h("button", { key: '07334e3915c17333808c5341e902ac5609f3ee2c', type: "button", class: "hb-popconfirm__btn hb-popconfirm__btn--cancel", onClick: this.handleCancel }, this.cancelButtonText), h("button", { key: 'ca133eab1ef2e8a043cf546bd57277df89d73616', type: "button", ref: (el) => { this.confirmBtnRef = el; }, class: "hb-popconfirm__btn hb-popconfirm__btn--confirm", onClick: this.handleConfirm }, this.confirmButtonText))))));
34
71
  }
35
72
  static get is() { return "hb-popconfirm"; }
36
73
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- {"version":3,"file":"Popconfirm.js","sourceRoot":"","sources":["../../../src/components/Popconfirm/Popconfirm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE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AAC,KAAK,CAAQ,CAClD;gBACN,4DAAK,KAAK,EAAC,uBAAuB;oBAChC,+DAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,+CAA+C,EAAC,OAAO,EAAE,IAAI,CAAC,YAAY,IAAG,IAAI,CAAC,gBAAgB,CAAU;oBACxI,+DAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,gDAAgD,EAAC,OAAO,EAAE,IAAI,CAAC,aAAa,IAAG,IAAI,CAAC,iBAAiB,CAAU,CACvI,CACF,CACP,CACG,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Element } from '@stencil/core';\nimport { computePosition, getNextZIndex, Placement } from '../../utils/popup-manager';\n\n@Component({ tag: 'hb-popconfirm', styleUrl: 'popconfirm.css', shadow: true })\nexport class Popconfirm {\n @Element() el: HTMLElement;\n @Prop() title: string = '确定执行此操作?';\n @Prop() confirmButtonText: string = '确定';\n @Prop() cancelButtonText: string = '取消';\n @Prop() placement: Placement = 'top';\n @Prop() disabled: boolean = false;\n @Prop() icon: string = '⚠';\n @State() visible: boolean = false;\n @State() popupStyle: Record<string, string> = {};\n\n private triggerRef?: HTMLElement;\n private popupRef?: HTMLDivElement;\n\n private show = () => { if (!this.disabled) { this.visible = true; requestAnimationFrame(() => this.updatePosition()); } };\n private hide = () => { this.visible = false; };\n\n private updatePosition() {\n if (!this.triggerRef || !this.popupRef) return;\n const rect = this.triggerRef.getBoundingClientRect();\n const { width: pw, height: ph } = this.popupRef.getBoundingClientRect();\n const pos = computePosition(rect, pw, ph, this.placement, 8);\n this.popupStyle = { top: `${pos.top}px`, left: `${pos.left}px`, zIndex: String(getNextZIndex()) };\n }\n\n private handleConfirm = (e: Event) => { e.stopPropagation(); this.hide(); this.el.dispatchEvent(new CustomEvent('hbConfirm', { bubbles: true })); };\n private handleCancel = (e: Event) => { e.stopPropagation(); this.hide(); this.el.dispatchEvent(new CustomEvent('hbCancel', { bubbles: true })); };\n\n render() {\n return (\n <div class=\"hb-popconfirm\" onClick={this.show}>\n <div ref={(el: any) => { this.triggerRef = el; }} class=\"hb-popconfirm__trigger\"><slot /></div>\n {this.visible && (\n <div ref={(el: any) => { this.popupRef = el; }} class=\"hb-popconfirm__popup\" style={this.popupStyle}>\n <div class=\"hb-popconfirm__main\">\n <span class=\"hb-popconfirm__icon\">{this.icon}</span>\n <span class=\"hb-popconfirm__title\">{this.title}</span>\n </div>\n <div class=\"hb-popconfirm__action\">\n <button type=\"button\" class=\"hb-popconfirm__btn hb-popconfirm__btn--cancel\" onClick={this.handleCancel}>{this.cancelButtonText}</button>\n <button type=\"button\" class=\"hb-popconfirm__btn hb-popconfirm__btn--confirm\" onClick={this.handleConfirm}>{this.confirmButtonText}</button>\n </div>\n </div>\n )}\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"Popconfirm.js","sourceRoot":"","sources":["../../../src/components/Popconfirm/Popconfirm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAa,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;GAMG;AAEH,MAAM,OAAO,UAAU;IACV,EAAE,CAAc;IACnB,KAAK,GAAW,UAAU,CAAC;IAC3B,iBAAiB,GAAW,IAAI,CAAC;IACjC,gBAAgB,GAAW,IAAI,CAAC;IAChC,SAAS,GAAc,KAAK,CAAC;IAC7B,QAAQ,GAAY,KAAK,CAAC;IAC1B,IAAI,GAAW,GAAG,CAAC;IAClB,OAAO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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Element } from '@stencil/core';\nimport { computePosition, getNextZIndex, Placement } from '../../utils/popup-manager';\nimport { isActivationKey } from '../../utils/a11y';\n\n/**\n * Popconfirm 气泡确认框\n * 无障碍(对齐 antd / WAI-ARIA):\n * - 触发器 role=button + aria-haspopup=dialog + aria-expanded + aria-describedby\n * - 浮层 role=dialog + aria-live=polite(确认文屏幕阅读器实时播报)\n * - 键盘:trigger Enter/Space 打开;Esc=取消关闭;打开时自动聚焦确认按钮\n */\n@Component({ tag: 'hb-popconfirm', styleUrl: 'popconfirm.css', shadow: true })\nexport class Popconfirm {\n @Element() el: HTMLElement;\n @Prop() title: string = '确定执行此操作?';\n @Prop() confirmButtonText: string = '确定';\n @Prop() cancelButtonText: string = '取消';\n @Prop() placement: Placement = 'top';\n @Prop() disabled: boolean = false;\n @Prop() icon: string = '⚠';\n @State() visible: boolean = false;\n @State() popupStyle: Record<string, string> = {};\n\n private triggerRef?: HTMLElement;\n private popupRef?: HTMLDivElement;\n private confirmBtnRef?: HTMLButtonElement;\n\n private show = () => {\n if (this.disabled) return;\n this.visible = true;\n requestAnimationFrame(() => {\n this.updatePosition();\n // 打开后自动聚焦确认按钮(对齐 antd:Enter 直接确认)\n this.confirmBtnRef?.focus();\n });\n };\n private hide = () => { this.visible = false; };\n\n /** 键盘:Esc 取消关闭(Enter 由聚焦的确认按钮原生处理) */\n private handleKeydown = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && this.visible) {\n e.preventDefault();\n this.handleCancel(e);\n }\n };\n\n /** 触发器键盘:Enter/Space 打开 */\n private handleTriggerKeydown = (e: KeyboardEvent) => {\n if (this.disabled) return;\n if (isActivationKey(e.key)) {\n e.preventDefault();\n this.show();\n }\n };\n\n private updatePosition() {\n if (!this.triggerRef || !this.popupRef) return;\n const rect = this.triggerRef.getBoundingClientRect();\n const { width: pw, height: ph } = this.popupRef.getBoundingClientRect();\n const pos = computePosition(rect, pw, ph, this.placement, 8);\n this.popupStyle = { top: `${pos.top}px`, left: `${pos.left}px`, zIndex: String(getNextZIndex()) };\n }\n\n private handleConfirm = (e: Event) => {\n e.stopPropagation();\n this.hide();\n this.el.dispatchEvent(new CustomEvent('hbConfirm', { bubbles: true }));\n };\n private handleCancel = (e: Event) => {\n e.stopPropagation();\n this.hide();\n this.el.dispatchEvent(new CustomEvent('hbCancel', { bubbles: true }));\n };\n\n render() {\n return (\n <div\n class=\"hb-popconfirm\"\n onClick={this.show}\n onKeyDown={this.handleKeydown}\n >\n <div\n ref={(el: any) => { this.triggerRef = el; }}\n class=\"hb-popconfirm__trigger\"\n role=\"button\"\n tabindex={this.disabled ? -1 : 0}\n aria-haspopup=\"dialog\"\n aria-expanded={this.visible ? 'true' : 'false'}\n aria-disabled={this.disabled ? 'true' : 'false'}\n onKeyDown={this.handleTriggerKeydown}\n >\n <slot />\n </div>\n {this.visible && (\n <div\n ref={(el: any) => { this.popupRef = el; }}\n class=\"hb-popconfirm__popup\"\n style={this.popupStyle}\n role=\"dialog\"\n aria-live=\"polite\"\n aria-labelledby=\"hb-popconfirm__title\"\n >\n <div class=\"hb-popconfirm__main\">\n <span class=\"hb-popconfirm__icon\" aria-hidden=\"true\">{this.icon}</span>\n <span id=\"hb-popconfirm__title\" class=\"hb-popconfirm__title\">{this.title}</span>\n </div>\n <div class=\"hb-popconfirm__action\">\n <button\n type=\"button\"\n class=\"hb-popconfirm__btn hb-popconfirm__btn--cancel\"\n onClick={this.handleCancel}\n >\n {this.cancelButtonText}\n </button>\n <button\n type=\"button\"\n ref={(el: any) => { this.confirmBtnRef = el; }}\n class=\"hb-popconfirm__btn hb-popconfirm__btn--confirm\"\n onClick={this.handleConfirm}\n >\n {this.confirmButtonText}\n </button>\n </div>\n </div>\n )}\n </div>\n );\n }\n}\n"]}
@@ -1,5 +1,13 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { computePosition, getNextZIndex } from "../../utils/popup-manager";
3
+ import { isActivationKey } from "../../utils/a11y";
4
+ /**
5
+ * Popover 气泡卡片
6
+ * 无障碍(对齐 antd / WAI-ARIA):
7
+ * - 触发器 role=button + aria-haspopup=dialog + aria-expanded
8
+ * - 浮层 role=dialog + aria-labelledby(title)
9
+ * - 键盘:trigger 上 Enter/Space 打开/关闭;Esc 关闭
10
+ */
3
11
  export class Popover {
4
12
  el;
5
13
  // 注意:使用默认值使其成为 required string,避免与 HTMLElement.title(string)
@@ -28,6 +36,21 @@ export class Popover {
28
36
  this.show();
29
37
  }
30
38
  };
39
+ /** 触发器键盘:Enter/Space 切换;Esc 关闭(click 触发模式) */
40
+ handleKeydown = (e) => {
41
+ if (this.disabled)
42
+ return;
43
+ if (e.key === 'Escape' && this.visible) {
44
+ e.preventDefault();
45
+ this.hide();
46
+ return;
47
+ }
48
+ // click 触发模式才允许键盘打开;hover 模式 focus 时已由 onFocus 展开
49
+ if (this.trigger === 'click' && isActivationKey(e.key)) {
50
+ e.preventDefault();
51
+ this.toggle();
52
+ }
53
+ };
31
54
  updatePosition() {
32
55
  if (!this.triggerRef || !this.popupRef)
33
56
  return;
@@ -37,8 +60,12 @@ export class Popover {
37
60
  this.popupStyle = { top: `${pos.top}px`, left: `${pos.left}px`, zIndex: String(getNextZIndex()) };
38
61
  }
39
62
  render() {
40
- const events = this.trigger === 'hover' ? { onMouseEnter: this.show, onMouseLeave: this.hide } : { onClick: this.toggle };
41
- return (h("div", { key: 'b094fdab875b54a1334489467d87cab19d5d495c', class: "hb-popover", ...events }, h("div", { key: '0d87497b9f31c97aab530a5298722b594388a036', ref: (el) => { this.triggerRef = el; }, class: "hb-popover__trigger" }, h("slot", { key: '93740d59a42e448997f44fe9a636e2858d15121a' })), this.visible && (h("div", { key: '54f77abc1aa942b45e69bf4c63ec6b8f4fd49bad', ref: (el) => { this.popupRef = el; }, class: "hb-popover__popup", style: { ...this.popupStyle, width: this.width }, onMouseEnter: () => this.trigger === 'hover' && this.show(), onMouseLeave: () => this.trigger === 'hover' && this.hide() }, this.title && h("div", { key: '44f71196d287712f9895546d03d1849ba2092241', class: "hb-popover__title" }, this.title), h("div", { key: '7f558d395de6937bb453f9a3453509654fb14514', class: "hb-popover__body" }, h("slot", { key: '19677384409687a3936393b2aaf6722c071de5eb', name: "content" }))))));
63
+ const events = this.trigger === 'hover'
64
+ ? { onMouseEnter: this.show, onMouseLeave: this.hide }
65
+ : { onClick: this.toggle };
66
+ return (h("div", { key: '8085a1ce5c74415b6a54b30edb12cd894b6d6407', class: "hb-popover", ...events, onKeyDown: this.handleKeydown }, h("div", { key: 'ca51e0624265da38c99ec4f035776429616a4444', ref: (el) => { this.triggerRef = el; }, class: "hb-popover__trigger", role: "button", tabindex: this.disabled ? -1 : 0, "aria-haspopup": "dialog", "aria-expanded": this.visible ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false',
67
+ // hover 触发模式:focus 也展开(键盘用户可见)
68
+ onFocus: this.trigger === 'hover' ? this.show : undefined, onBlur: this.trigger === 'hover' ? this.hide : undefined }, h("slot", { key: 'b2717c611c8f73c54e2463724c9b76bef24d5a88' })), this.visible && (h("div", { key: '13cc85f0c1a2b52c59afa6c9d90f3b70a7b4dbd9', ref: (el) => { this.popupRef = el; }, class: "hb-popover__popup", style: { ...this.popupStyle, width: this.width }, role: "dialog", "aria-labelledby": this.title ? 'hb-popover__title' : undefined, onMouseEnter: () => this.trigger === 'hover' && this.show(), onMouseLeave: () => this.trigger === 'hover' && this.hide() }, this.title && h("div", { key: 'e89dc3689137445d896cccd3a50a2ab9fa34d677', id: "hb-popover__title", class: "hb-popover__title" }, this.title), h("div", { key: '27ab058045cd181074e3436a58ce234d23a648dc', class: "hb-popover__body" }, h("slot", { key: '1fc7515e13a753f34d390c10dc8b87d376705a20', name: "content" }))))));
42
69
  }
43
70
  static get is() { return "hb-popover"; }
44
71
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.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,IAAI,CAAC,OAAO,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE;gBACvH,IAAI,CAAC,KAAK,IAAI,4DAAK,KAAK,EAAC,mBAAmB,IAAE,IAAI,CAAC,KAAK,CAAO;gBAChE,4DAAK,KAAK,EAAC,kBAAkB;oBAAC,6DAAM,IAAI,EAAC,SAAS,GAAG,CAAM,CACvD,CACP,CACG,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Element } from '@stencil/core';\nimport { computePosition, getNextZIndex, Placement } from '../../utils/popup-manager';\n\n@Component({ tag: 'hb-popover', styleUrl: 'popover.css', shadow: true })\nexport class Popover {\n @Element() el: HTMLElement;\n // 注意:使用默认值使其成为 required string,避免与 HTMLElement.title(string)\n // 的可选类型冲突;同时保留 Ant Design 兼容的 `title` API。\n @Prop() title: string = '';\n @Prop() width: string = '240px';\n @Prop() placement: Placement = 'bottom';\n @Prop() trigger: 'hover' | 'click' = 'hover';\n @Prop() disabled: boolean = false;\n @State() visible: boolean = false;\n @State() popupStyle: Record<string, string> = {};\n\n private triggerRef?: HTMLElement;\n private popupRef?: HTMLDivElement;\n\n private show = () => { if (!this.disabled) { this.visible = true; requestAnimationFrame(() => this.updatePosition()); } };\n private hide = () => { this.visible = false; };\n private toggle = () => {\n if (this.visible) {\n this.hide();\n } else {\n this.show();\n }\n };\n\n private updatePosition() {\n if (!this.triggerRef || !this.popupRef) return;\n const rect = this.triggerRef.getBoundingClientRect();\n const { width: pw, height: ph } = this.popupRef.getBoundingClientRect();\n const pos = computePosition(rect, pw, ph, this.placement, 8);\n this.popupStyle = { top: `${pos.top}px`, left: `${pos.left}px`, zIndex: String(getNextZIndex()) };\n }\n\n render() {\n const events = this.trigger === 'hover' ? { onMouseEnter: this.show, onMouseLeave: this.hide } : { onClick: this.toggle };\n return (\n <div class=\"hb-popover\" {...events}>\n <div ref={(el: any) => { this.triggerRef = el; }} class=\"hb-popover__trigger\"><slot /></div>\n {this.visible && (\n <div ref={(el: any) => { this.popupRef = el; }} class=\"hb-popover__popup\" style={{ ...this.popupStyle, width: this.width }}\n onMouseEnter={() => this.trigger === 'hover' && this.show()} onMouseLeave={() => this.trigger === 'hover' && this.hide()}>\n {this.title && <div class=\"hb-popover__title\">{this.title}</div>}\n <div class=\"hb-popover__body\"><slot name=\"content\" /></div>\n </div>\n )}\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAa,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;GAMG;AAEH,MAAM,OAAO,OAAO;IACP,EAAE,CAAc;IAC3B,6DAA6D;IAC7D,2CAA2C;IACnC,KAAK,GAAW,EAAE,CAAC;IACnB,KAAK,GAAW,OAAO,CAAC;IACxB,SAAS,GAAc,QAAQ,CAAC;IAChC,OAAO,GAAsB,OAAO,CAAC;IACrC,QAAQ,GAAY,KAAK,CAAC;IACzB,OAAO,GAAY,KAAK,CAAC;IACzB,UAAU,GAA2B,EAAE,CAAC;IAEzC,UAAU,CAAe;IACzB,QAAQ,CAAkB;IAE1B,IAAI,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAAC,qBAAqB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAAC,CAA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QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC,EACzC,KAAK,EAAC,mBAAmB,EACzB,KAAK,EAAE,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,EAChD,IAAI,EAAC,QAAQ,qBACI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,EAC7D,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,EAC3D,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE;gBAE1D,IAAI,CAAC,KAAK,IAAI,4DAAK,EAAE,EAAC,mBAAmB,EAAC,KAAK,EAAC,mBAAmB,IAAE,IAAI,CAAC,KAAK,CAAO;gBACvF,4DAAK,KAAK,EAAC,kBAAkB;oBAAC,6DAAM,IAAI,EAAC,SAAS,GAAG,CAAM,CACvD,CACP,CACG,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Element } from '@stencil/core';\nimport { computePosition, getNextZIndex, Placement } from '../../utils/popup-manager';\nimport { isActivationKey } from '../../utils/a11y';\n\n/**\n * Popover 气泡卡片\n * 无障碍(对齐 antd / WAI-ARIA):\n * - 触发器 role=button + aria-haspopup=dialog + aria-expanded\n * - 浮层 role=dialog + aria-labelledby(title)\n * - 键盘:trigger 上 Enter/Space 打开/关闭;Esc 关闭\n */\n@Component({ tag: 'hb-popover', styleUrl: 'popover.css', shadow: true })\nexport class Popover {\n @Element() el: HTMLElement;\n // 注意:使用默认值使其成为 required string,避免与 HTMLElement.title(string)\n // 的可选类型冲突;同时保留 Ant Design 兼容的 `title` API。\n @Prop() title: string = '';\n @Prop() width: string = '240px';\n @Prop() placement: Placement = 'bottom';\n @Prop() trigger: 'hover' | 'click' = 'hover';\n @Prop() disabled: boolean = false;\n @State() visible: boolean = false;\n @State() popupStyle: Record<string, string> = {};\n\n private triggerRef?: HTMLElement;\n private popupRef?: HTMLDivElement;\n\n private show = () => { if (!this.disabled) { this.visible = true; requestAnimationFrame(() => this.updatePosition()); } };\n private hide = () => { this.visible = false; };\n private toggle = () => {\n if (this.visible) {\n this.hide();\n } else {\n this.show();\n }\n };\n\n /** 触发器键盘:Enter/Space 切换;Esc 关闭(click 触发模式) */\n private handleKeydown = (e: KeyboardEvent) => {\n if (this.disabled) return;\n if (e.key === 'Escape' && this.visible) {\n e.preventDefault();\n this.hide();\n return;\n }\n // click 触发模式才允许键盘打开;hover 模式 focus 时已由 onFocus 展开\n if (this.trigger === 'click' && isActivationKey(e.key)) {\n e.preventDefault();\n this.toggle();\n }\n };\n\n private updatePosition() {\n if (!this.triggerRef || !this.popupRef) return;\n const rect = this.triggerRef.getBoundingClientRect();\n const { width: pw, height: ph } = this.popupRef.getBoundingClientRect();\n const pos = computePosition(rect, pw, ph, this.placement, 8);\n this.popupStyle = { top: `${pos.top}px`, left: `${pos.left}px`, zIndex: String(getNextZIndex()) };\n }\n\n render() {\n const events = this.trigger === 'hover'\n ? { onMouseEnter: this.show, onMouseLeave: this.hide }\n : { onClick: this.toggle };\n\n return (\n <div\n class=\"hb-popover\"\n {...events}\n onKeyDown={this.handleKeydown}\n >\n <div\n ref={(el: any) => { this.triggerRef = el; }}\n class=\"hb-popover__trigger\"\n role=\"button\"\n tabindex={this.disabled ? -1 : 0}\n aria-haspopup=\"dialog\"\n aria-expanded={this.visible ? 'true' : 'false'}\n aria-disabled={this.disabled ? 'true' : 'false'}\n // hover 触发模式:focus 也展开(键盘用户可见)\n onFocus={this.trigger === 'hover' ? this.show : undefined}\n onBlur={this.trigger === 'hover' ? this.hide : undefined}\n >\n <slot />\n </div>\n {this.visible && (\n <div\n ref={(el: any) => { this.popupRef = el; }}\n class=\"hb-popover__popup\"\n style={{ ...this.popupStyle, width: this.width }}\n role=\"dialog\"\n aria-labelledby={this.title ? 'hb-popover__title' : undefined}\n onMouseEnter={() => this.trigger === 'hover' && this.show()}\n onMouseLeave={() => this.trigger === 'hover' && this.hide()}\n >\n {this.title && <div id=\"hb-popover__title\" class=\"hb-popover__title\">{this.title}</div>}\n <div class=\"hb-popover__body\"><slot name=\"content\" /></div>\n </div>\n )}\n </div>\n );\n }\n}\n"]}
@@ -18,7 +18,7 @@ export class Progress {
18
18
  }
19
19
  render() {
20
20
  const clampedPct = Math.max(0, Math.min(100, this.percentage));
21
- return (h("div", { key: 'a3d0f5a70471f0114bbf8ddaf62bd18d274357cc', class: "hb-progress" }, h("div", { key: 'ba90d7643388c12d5188ca6b48b4e581f46f104b', class: "hb-progress__bar", style: { height: `${this.strokeWidth}px` } }, h("div", { key: '9dc3948579e45ff3f008f1b5078a247a32df8c91', class: "hb-progress__bar-inner", style: { width: `${clampedPct}%`, backgroundColor: this.barColor } })), this.showText && h("span", { key: '5cb06b3981e7d754e7dab7881341d75045284296', class: "hb-progress__text" }, clampedPct, "%")));
21
+ return (h("div", { key: '0378f701fdab1a467c441925938dd15750e2440d', class: "hb-progress" }, h("div", { key: '06a661fff31f8dfe79b96d769dcdd907fb6e4ff6', class: "hb-progress__bar", style: { height: `${this.strokeWidth}px` } }, h("div", { key: 'fdcf3c300fd700f1779203ea7733d276313bf567', class: "hb-progress__bar-inner", style: { width: `${clampedPct}%`, backgroundColor: this.barColor } })), this.showText && h("span", { key: '101821cfa8592f03ef47695b46f32c18f96b07ff', class: "hb-progress__text" }, clampedPct, "%")));
22
22
  }
23
23
  static get is() { return "hb-progress"; }
24
24
  static get encapsulation() { return "shadow"; }
@@ -90,13 +90,13 @@ export class Radio {
90
90
  };
91
91
  render() {
92
92
  const inputId = this.radioId || `hb-radio-${Math.random().toString(36).substr(2, 9)}`;
93
- return (h("label", { key: '3f069ee164a78574c94d973e06f435d172170d8c', class: {
93
+ return (h("label", { key: '463c0d18fd65a81e2a2bf5618362e35461ab554f', class: {
94
94
  'hb-radio': true,
95
95
  'hb-radio--checked': this.isChecked,
96
96
  'hb-radio--disabled': this.disabled,
97
97
  'hb-radio--border': this.border,
98
98
  [`hb-radio--${this.size}`]: true,
99
- } }, h("span", { key: 'e8e0c6976efa57516d14bba9385f2424400c749c', class: "hb-radio__input" }, h("input", { key: '6a5cf424f748330a8b9214a2ee75f154f599a9ca', type: "radio", id: inputId, name: this.name, checked: this.isChecked, disabled: this.disabled, value: this.value, onChange: this.handleChange, class: "hb-radio__original" }), h("span", { key: '7c2d37231c2b7f28001bfb95014ffc638c324633', class: "hb-radio__inner" })), (this.label || this.value !== undefined) && (h("span", { key: '05980e96a3068f1dfd44719f688eb68c715fde85', class: "hb-radio__label" }, h("slot", { key: '96dfbd6157a555033a3f749032a44272c3a8588b' }, this.label || this.value)))));
99
+ } }, h("span", { key: '292c166d1b83d7b2e0f4a0ae9dad244515eb8cc6', class: "hb-radio__input" }, h("input", { key: '1adc442e06c276252c7b2824b1fb5cb4d2e65087', type: "radio", id: inputId, name: this.name, checked: this.isChecked, disabled: this.disabled, value: this.value, onChange: this.handleChange, class: "hb-radio__original" }), h("span", { key: '6b2c538c1c1e1dd8e2de0eeffe073d7621febe8b', class: "hb-radio__inner" })), (this.label || this.value !== undefined) && (h("span", { key: '0b1a0f58465b4f159902ff573233f617000114de', class: "hb-radio__label" }, h("slot", { key: 'e4ff0c4d859ffd28d9c82b8c1b4cebed39f00b93' }, this.label || this.value)))));
100
100
  }
101
101
  static get is() { return "hb-radio"; }
102
102
  static get encapsulation() { return "shadow"; }
@@ -67,6 +67,48 @@ export class Rate {
67
67
  this.hoverValue = 0;
68
68
  this.hbChange.emit(newValue);
69
69
  };
70
+ /**
71
+ * 键盘调节评分(对齐 WAI-ARIA slider / antd Rate):
72
+ * - ArrowRight/ArrowUp:增加(allowHalf 时步进 0.5,否则 1)
73
+ * - ArrowLeft/ArrowDown:减少
74
+ * - Home:归 0;End:满分
75
+ */
76
+ handleKeydown = (e) => {
77
+ if (this.disabled || this.readonly)
78
+ return;
79
+ const step = this.allowHalf ? 0.5 : 1;
80
+ let next = null;
81
+ switch (e.key) {
82
+ case 'ArrowRight':
83
+ case 'ArrowUp':
84
+ next = this.currentValue + step;
85
+ break;
86
+ case 'ArrowLeft':
87
+ case 'ArrowDown':
88
+ next = this.currentValue - step;
89
+ break;
90
+ case 'Home':
91
+ next = 0;
92
+ break;
93
+ case 'End':
94
+ next = this.max;
95
+ break;
96
+ default:
97
+ return;
98
+ }
99
+ e.preventDefault();
100
+ if (next === null)
101
+ return;
102
+ // 夹取到 [0, max],且按 step 对齐
103
+ const clamped = Math.max(0, Math.min(next, this.max));
104
+ // 修正浮点:allowHalf 时保留一位小数
105
+ const snapped = this.allowHalf ? Math.round(clamped * 2) / 2 : Math.round(clamped);
106
+ if (snapped === this.currentValue)
107
+ return;
108
+ this.currentValue = snapped;
109
+ this.modelValue = snapped;
110
+ this.hbChange.emit(snapped);
111
+ };
70
112
  handleMouseEnter = (value) => {
71
113
  if (this.disabled || this.readonly)
72
114
  return;
@@ -96,7 +138,7 @@ export class Rate {
96
138
  render() {
97
139
  const displayValue = this.getDisplayValue();
98
140
  const stars = Array.from({ length: this.max }, (_, i) => i + 1);
99
- return (h("div", { key: 'cf15cfe1af8d6f65b2a08a398214dd1f762fc7e7', class: "hb-rate" }, stars.map((value) => {
141
+ return (h("div", { key: '6e1ff9a1ed597f2dba1111893a32d079bdce38a4', class: "hb-rate", role: "slider", tabindex: this.disabled || this.readonly ? -1 : 0, "aria-valuemin": 0, "aria-valuemax": this.max, "aria-valuenow": this.currentValue, "aria-valuetext": this.scoreTemplate ? this.getScoreText() : `${this.currentValue} 分`, "aria-orientation": "horizontal", "aria-disabled": this.disabled ? 'true' : 'false', "aria-readonly": this.readonly ? 'true' : 'false', onKeyDown: this.handleKeydown }, stars.map((value) => {
100
142
  const isFull = displayValue >= value;
101
143
  const isHalf = this.allowHalf && displayValue >= value - 0.5 && displayValue < value;
102
144
  const isActive = isFull || isHalf;
@@ -110,8 +152,8 @@ export class Rate {
110
152
  }, onClick: (e) => {
111
153
  e.stopPropagation();
112
154
  this.handleClick(value, true);
113
- } }, "\u2605")), h("span", { class: "hb-rate__icon" }, "\u2605")));
114
- }), this.showScore && (h("span", { key: '2f3d24aff4a4be719971e6162ae7bc21983cf62f', class: "hb-rate__text" }, this.getScoreText())), this.showText && this.getText() && (h("span", { key: '83107780b12701836a8badbc3139b791b2d9f07a', class: "hb-rate__text" }, this.getText()))));
155
+ } }, "\u2605")), h("span", { class: "hb-rate__icon", "aria-hidden": "true" }, "\u2605")));
156
+ }), this.showScore && (h("span", { key: '8bea6243ef85f5cab68eff37b3d259cf3793f9c9', class: "hb-rate__text" }, this.getScoreText())), this.showText && this.getText() && (h("span", { key: '714f24cacb7bc8dfd04f0a984658d845197ef82d', class: "hb-rate__text" }, this.getText()))));
115
157
  }
116
158
  static get is() { return "hb-rate"; }
117
159
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- {"version":3,"file":"Rate.js","sourceRoot":"","sources":["../../../src/components/Rate/Rate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtF;;;GAGG;AAMH,MAAM,OAAO,IAAI;IACf;;OAEG;IACsB,UAAU,GAAW,CAAC,CAAC;IAEhD;;;OAGG;IACK,GAAG,GAAW,CAAC,CAAC;IAExB;;;OAGG;IACK,QAAQ,GAAY,KAAK,CAAC;IAElC;;;OAGG;IACK,SAAS,GAAY,KAAK,CAAC;IAEnC;;;OAGG;IACK,QAAQ,GAAY,KAAK,CAAC;IAElC;;;OAGG;IACK,SAAS,GAAY,KAAK,CAAC;IAEnC;;;OAGG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Y,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAChD,YAAY,EAAE,IAAI,CAAC,gBAAgB,EACnC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC;oBAE5C,IAAI,CAAC,SAAS,IAAI,CACjB,YACE,KAAK,EAAE;4BACL,eAAe,EAAE,IAAI;4BACrB,uBAAuB,EAAE,MAAM;yBAChC,EACD,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;4BACb,CAAC,CAAC,eAAe,EAAE,CAAC;4BACpB,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;wBAChC,CAAC,aAGI,CACR;oBACD,YAAM,KAAK,EAAC,eAAe,aAAS,CAC/B,CACR,CAAC;YACJ,CAAC,CAAC;YACD,IAAI,CAAC,SAAS,IAAI,CACjB,6DAAM,KAAK,EAAC,eAAe,IAAE,IAAI,CAAC,YAAY,EAAE,CAAQ,CACzD;YACA,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE,IAAI,CAClC,6DAAM,KAAK,EAAC,eAAe,IAAE,IAAI,CAAC,OAAO,EAAE,CAAQ,CACpD,CACG,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, Event, EventEmitter, State, Watch } from '@stencil/core';\n\n/**\n * Rate 评分组件\n * 评分组件\n */\n@Component({\n tag: 'hb-rate',\n styleUrl: 'rate.css',\n shadow: true,\n})\nexport class Rate {\n /**\n * 绑定值\n */\n @Prop({ mutable: true }) modelValue: number = 0;\n\n /**\n * 最大分值\n * @default 5\n */\n @Prop() max: number = 5;\n\n /**\n * 是否禁用\n * @default false\n */\n @Prop() disabled: boolean = false;\n\n /**\n * 是否允许半选\n * @default false\n */\n @Prop() allowHalf: boolean = false;\n\n /**\n * 只读\n * @default false\n */\n @Prop() readonly: boolean = false;\n\n /**\n * 是否显示分数\n * @default false\n */\n @Prop() showScore: boolean = false;\n\n /**\n * 是否显示文本\n * @default false\n */\n @Prop() showText: boolean = false;\n\n /**\n * 辅助文字数组\n */\n @Prop() texts?: string[];\n\n /**\n * 分数显示模板\n */\n @Prop() scoreTemplate?: string;\n\n @State() hoverValue: number = 0;\n @State() currentValue: number = 0;\n\n /**\n * 值改变事件\n */\n @Event() hbChange: EventEmitter<number>;\n\n componentDidLoad() {\n this.currentValue = this.modelValue;\n }\n\n @Watch('modelValue')\n handleValueChange() {\n this.currentValue = this.modelValue;\n }\n\n private handleClick = (value: number, isHalf: boolean) => {\n if (this.disabled || this.readonly) return;\n \n const newValue = isHalf && this.allowHalf ? value - 0.5 : value;\n this.currentValue = newValue;\n this.modelValue = newValue;\n this.hoverValue = 0;\n this.hbChange.emit(newValue);\n };\n\n private handleMouseEnter = (value: number) => {\n if (this.disabled || this.readonly) return;\n this.hoverValue = value;\n };\n\n private handleMouseLeave = () => {\n if (this.disabled || this.readonly) return;\n this.hoverValue = 0;\n };\n\n private getDisplayValue(): number {\n return this.hoverValue || this.currentValue;\n }\n\n private getText(): string {\n const value = Math.ceil(this.currentValue);\n if (this.texts && this.texts[value - 1]) {\n return this.texts[value - 1];\n }\n return '';\n }\n\n private getScoreText(): string {\n if (this.scoreTemplate) {\n return this.scoreTemplate.replace('{value}', String(this.currentValue));\n }\n return `${this.currentValue} / ${this.max}`;\n }\n\n render() {\n const displayValue = this.getDisplayValue();\n const stars = Array.from({ length: this.max }, (_, i) => i + 1);\n\n return (\n <div class=\"hb-rate\">\n {stars.map((value) => {\n const isFull = displayValue >= value;\n const isHalf = this.allowHalf && displayValue >= value - 0.5 && displayValue < value;\n const isActive = isFull || isHalf;\n\n return (\n <span\n class={{\n 'hb-rate__item': true,\n 'hb-rate__item--active': isActive,\n 'hb-rate__item--half': isHalf,\n }}\n onMouseEnter={() => this.handleMouseEnter(value)}\n onMouseLeave={this.handleMouseLeave}\n onClick={() => this.handleClick(value, false)}\n >\n {this.allowHalf && (\n <span\n class={{\n 'hb-rate__half': true,\n 'hb-rate__half--active': isHalf,\n }}\n onClick={(e) => {\n e.stopPropagation();\n this.handleClick(value, true);\n }}\n >\n ★\n </span>\n )}\n <span class=\"hb-rate__icon\">★</span>\n </span>\n );\n })}\n {this.showScore && (\n <span class=\"hb-rate__text\">{this.getScoreText()}</span>\n )}\n {this.showText && this.getText() && (\n <span class=\"hb-rate__text\">{this.getText()}</span>\n )}\n </div>\n );\n }\n}\n\n"]}
1
+ {"version":3,"file":"Rate.js","sourceRoot":"","sources":["../../../src/components/Rate/Rate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtF;;;GAGG;AAMH,MAAM,OAAO,IAAI;IACf;;OAEG;IACsB,UAAU,GAAW,CAAC,CAAC;IAEhD;;;OAGG;IACK,GAAG,GAAW,CAAC,CAAC;IAExB;;;OAGG;IACK,QAAQ,GAAY,KAAK,CAAC;IAElC;;;OAGG;IACK,SAAS,GAAY,KAAK,CAAC;IAEnC;;;OAGG;IACK,QAAQ,GAAY,KAAK,CAAC;IAElC;;;OAGG;IACK,SAAS,GAAY,KAAK,CAAC;IAEnC;;;OAGG;IACK,QAAQ,GAAY,KAAK,CAAC;IAElC;;OAEG;IACK,KAAK,CAAY;IAEzB;;OAEG;IACK,aAAa,CAAU;IAEtB,UAAU,GAAW,CAAC,CAAC;IACvB,YAAY,GAAW,CAAC,CAAC;IAElC;;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CACpD,CACG,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, Event, EventEmitter, State, Watch } from '@stencil/core';\n\n/**\n * Rate 评分组件\n * 评分组件\n */\n@Component({\n tag: 'hb-rate',\n styleUrl: 'rate.css',\n shadow: true,\n})\nexport class Rate {\n /**\n * 绑定值\n */\n @Prop({ mutable: true }) modelValue: number = 0;\n\n /**\n * 最大分值\n * @default 5\n */\n @Prop() max: number = 5;\n\n /**\n * 是否禁用\n * @default false\n */\n @Prop() disabled: boolean = false;\n\n /**\n * 是否允许半选\n * @default false\n */\n @Prop() allowHalf: boolean = false;\n\n /**\n * 只读\n * @default false\n */\n @Prop() readonly: boolean = false;\n\n /**\n * 是否显示分数\n * @default false\n */\n @Prop() showScore: boolean = false;\n\n /**\n * 是否显示文本\n * @default false\n */\n @Prop() showText: boolean = false;\n\n /**\n * 辅助文字数组\n */\n @Prop() texts?: string[];\n\n /**\n * 分数显示模板\n */\n @Prop() scoreTemplate?: string;\n\n @State() hoverValue: number = 0;\n @State() currentValue: number = 0;\n\n /**\n * 值改变事件\n */\n @Event() hbChange: EventEmitter<number>;\n\n componentDidLoad() {\n this.currentValue = this.modelValue;\n }\n\n @Watch('modelValue')\n handleValueChange() {\n this.currentValue = this.modelValue;\n }\n\n private handleClick = (value: number, isHalf: boolean) => {\n if (this.disabled || this.readonly) return;\n\n const newValue = isHalf && this.allowHalf ? value - 0.5 : value;\n this.currentValue = newValue;\n this.modelValue = newValue;\n this.hoverValue = 0;\n this.hbChange.emit(newValue);\n };\n\n /**\n * 键盘调节评分(对齐 WAI-ARIA slider / antd Rate):\n * - ArrowRight/ArrowUp:增加(allowHalf 时步进 0.5,否则 1)\n * - ArrowLeft/ArrowDown:减少\n * - Home:归 0;End:满分\n */\n private handleKeydown = (e: KeyboardEvent) => {\n if (this.disabled || this.readonly) return;\n const step = this.allowHalf ? 0.5 : 1;\n let next: number | null = null;\n switch (e.key) {\n case 'ArrowRight':\n case 'ArrowUp':\n next = this.currentValue + step;\n break;\n case 'ArrowLeft':\n case 'ArrowDown':\n next = this.currentValue - step;\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = this.max;\n break;\n default:\n return;\n }\n e.preventDefault();\n if (next === null) return;\n // 夹取到 [0, max],且按 step 对齐\n const clamped = Math.max(0, Math.min(next, this.max));\n // 修正浮点:allowHalf 时保留一位小数\n const snapped = this.allowHalf ? Math.round(clamped * 2) / 2 : Math.round(clamped);\n if (snapped === this.currentValue) return;\n this.currentValue = snapped;\n this.modelValue = snapped;\n this.hbChange.emit(snapped);\n };\n\n private handleMouseEnter = (value: number) => {\n if (this.disabled || this.readonly) return;\n this.hoverValue = value;\n };\n\n private handleMouseLeave = () => {\n if (this.disabled || this.readonly) return;\n this.hoverValue = 0;\n };\n\n private getDisplayValue(): number {\n return this.hoverValue || this.currentValue;\n }\n\n private getText(): string {\n const value = Math.ceil(this.currentValue);\n if (this.texts && this.texts[value - 1]) {\n return this.texts[value - 1];\n }\n return '';\n }\n\n private getScoreText(): string {\n if (this.scoreTemplate) {\n return this.scoreTemplate.replace('{value}', String(this.currentValue));\n }\n return `${this.currentValue} / ${this.max}`;\n }\n\n render() {\n const displayValue = this.getDisplayValue();\n const stars = Array.from({ length: this.max }, (_, i) => i + 1);\n\n return (\n <div\n class=\"hb-rate\"\n role=\"slider\"\n tabindex={this.disabled || this.readonly ? -1 : 0}\n aria-valuemin={0}\n aria-valuemax={this.max}\n aria-valuenow={this.currentValue}\n aria-valuetext={this.scoreTemplate ? this.getScoreText() : `${this.currentValue} 分`}\n aria-orientation=\"horizontal\"\n aria-disabled={this.disabled ? 'true' : 'false'}\n aria-readonly={this.readonly ? 'true' : 'false'}\n onKeyDown={this.handleKeydown}\n >\n {stars.map((value) => {\n const isFull = displayValue >= value;\n const isHalf = this.allowHalf && displayValue >= value - 0.5 && displayValue < value;\n const isActive = isFull || isHalf;\n\n return (\n <span\n class={{\n 'hb-rate__item': true,\n 'hb-rate__item--active': isActive,\n 'hb-rate__item--half': isHalf,\n }}\n onMouseEnter={() => this.handleMouseEnter(value)}\n onMouseLeave={this.handleMouseLeave}\n onClick={() => this.handleClick(value, false)}\n >\n {this.allowHalf && (\n <span\n class={{\n 'hb-rate__half': true,\n 'hb-rate__half--active': isHalf,\n }}\n onClick={(e) => {\n e.stopPropagation();\n this.handleClick(value, true);\n }}\n >\n ★\n </span>\n )}\n <span class=\"hb-rate__icon\" aria-hidden=\"true\">★</span>\n </span>\n );\n })}\n {this.showScore && (\n <span class=\"hb-rate__text\">{this.getScoreText()}</span>\n )}\n {this.showText && this.getText() && (\n <span class=\"hb-rate__text\">{this.getText()}</span>\n )}\n </div>\n );\n }\n}\n\n"]}
@@ -40,7 +40,7 @@ export class Result {
40
40
  }
41
41
  render() {
42
42
  const color = this.getColor();
43
- return (h("div", { key: '2c814e1b6953b94d65a6fbf1434263f622bb7286', class: { 'hb-result': true, [`hb-result--${this.status}`]: true } }, h("div", { key: '6065f1880a74904cced635430c1f3b484476cc63', class: "hb-result__icon", style: { color } }, h("span", { key: 'fd61023ad0cdf6436680f20bbcb735f4960ffbe5', class: "hb-result__icon-symbol" }, this.getIcon())), this.title && h("div", { key: '44a7cfc18a4886b1530e9dfbed4764f35f61d143', class: "hb-result__title" }, this.title), this.subTitle !== undefined && h("div", { key: '86c42321700d9a7f3055025dbfbc71b358611739', class: "hb-result__subtitle" }, this.subTitle), h("div", { key: '63fbc78625a878e196acd65aa361440cba746b19', class: "hb-result__extra" }, h("slot", { key: 'cefb1bfb4444bc1d47a37eb4887af9e21fa18a85' }))));
43
+ return (h("div", { key: '2e1cbc3672080bcab9211f186212c2bae44bc3af', class: { 'hb-result': true, [`hb-result--${this.status}`]: true } }, h("div", { key: 'a016fc8c7ca5684e8d52ee1305fe2e71b3ba502f', class: "hb-result__icon", style: { color } }, h("span", { key: '534b33fbd62e51b05c6a28660ce439c12fb3da2b', class: "hb-result__icon-symbol" }, this.getIcon())), this.title && h("div", { key: '51b722e6a0beef39adfbef3d3c1dadfad9c70dd1', class: "hb-result__title" }, this.title), this.subTitle !== undefined && h("div", { key: '3bc005594f74cc9c1806100001509441b9c357d4', class: "hb-result__subtitle" }, this.subTitle), h("div", { key: '41702ad25f27484659b4e7437a05cb4227f9e7a9', class: "hb-result__extra" }, h("slot", { key: 'd973cd7a63731803a460e9dfe61583a79aec483f' }))));
44
44
  }
45
45
  static get is() { return "hb-result"; }
46
46
  static get encapsulation() { return "shadow"; }