@para-ui/core 5.0.0-beta.9 → 5.0.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 (730) hide show
  1. package/AGENTS.md +315 -0
  2. package/AlignBox/component.json +89 -0
  3. package/Anchor/component.json +130 -0
  4. package/Argv/component.json +216 -0
  5. package/AutoBox/component.json +133 -0
  6. package/AutoButton/component.json +109 -0
  7. package/AutoTips/component.json +121 -0
  8. package/Badge/component.json +92 -0
  9. package/Breadcrumbs/component.json +142 -0
  10. package/Button/component.json +168 -0
  11. package/ButtonGroup/component.json +132 -0
  12. package/Card/component.json +162 -0
  13. package/Carousel/component.json +142 -0
  14. package/Cascader/component.json +196 -0
  15. package/Checkbox/component.json +138 -0
  16. package/CheckboxGroup/component.json +152 -0
  17. package/CodeEditor/component.json +189 -0
  18. package/Collapse/component.json +166 -0
  19. package/CollapseBox/component.json +84 -0
  20. package/CollapseLayout/component.json +155 -0
  21. package/ColorPicker/component.json +142 -0
  22. package/ComboSelect/component.json +181 -0
  23. package/Container/component.json +111 -0
  24. package/ContentBox/component.json +81 -0
  25. package/CopyText/component.json +118 -0
  26. package/CycleSelector/component.json +98 -0
  27. package/DatePicker/component.json +192 -0
  28. package/Descriptions/component.json +142 -0
  29. package/Desktop/component.json +171 -0
  30. package/DragVerify/component.json +114 -0
  31. package/Drawer/component.json +200 -0
  32. package/Dropdown/component.json +147 -0
  33. package/DynamicMultiBox/component.json +278 -0
  34. package/Empty/component.json +123 -0
  35. package/ExpressionInput/component.json +79 -0
  36. package/FieldForm/component.json +196 -0
  37. package/Form/component.json +161 -0
  38. package/FormItem/component.json +171 -0
  39. package/FunctionModal/component.json +197 -0
  40. package/Help/component.json +118 -0
  41. package/HelperText/component.json +126 -0
  42. package/Image/component.json +165 -0
  43. package/InputCode/component.json +191 -0
  44. package/InputLang/component.json +205 -0
  45. package/InputNumber/component.json +162 -0
  46. package/Label/component.json +126 -0
  47. package/Loading/component.json +91 -0
  48. package/Menu/component.json +180 -0
  49. package/Message/component.json +246 -0
  50. package/Modal/component.json +277 -0
  51. package/MultiBox/component.json +216 -0
  52. package/Notification/component.json +184 -0
  53. package/OperateBtn/component.json +134 -0
  54. package/PageHeader/component.json +112 -0
  55. package/Pagination/component.json +181 -0
  56. package/PasswordRules/component.json +105 -0
  57. package/PopConfirm/component.json +227 -0
  58. package/PopMenu/component.json +131 -0
  59. package/Popover/component.json +165 -0
  60. package/Progress/component.json +161 -0
  61. package/Prompt/component.json +144 -0
  62. package/Querying/component.json +96 -0
  63. package/QuickReply/component.json +129 -0
  64. package/Radio/component.json +136 -0
  65. package/RadioGroup/component.json +149 -0
  66. package/RangeInput/component.json +198 -0
  67. package/Result/component.json +104 -0
  68. package/ScrollBar/component.json +115 -0
  69. package/Search/component.json +177 -0
  70. package/Select/component.json +244 -0
  71. package/SelectInput/component.json +184 -0
  72. package/Selector/component.json +203 -0
  73. package/SelectorPicker/component.json +179 -0
  74. package/SingleBox/component.json +151 -0
  75. package/Slider/component.json +181 -0
  76. package/SortBox/component.json +108 -0
  77. package/Status/component.json +104 -0
  78. package/Stepper/component.json +129 -0
  79. package/Switch/component.json +207 -0
  80. package/Table/component.json +547 -0
  81. package/Tabs/component.json +227 -0
  82. package/Tag/component.json +221 -0
  83. package/TextEditor/component.json +186 -0
  84. package/TextField/component.json +290 -0
  85. package/TimePicker/component.json +176 -0
  86. package/Timeline/component.json +110 -0
  87. package/Title/component.json +156 -0
  88. package/ToggleButton/component.json +153 -0
  89. package/Tooltip/component.json +176 -0
  90. package/Transfer/component.json +157 -0
  91. package/Tree/component.json +512 -0
  92. package/Upload/component.json +450 -0
  93. package/ai-workflows/01-crud-list-multi-drawer.md +278 -0
  94. package/ai-workflows/02-rbac-operation-buttons.md +290 -0
  95. package/ai-workflows/03-complex-form-async-cascade.md +350 -0
  96. package/ai-workflows/04-array-field-form.md +281 -0
  97. package/ai-workflows/05-popconfirm-async-message-queue.md +333 -0
  98. package/ai-workflows/06-modal-drawer-form-workflow.md +385 -0
  99. package/ai-workflows/07-search-filter-table-trio.md +387 -0
  100. package/ai-workflows/08-table-advanced-features.md +365 -0
  101. package/ai-workflows/09-batch-operation-export-progress.md +367 -0
  102. package/ai-workflows/10-cross-component-state-coordination.md +412 -0
  103. package/es/AlignBox/component.json +89 -0
  104. package/es/AlignBox/index.css +1 -1
  105. package/es/AlignBox/index.d.ts +6 -2
  106. package/es/AlignBox/index.js +1 -1
  107. package/es/AlignBox/style/index.css +1 -1
  108. package/es/Anchor/anchorMenu/index.d.ts +2 -1
  109. package/es/Anchor/anchorMenu/index.js +36 -33
  110. package/es/Anchor/component.json +130 -0
  111. package/es/Anchor/index.js +52 -49
  112. package/es/Anchor/type.d.ts +8 -4
  113. package/es/Argv/batchEdit/index.js +1 -1
  114. package/es/Argv/component.json +216 -0
  115. package/es/Argv/dataGenerator/index.js +1 -1
  116. package/es/Argv/index.d.ts +5 -6
  117. package/es/Argv/index.js +1 -1
  118. package/es/AutoBox/component.json +133 -0
  119. package/es/AutoBox/index.d.ts +3 -3
  120. package/es/AutoBox/index.js +1 -1
  121. package/es/AutoBox/protal.d.ts +2 -2
  122. package/es/AutoBox/protal.js +33 -30
  123. package/es/AutoButton/component.json +109 -0
  124. package/es/AutoButton/index.js +1 -1
  125. package/es/AutoTips/autoTipsMultiline/index.d.ts +1 -1
  126. package/es/AutoTips/autoTipsMultiline/index.js +1 -1
  127. package/es/AutoTips/component.json +121 -0
  128. package/es/AutoTips/index.js +1 -1
  129. package/es/Badge/component.json +92 -0
  130. package/es/Breadcrumbs/component.json +142 -0
  131. package/es/Breadcrumbs/index.js +1 -1
  132. package/es/Button/SplitButton.d.ts +2 -2
  133. package/es/Button/component.json +168 -0
  134. package/es/Button/index.js +44 -44
  135. package/es/ButtonGroup/component.json +132 -0
  136. package/es/ButtonGroup/index.d.ts +1 -1
  137. package/es/Card/component.json +162 -0
  138. package/es/Card/index.d.ts +2 -2
  139. package/es/Card/index.js +2 -2
  140. package/es/Carousel/component.json +142 -0
  141. package/es/Carousel/index.d.ts +1 -1
  142. package/es/Cascader/Cascader.js +1 -1
  143. package/es/Cascader/OptionList/Column.js +1 -1
  144. package/es/Cascader/OptionList/index.js +1 -1
  145. package/es/Cascader/component.json +196 -0
  146. package/es/Cascader/hooks/useEntities.js +7 -7
  147. package/es/Cascader/interface.d.ts +1 -0
  148. package/es/Cascader/utils/commonUtil.d.ts +1 -1
  149. package/es/Cascader/utils/commonUtil.js +16 -16
  150. package/es/Cascader/utils/treeUtil.d.ts +14 -5
  151. package/es/Cascader/utils/treeUtil.js +1 -1
  152. package/es/Checkbox/component.json +138 -0
  153. package/es/CheckboxGroup/component.json +152 -0
  154. package/es/CheckboxGroup/index.js +1 -1
  155. package/es/CodeEditor/component.json +189 -0
  156. package/es/CodeEditor/index.d.ts +11 -10
  157. package/es/CodeEditor/index.js +25 -25
  158. package/es/Collapse/component.json +166 -0
  159. package/es/Collapse/index.d.ts +1 -1
  160. package/es/Collapse/index.js +23 -22
  161. package/es/CollapseBox/component.json +84 -0
  162. package/es/CollapseLayout/component.json +155 -0
  163. package/es/ColorPicker/component.json +142 -0
  164. package/es/ComboSelect/component.json +181 -0
  165. package/es/ComboSelect/index.js +115 -109
  166. package/es/ComboSelect/interface.d.ts +2 -2
  167. package/es/ComboSelect/utils.d.ts +3 -3
  168. package/es/ComboSelect/utils.js +1 -1
  169. package/es/Container/component.json +111 -0
  170. package/es/ContentBox/component.json +81 -0
  171. package/es/CopyText/component.json +118 -0
  172. package/es/CycleSelector/component.json +98 -0
  173. package/es/CycleSelector/index.js +14 -13
  174. package/es/DatePicker/component.json +192 -0
  175. package/es/DatePicker/generatePicker/generateRangePicker.js +11 -11
  176. package/es/DatePicker/generatePicker/generateSinglePicker.js +2 -2
  177. package/es/Descriptions/component.json +142 -0
  178. package/es/Descriptions/index.d.ts +1 -1
  179. package/es/Desktop/component.json +171 -0
  180. package/es/Desktop/index.js +1 -1
  181. package/es/DragVerify/component.json +114 -0
  182. package/es/DragVerify/index.js +19 -19
  183. package/es/Drawer/component.json +200 -0
  184. package/es/Drawer/index.js +86 -86
  185. package/es/Drawer/interface.d.ts +1 -1
  186. package/es/Drawer/util.d.ts +1 -6
  187. package/es/Drawer/util.js +9 -6
  188. package/es/Dropdown/component.json +147 -0
  189. package/es/Dropdown/index.js +1 -1
  190. package/es/DynamicMultiBox/component.json +278 -0
  191. package/es/DynamicMultiBox/formItem.d.ts +1 -1
  192. package/es/DynamicMultiBox/index.js +1 -1
  193. package/es/DynamicMultiBox/rowForm.d.ts +2 -2
  194. package/es/Empty/component.json +123 -0
  195. package/es/Empty/index.css +1 -1
  196. package/es/Empty/index.d.ts +2 -2
  197. package/es/Empty/index.js +27 -26
  198. package/es/Empty/style/index.css +1 -1
  199. package/es/ExpressionInput/HighlightOverlay.d.ts +8 -0
  200. package/es/ExpressionInput/HighlightOverlay.js +27 -0
  201. package/es/ExpressionInput/Popup.d.ts +19 -0
  202. package/es/ExpressionInput/Popup.js +93 -0
  203. package/es/ExpressionInput/component.json +79 -0
  204. package/es/ExpressionInput/detectChainAtCursor.d.ts +17 -0
  205. package/es/ExpressionInput/detectChainAtCursor.js +31 -0
  206. package/es/ExpressionInput/filterCandidatesByPartial.d.ts +2 -0
  207. package/es/ExpressionInput/filterCandidatesByPartial.js +15 -0
  208. package/es/ExpressionInput/highlightSegments.d.ts +9 -0
  209. package/es/ExpressionInput/highlightSegments.js +14 -0
  210. package/es/ExpressionInput/index.css +1 -0
  211. package/es/ExpressionInput/index.d.ts +5 -0
  212. package/es/ExpressionInput/index.js +178 -0
  213. package/es/ExpressionInput/interface.d.ts +52 -0
  214. package/es/ExpressionInput/isExpressionValue.d.ts +5 -0
  215. package/es/ExpressionInput/isExpressionValue.js +18 -0
  216. package/es/ExpressionInput/lang/en_US.d.ts +4 -0
  217. package/es/ExpressionInput/lang/en_US.js +7 -0
  218. package/es/ExpressionInput/lang/index.d.ts +9 -0
  219. package/es/ExpressionInput/lang/index.js +10 -0
  220. package/es/ExpressionInput/lang/zh_CN.d.ts +4 -0
  221. package/es/ExpressionInput/lang/zh_CN.js +7 -0
  222. package/es/ExpressionInput/style/css.js +1 -0
  223. package/es/ExpressionInput/style/index.css +1 -0
  224. package/es/ExpressionInput/style/index.js +1 -0
  225. package/es/ExpressionInput/useExpressionInput.d.ts +26 -0
  226. package/es/ExpressionInput/useExpressionInput.js +59 -0
  227. package/es/FieldForm/FieldFormItem/ItemHolder.js +1 -1
  228. package/es/FieldForm/FieldFormItem/MemoInput.d.ts +2 -2
  229. package/es/FieldForm/FieldFormItem/StatusProvider.js +1 -1
  230. package/es/FieldForm/FieldFormItem/index.d.ts +6 -6
  231. package/es/FieldForm/Form.d.ts +2 -2
  232. package/es/FieldForm/Form.js +1 -1
  233. package/es/FieldForm/FormItemInput.js +1 -1
  234. package/es/FieldForm/FormItemLabel.js +1 -1
  235. package/es/FieldForm/FormList.d.ts +2 -2
  236. package/es/FieldForm/component.json +196 -0
  237. package/es/FieldForm/context.d.ts +5 -1
  238. package/es/FieldForm/context.js +2 -2
  239. package/es/FieldForm/hooks/useForm.d.ts +4 -3
  240. package/es/FieldForm/hooks/useFormInstance.d.ts +1 -1
  241. package/es/FieldForm/hooks/useFormItemStatus.d.ts +9 -5
  242. package/es/FieldForm/hooks/useFormItemStatus.js +2 -2
  243. package/es/FieldForm/hooks/useItemRef.d.ts +1 -1
  244. package/es/FieldForm/hooks/useItemRef.js +6 -6
  245. package/es/Form/component.json +161 -0
  246. package/es/Form/index.d.ts +52 -49
  247. package/es/Form/index.js +1 -1
  248. package/es/FormItem/compoments/defaultCompoments/index.d.ts +5 -5
  249. package/es/FormItem/compoments/defaultCompoments/index.js +12 -11
  250. package/es/FormItem/compoments/formCheckboxGroup/index.d.ts +2 -2
  251. package/es/FormItem/compoments/formFile/index.js +8 -8
  252. package/es/FormItem/compoments/formRadioGroup/index.d.ts +1 -1
  253. package/es/FormItem/compoments/formSelect/index.d.ts +1 -1
  254. package/es/FormItem/component.json +171 -0
  255. package/es/FormItem/index.d.ts +5 -5
  256. package/es/FormItem/index.js +23 -23
  257. package/es/FormItem/itemType.js +1 -1
  258. package/es/FunctionModal/component.json +197 -0
  259. package/es/FunctionModal/dialog.d.ts +1 -1
  260. package/es/FunctionModal/modalContext.d.ts +4 -1
  261. package/es/GlobalContext/confirmLocale.js +1 -1
  262. package/es/GlobalContext/index.js +1 -1
  263. package/es/Help/component.json +118 -0
  264. package/es/HelperText/component.json +126 -0
  265. package/es/Image/PreviewGroup.js +1 -1
  266. package/es/Image/component.json +165 -0
  267. package/es/Image/index.js +1 -1
  268. package/es/InputCode/component.json +191 -0
  269. package/es/InputCode/index.d.ts +2 -2
  270. package/es/InputCode/index.js +1 -1
  271. package/es/InputLang/component.json +205 -0
  272. package/es/InputLang/index.js +2 -2
  273. package/es/InputNumber/component.json +162 -0
  274. package/es/InputNumber/index.d.ts +13 -7
  275. package/es/InputNumber/index.js +152 -144
  276. package/es/Label/component.json +126 -0
  277. package/es/Label/index.d.ts +2 -2
  278. package/es/Loading/component.json +91 -0
  279. package/es/Menu/component.json +180 -0
  280. package/es/Menu/verticalMenuList.js +1 -1
  281. package/es/Message/component.json +246 -0
  282. package/es/Message/index.d.ts +2 -2
  283. package/es/Message/index.js +19 -19
  284. package/es/Modal/Confirm/index.d.ts +1 -1
  285. package/es/Modal/Confirm/index.js +1 -1
  286. package/es/Modal/component.json +277 -0
  287. package/es/Modal/index.d.ts +85 -5
  288. package/es/Modal/index.js +159 -122
  289. package/es/Modal/interface.d.ts +1 -0
  290. package/es/MultiBox/component.json +216 -0
  291. package/es/MultiBox/index.js +19 -14
  292. package/es/Notification/component.json +184 -0
  293. package/es/OperateBtn/component.json +134 -0
  294. package/es/OperateBtn/index.d.ts +3 -3
  295. package/es/PageHeader/component.json +112 -0
  296. package/es/PageHeader/horizontalMeun.js +1 -1
  297. package/es/PageHeader/horizontalMeunRight.js +1 -1
  298. package/es/Pagination/component.json +181 -0
  299. package/es/Pagination/index.js +15 -15
  300. package/es/ParauiProvider/index.js +1 -1
  301. package/es/PasswordRules/component.json +105 -0
  302. package/es/PasswordRules/index.d.ts +4 -4
  303. package/es/PopConfirm/component.json +227 -0
  304. package/es/PopConfirm/index.d.ts +1 -1
  305. package/es/PopConfirm/index.js +1 -1
  306. package/es/PopMenu/component.json +131 -0
  307. package/es/PopMenu/hooks.d.ts +1 -1
  308. package/es/PopMenu/index.js +8 -8
  309. package/es/Popover/component.json +165 -0
  310. package/es/Popover/index.js +1 -1
  311. package/es/Progress/component.json +161 -0
  312. package/es/Prompt/component.json +144 -0
  313. package/es/Querying/component.json +96 -0
  314. package/es/Querying/index.css +1 -1
  315. package/es/Querying/index.d.ts +2 -2
  316. package/es/Querying/index.js +20 -19
  317. package/es/Querying/style/index.css +1 -1
  318. package/es/QuickReply/QuickReplyCode/index.js +1 -1
  319. package/es/QuickReply/component.json +129 -0
  320. package/es/QuickReply/index.d.ts +1 -1
  321. package/es/Radio/component.json +136 -0
  322. package/es/RadioGroup/component.json +149 -0
  323. package/es/RangeInput/component.json +198 -0
  324. package/es/RangeInput/index.d.ts +15 -7
  325. package/es/RangeInput/index.js +120 -103
  326. package/es/Result/component.json +104 -0
  327. package/es/ScrollBar/component.json +115 -0
  328. package/es/Search/component.json +177 -0
  329. package/es/Search/index.d.ts +1 -1
  330. package/es/Select/component.json +244 -0
  331. package/es/Select/index.d.ts +11 -8
  332. package/es/Select/index.js +441 -438
  333. package/es/SelectInput/component.json +184 -0
  334. package/es/SelectInput/index.d.ts +4 -4
  335. package/es/SelectInput/index.js +8 -8
  336. package/es/Selector/component.json +203 -0
  337. package/es/Selector/index.js +56 -50
  338. package/es/Selector/interface.d.ts +2 -2
  339. package/es/Selector/selectorData/index.js +1 -1
  340. package/es/Selector/selectorMain/index.js +3 -3
  341. package/es/Selector/selectorNode/index.js +1 -1
  342. package/es/Selector/util.d.ts +3 -3
  343. package/es/Selector/util.js +6 -12
  344. package/es/SelectorPicker/component.json +179 -0
  345. package/es/SelectorPicker/index.d.ts +5 -5
  346. package/es/SelectorPicker/index.js +15 -15
  347. package/es/SingleBox/component.json +151 -0
  348. package/es/SingleBox/index.d.ts +2 -2
  349. package/es/Slider/component.json +181 -0
  350. package/es/SortBox/component.json +108 -0
  351. package/es/Status/component.json +104 -0
  352. package/es/Stepper/component.json +129 -0
  353. package/es/Stepper/index.d.ts +2 -2
  354. package/es/Switch/component.json +207 -0
  355. package/es/Switch/index.css +1 -1
  356. package/es/Switch/index.d.ts +3 -2
  357. package/es/Switch/index.js +60 -59
  358. package/es/Switch/style/index.css +1 -1
  359. package/es/Table/component.json +547 -0
  360. package/es/Table/index.d.ts +2 -2
  361. package/es/Table/index.js +385 -382
  362. package/es/Table/interface.d.ts +30 -0
  363. package/es/Table/tableHead.js +1 -1
  364. package/es/Table/util.d.ts +1 -1
  365. package/es/Table/util.js +3 -12
  366. package/es/Tabs/component.json +227 -0
  367. package/es/Tag/component.json +221 -0
  368. package/es/Tag/index.css +1 -1
  369. package/es/Tag/index.d.ts +1 -1
  370. package/es/Tag/index.js +20 -20
  371. package/es/Tag/style/index.css +1 -1
  372. package/es/TextEditor/component.json +186 -0
  373. package/es/TextEditor/index.d.ts +5 -5
  374. package/es/TextEditor/index.js +1 -1
  375. package/es/TextField/component.json +290 -0
  376. package/es/TextField/index.d.ts +2 -2
  377. package/es/TextField/index.js +1 -1
  378. package/es/TimePicker/component.json +176 -0
  379. package/es/Timeline/component.json +110 -0
  380. package/es/Title/component.json +156 -0
  381. package/es/ToggleButton/component.json +153 -0
  382. package/es/ToggleButton/index.js +1 -1
  383. package/es/Tooltip/component.json +176 -0
  384. package/es/Tooltip/index.js +58 -53
  385. package/es/Tooltip/interface.d.ts +14 -1
  386. package/es/Tooltip/utils.js +6 -6
  387. package/es/Transfer/component.json +157 -0
  388. package/es/Tree/OperateBar/index.js +1 -1
  389. package/es/Tree/Tree.js +3 -3
  390. package/es/Tree/component.json +512 -0
  391. package/es/Tree/interface.d.ts +1 -1
  392. package/es/Upload/component.json +450 -0
  393. package/es/Upload/util.js +1 -1
  394. package/es/Utils/snack-kit-shims.d.ts +18 -0
  395. package/es/Utils/snack-kit-shims.js +19 -0
  396. package/es/Utils/type.d.ts +0 -6
  397. package/es/_virtual/index.js +5 -3
  398. package/es/_virtual/index2.js +2 -5
  399. package/es/index.d.ts +4 -0
  400. package/es/index.js +152 -150
  401. package/es/locale/en-US.d.ts +3 -0
  402. package/es/locale/en-US.js +3 -0
  403. package/es/locale/en_US.d.ts +361 -0
  404. package/es/locale/en_US.js +364 -0
  405. package/es/locale/index.d.ts +1 -723
  406. package/es/locale/index2.js +10 -0
  407. package/es/locale/zh-CN.d.ts +3 -0
  408. package/es/locale/zh-CN.js +3 -0
  409. package/es/locale/zh_CN.d.ts +361 -0
  410. package/es/locale/zh_CN.js +364 -0
  411. package/es/node_modules/classnames/index.js +1 -1
  412. package/lib/AlignBox/component.json +89 -0
  413. package/lib/AlignBox/index.css +1 -1
  414. package/lib/AlignBox/index.d.ts +6 -2
  415. package/lib/AlignBox/index.js +1 -1
  416. package/lib/AlignBox/style/index.css +1 -1
  417. package/lib/Anchor/anchorMenu/index.d.ts +2 -1
  418. package/lib/Anchor/anchorMenu/index.js +1 -1
  419. package/lib/Anchor/component.json +130 -0
  420. package/lib/Anchor/index.js +1 -1
  421. package/lib/Anchor/type.d.ts +8 -4
  422. package/lib/Argv/component.json +216 -0
  423. package/lib/Argv/dataGenerator/index.js +1 -1
  424. package/lib/Argv/index.d.ts +5 -6
  425. package/lib/Argv/index.js +1 -1
  426. package/lib/AutoBox/component.json +133 -0
  427. package/lib/AutoBox/index.d.ts +3 -3
  428. package/lib/AutoBox/index.js +1 -1
  429. package/lib/AutoBox/protal.d.ts +2 -2
  430. package/lib/AutoBox/protal.js +1 -1
  431. package/lib/AutoButton/component.json +109 -0
  432. package/lib/AutoButton/index.js +1 -1
  433. package/lib/AutoTips/autoTipsMultiline/index.d.ts +1 -1
  434. package/lib/AutoTips/autoTipsMultiline/index.js +1 -1
  435. package/lib/AutoTips/component.json +121 -0
  436. package/lib/AutoTips/index.js +1 -1
  437. package/lib/Badge/component.json +92 -0
  438. package/lib/Breadcrumbs/component.json +142 -0
  439. package/lib/Breadcrumbs/index.js +1 -1
  440. package/lib/Button/SplitButton.d.ts +2 -2
  441. package/lib/Button/component.json +168 -0
  442. package/lib/Button/index.js +1 -1
  443. package/lib/ButtonGroup/component.json +132 -0
  444. package/lib/ButtonGroup/index.d.ts +1 -1
  445. package/lib/Card/component.json +162 -0
  446. package/lib/Card/index.d.ts +2 -2
  447. package/lib/Card/index.js +1 -1
  448. package/lib/Carousel/component.json +142 -0
  449. package/lib/Carousel/index.d.ts +1 -1
  450. package/lib/Cascader/Cascader.js +1 -1
  451. package/lib/Cascader/OptionList/Column.js +1 -1
  452. package/lib/Cascader/OptionList/index.js +1 -1
  453. package/lib/Cascader/component.json +196 -0
  454. package/lib/Cascader/hooks/useEntities.js +1 -1
  455. package/lib/Cascader/interface.d.ts +1 -0
  456. package/lib/Cascader/utils/commonUtil.d.ts +1 -1
  457. package/lib/Cascader/utils/commonUtil.js +1 -1
  458. package/lib/Cascader/utils/treeUtil.d.ts +14 -5
  459. package/lib/Cascader/utils/treeUtil.js +1 -1
  460. package/lib/Checkbox/component.json +138 -0
  461. package/lib/CheckboxGroup/component.json +152 -0
  462. package/lib/CheckboxGroup/index.js +1 -1
  463. package/lib/CodeEditor/component.json +189 -0
  464. package/lib/CodeEditor/index.d.ts +11 -10
  465. package/lib/CodeEditor/index.js +1 -1
  466. package/lib/Collapse/component.json +166 -0
  467. package/lib/Collapse/index.d.ts +1 -1
  468. package/lib/Collapse/index.js +1 -1
  469. package/lib/CollapseBox/component.json +84 -0
  470. package/lib/CollapseLayout/component.json +155 -0
  471. package/lib/ColorPicker/component.json +142 -0
  472. package/lib/ComboSelect/component.json +181 -0
  473. package/lib/ComboSelect/index.js +1 -1
  474. package/lib/ComboSelect/interface.d.ts +2 -2
  475. package/lib/ComboSelect/utils.d.ts +3 -3
  476. package/lib/ComboSelect/utils.js +1 -1
  477. package/lib/Container/component.json +111 -0
  478. package/lib/ContentBox/component.json +81 -0
  479. package/lib/CopyText/component.json +118 -0
  480. package/lib/CycleSelector/component.json +98 -0
  481. package/lib/CycleSelector/index.js +1 -1
  482. package/lib/DatePicker/component.json +192 -0
  483. package/lib/DatePicker/generatePicker/generateRangePicker.js +1 -1
  484. package/lib/DatePicker/generatePicker/generateSinglePicker.js +1 -1
  485. package/lib/Descriptions/component.json +142 -0
  486. package/lib/Descriptions/index.d.ts +1 -1
  487. package/lib/Desktop/component.json +171 -0
  488. package/lib/Desktop/index.js +1 -1
  489. package/lib/DragVerify/component.json +114 -0
  490. package/lib/DragVerify/index.js +1 -1
  491. package/lib/Drawer/component.json +200 -0
  492. package/lib/Drawer/index.js +1 -1
  493. package/lib/Drawer/interface.d.ts +1 -1
  494. package/lib/Drawer/util.d.ts +1 -6
  495. package/lib/Drawer/util.js +1 -1
  496. package/lib/Dropdown/component.json +147 -0
  497. package/lib/Dropdown/index.js +1 -1
  498. package/lib/DynamicMultiBox/component.json +278 -0
  499. package/lib/DynamicMultiBox/formItem.d.ts +1 -1
  500. package/lib/DynamicMultiBox/index.js +1 -1
  501. package/lib/DynamicMultiBox/rowForm.d.ts +2 -2
  502. package/lib/Empty/component.json +123 -0
  503. package/lib/Empty/index.css +1 -1
  504. package/lib/Empty/index.d.ts +2 -2
  505. package/lib/Empty/index.js +1 -1
  506. package/lib/Empty/style/index.css +1 -1
  507. package/lib/ExpressionInput/HighlightOverlay.d.ts +8 -0
  508. package/lib/ExpressionInput/HighlightOverlay.js +2 -0
  509. package/lib/ExpressionInput/Popup.d.ts +19 -0
  510. package/lib/ExpressionInput/Popup.js +2 -0
  511. package/lib/ExpressionInput/component.json +79 -0
  512. package/lib/ExpressionInput/detectChainAtCursor.d.ts +17 -0
  513. package/lib/ExpressionInput/detectChainAtCursor.js +2 -0
  514. package/lib/ExpressionInput/filterCandidatesByPartial.d.ts +2 -0
  515. package/lib/ExpressionInput/filterCandidatesByPartial.js +2 -0
  516. package/lib/ExpressionInput/highlightSegments.d.ts +9 -0
  517. package/lib/ExpressionInput/highlightSegments.js +2 -0
  518. package/lib/ExpressionInput/index.css +1 -0
  519. package/lib/ExpressionInput/index.d.ts +5 -0
  520. package/lib/ExpressionInput/index.js +2 -0
  521. package/lib/ExpressionInput/interface.d.ts +52 -0
  522. package/lib/ExpressionInput/isExpressionValue.d.ts +5 -0
  523. package/lib/ExpressionInput/isExpressionValue.js +2 -0
  524. package/lib/ExpressionInput/lang/en_US.d.ts +4 -0
  525. package/lib/ExpressionInput/lang/en_US.js +2 -0
  526. package/lib/ExpressionInput/lang/index.d.ts +9 -0
  527. package/lib/ExpressionInput/lang/index.js +2 -0
  528. package/lib/ExpressionInput/lang/zh_CN.d.ts +4 -0
  529. package/lib/ExpressionInput/lang/zh_CN.js +2 -0
  530. package/lib/ExpressionInput/style/css.js +1 -0
  531. package/lib/ExpressionInput/style/index.css +1 -0
  532. package/lib/ExpressionInput/style/index.js +1 -0
  533. package/lib/ExpressionInput/useExpressionInput.d.ts +26 -0
  534. package/lib/ExpressionInput/useExpressionInput.js +2 -0
  535. package/lib/FieldForm/FieldFormItem/ItemHolder.js +1 -1
  536. package/lib/FieldForm/FieldFormItem/MemoInput.d.ts +2 -2
  537. package/lib/FieldForm/FieldFormItem/StatusProvider.js +1 -1
  538. package/lib/FieldForm/FieldFormItem/index.d.ts +6 -6
  539. package/lib/FieldForm/Form.d.ts +2 -2
  540. package/lib/FieldForm/Form.js +1 -1
  541. package/lib/FieldForm/FormItemInput.js +1 -1
  542. package/lib/FieldForm/FormItemLabel.js +1 -1
  543. package/lib/FieldForm/FormList.d.ts +2 -2
  544. package/lib/FieldForm/component.json +196 -0
  545. package/lib/FieldForm/context.d.ts +5 -1
  546. package/lib/FieldForm/context.js +1 -1
  547. package/lib/FieldForm/hooks/useForm.d.ts +4 -3
  548. package/lib/FieldForm/hooks/useFormInstance.d.ts +1 -1
  549. package/lib/FieldForm/hooks/useFormItemStatus.d.ts +9 -5
  550. package/lib/FieldForm/hooks/useFormItemStatus.js +1 -1
  551. package/lib/FieldForm/hooks/useItemRef.d.ts +1 -1
  552. package/lib/FieldForm/hooks/useItemRef.js +1 -1
  553. package/lib/Form/component.json +161 -0
  554. package/lib/Form/index.d.ts +52 -49
  555. package/lib/Form/index.js +1 -1
  556. package/lib/FormItem/compoments/defaultCompoments/index.d.ts +5 -5
  557. package/lib/FormItem/compoments/defaultCompoments/index.js +1 -1
  558. package/lib/FormItem/compoments/formCheckboxGroup/index.d.ts +2 -2
  559. package/lib/FormItem/compoments/formFile/index.js +1 -1
  560. package/lib/FormItem/compoments/formRadioGroup/index.d.ts +1 -1
  561. package/lib/FormItem/compoments/formSelect/index.d.ts +1 -1
  562. package/lib/FormItem/component.json +171 -0
  563. package/lib/FormItem/index.d.ts +5 -5
  564. package/lib/FormItem/index.js +1 -1
  565. package/lib/FormItem/itemType.js +1 -1
  566. package/lib/FunctionModal/component.json +197 -0
  567. package/lib/FunctionModal/dialog.d.ts +1 -1
  568. package/lib/FunctionModal/modalContext.d.ts +4 -1
  569. package/lib/GlobalContext/confirmLocale.js +1 -1
  570. package/lib/GlobalContext/index.js +1 -1
  571. package/lib/Help/component.json +118 -0
  572. package/lib/HelperText/component.json +126 -0
  573. package/lib/Image/PreviewGroup.js +1 -1
  574. package/lib/Image/component.json +165 -0
  575. package/lib/Image/index.js +1 -1
  576. package/lib/InputCode/component.json +191 -0
  577. package/lib/InputCode/index.d.ts +2 -2
  578. package/lib/InputLang/component.json +205 -0
  579. package/lib/InputLang/index.js +1 -1
  580. package/lib/InputNumber/component.json +162 -0
  581. package/lib/InputNumber/index.d.ts +13 -7
  582. package/lib/InputNumber/index.js +1 -1
  583. package/lib/Label/component.json +126 -0
  584. package/lib/Label/index.d.ts +2 -2
  585. package/lib/Loading/component.json +91 -0
  586. package/lib/Menu/component.json +180 -0
  587. package/lib/Menu/verticalMenuList.js +1 -1
  588. package/lib/Message/component.json +246 -0
  589. package/lib/Message/index.d.ts +2 -2
  590. package/lib/Message/index.js +1 -1
  591. package/lib/Modal/Confirm/index.d.ts +1 -1
  592. package/lib/Modal/Confirm/index.js +1 -1
  593. package/lib/Modal/component.json +277 -0
  594. package/lib/Modal/index.d.ts +85 -5
  595. package/lib/Modal/index.js +1 -1
  596. package/lib/Modal/interface.d.ts +1 -0
  597. package/lib/MultiBox/component.json +216 -0
  598. package/lib/MultiBox/index.js +1 -1
  599. package/lib/Notification/component.json +184 -0
  600. package/lib/OperateBtn/component.json +134 -0
  601. package/lib/OperateBtn/index.d.ts +3 -3
  602. package/lib/PageHeader/component.json +112 -0
  603. package/lib/PageHeader/horizontalMeun.js +1 -1
  604. package/lib/PageHeader/horizontalMeunRight.js +1 -1
  605. package/lib/Pagination/component.json +181 -0
  606. package/lib/Pagination/index.js +1 -1
  607. package/lib/ParauiProvider/index.js +1 -1
  608. package/lib/PasswordRules/component.json +105 -0
  609. package/lib/PasswordRules/index.d.ts +4 -4
  610. package/lib/PopConfirm/component.json +227 -0
  611. package/lib/PopConfirm/index.d.ts +1 -1
  612. package/lib/PopConfirm/index.js +1 -1
  613. package/lib/PopMenu/component.json +131 -0
  614. package/lib/PopMenu/hooks.d.ts +1 -1
  615. package/lib/PopMenu/index.js +1 -1
  616. package/lib/Popover/component.json +165 -0
  617. package/lib/Popover/index.js +1 -1
  618. package/lib/Progress/component.json +161 -0
  619. package/lib/Prompt/component.json +144 -0
  620. package/lib/Querying/component.json +96 -0
  621. package/lib/Querying/index.css +1 -1
  622. package/lib/Querying/index.d.ts +2 -2
  623. package/lib/Querying/index.js +1 -1
  624. package/lib/Querying/style/index.css +1 -1
  625. package/lib/QuickReply/QuickReplyCode/index.js +1 -1
  626. package/lib/QuickReply/component.json +129 -0
  627. package/lib/QuickReply/index.d.ts +1 -1
  628. package/lib/Radio/component.json +136 -0
  629. package/lib/RadioGroup/component.json +149 -0
  630. package/lib/RangeInput/component.json +198 -0
  631. package/lib/RangeInput/index.d.ts +15 -7
  632. package/lib/RangeInput/index.js +1 -1
  633. package/lib/Result/component.json +104 -0
  634. package/lib/ScrollBar/component.json +115 -0
  635. package/lib/Search/component.json +177 -0
  636. package/lib/Search/index.d.ts +1 -1
  637. package/lib/Select/component.json +244 -0
  638. package/lib/Select/index.d.ts +11 -8
  639. package/lib/Select/index.js +1 -1
  640. package/lib/SelectInput/component.json +184 -0
  641. package/lib/SelectInput/index.d.ts +4 -4
  642. package/lib/SelectInput/index.js +1 -1
  643. package/lib/Selector/component.json +203 -0
  644. package/lib/Selector/index.js +1 -1
  645. package/lib/Selector/interface.d.ts +2 -2
  646. package/lib/Selector/selectorData/index.js +1 -1
  647. package/lib/Selector/selectorMain/index.js +1 -1
  648. package/lib/Selector/selectorNode/index.js +1 -1
  649. package/lib/Selector/util.d.ts +3 -3
  650. package/lib/Selector/util.js +1 -1
  651. package/lib/SelectorPicker/component.json +179 -0
  652. package/lib/SelectorPicker/index.d.ts +5 -5
  653. package/lib/SelectorPicker/index.js +1 -1
  654. package/lib/SingleBox/component.json +151 -0
  655. package/lib/SingleBox/index.d.ts +2 -2
  656. package/lib/Slider/component.json +181 -0
  657. package/lib/SortBox/component.json +108 -0
  658. package/lib/Status/component.json +104 -0
  659. package/lib/Stepper/component.json +129 -0
  660. package/lib/Stepper/index.d.ts +2 -2
  661. package/lib/Switch/component.json +207 -0
  662. package/lib/Switch/index.css +1 -1
  663. package/lib/Switch/index.d.ts +3 -2
  664. package/lib/Switch/index.js +1 -1
  665. package/lib/Switch/style/index.css +1 -1
  666. package/lib/Table/component.json +547 -0
  667. package/lib/Table/index.d.ts +2 -2
  668. package/lib/Table/index.js +1 -1
  669. package/lib/Table/interface.d.ts +30 -0
  670. package/lib/Table/tableHead.js +1 -1
  671. package/lib/Table/util.d.ts +1 -1
  672. package/lib/Table/util.js +1 -1
  673. package/lib/Tabs/component.json +227 -0
  674. package/lib/Tag/component.json +221 -0
  675. package/lib/Tag/index.css +1 -1
  676. package/lib/Tag/index.d.ts +1 -1
  677. package/lib/Tag/index.js +1 -1
  678. package/lib/Tag/style/index.css +1 -1
  679. package/lib/TextEditor/component.json +186 -0
  680. package/lib/TextEditor/index.d.ts +5 -5
  681. package/lib/TextEditor/index.js +1 -1
  682. package/lib/TextField/component.json +290 -0
  683. package/lib/TextField/index.d.ts +2 -2
  684. package/lib/TextField/index.js +1 -1
  685. package/lib/TimePicker/component.json +176 -0
  686. package/lib/Timeline/component.json +110 -0
  687. package/lib/Title/component.json +156 -0
  688. package/lib/ToggleButton/component.json +153 -0
  689. package/lib/ToggleButton/index.js +1 -1
  690. package/lib/Tooltip/component.json +176 -0
  691. package/lib/Tooltip/index.js +1 -1
  692. package/lib/Tooltip/interface.d.ts +14 -1
  693. package/lib/Tooltip/utils.js +1 -1
  694. package/lib/Transfer/component.json +157 -0
  695. package/lib/Tree/OperateBar/index.js +2 -2
  696. package/lib/Tree/Tree.js +1 -1
  697. package/lib/Tree/component.json +512 -0
  698. package/lib/Tree/interface.d.ts +1 -1
  699. package/lib/Upload/component.json +450 -0
  700. package/lib/Upload/util.js +1 -1
  701. package/lib/Utils/snack-kit-shims.d.ts +18 -0
  702. package/lib/Utils/snack-kit-shims.js +2 -0
  703. package/lib/Utils/type.d.ts +0 -6
  704. package/lib/_virtual/index.js +1 -1
  705. package/lib/_virtual/index2.js +1 -1
  706. package/lib/index.d.ts +4 -0
  707. package/lib/index.js +1 -1
  708. package/lib/locale/en-US.d.ts +3 -0
  709. package/lib/locale/en-US.js +1 -1
  710. package/lib/locale/en_US.d.ts +361 -0
  711. package/lib/locale/en_US.js +2 -0
  712. package/lib/locale/index.d.ts +1 -723
  713. package/lib/locale/index2.js +2 -0
  714. package/lib/locale/zh-CN.d.ts +3 -0
  715. package/lib/locale/zh-CN.js +1 -1
  716. package/lib/locale/zh_CN.d.ts +361 -0
  717. package/lib/locale/zh_CN.js +2 -0
  718. package/lib/node_modules/classnames/index.js +1 -1
  719. package/package.json +24 -4
  720. package/es/_virtual/index3.js +0 -5
  721. package/es/_virtual/index4.js +0 -5
  722. package/es/node_modules/@para-snack/core/dist/index.js +0 -5231
  723. package/lib/_virtual/index3.js +0 -2
  724. package/lib/_virtual/index4.js +0 -2
  725. package/lib/node_modules/@para-snack/core/dist/index.js +0 -20
  726. /package/es/{InputCode → CodeEditor}/index.css +0 -0
  727. /package/es/{Utils/Hooks → Hooks}/useResizeObserver.d.ts +0 -0
  728. /package/es/{Utils/Hooks → Hooks}/useResizeObserver.js +0 -0
  729. /package/lib/{Utils/Hooks → Hooks}/useResizeObserver.d.ts +0 -0
  730. /package/lib/{Utils/Hooks → Hooks}/useResizeObserver.js +0 -0
@@ -34,7 +34,7 @@ export interface InputCodeCardProps extends HelperTextDetailProps {
34
34
  onFinish?: (val: string) => void;
35
35
  /** 重新发送 */
36
36
  onReset?: () => Promise<boolean> | boolean;
37
- [name: string]: any;
37
+ [name: string]: unknown;
38
38
  }
39
39
  export interface InputCodeInputProps extends HelperTextDetailProps {
40
40
  /** 样式class */
@@ -66,7 +66,7 @@ export interface InputCodeInputProps extends HelperTextDetailProps {
66
66
  onChange?: (val: string) => void;
67
67
  /** 获取验证码事件 */
68
68
  onGetCode?: () => Promise<boolean> | boolean;
69
- [name: string]: any;
69
+ [name: string]: unknown;
70
70
  }
71
71
  type MergedInputCode = {
72
72
  Card: typeof InputCodeCard;
@@ -0,0 +1,205 @@
1
+ {
2
+ "name": "InputLang",
3
+ "category": "Data Entry",
4
+ "description": "多语言输入框,支持多语种内容录入 + 语种切换。内部维护多语对象 `{[langKey]: string}`,通过 typeOutput 控制输出形态(对象 / JSON 字符串)",
5
+ "semantic": {
6
+ "intent": [
7
+ "多语言内容录入",
8
+ "国际化字段管理",
9
+ "翻译数据编辑"
10
+ ],
11
+ "useCases": [
12
+ "i18n 产品名 / 标签 / 描述录入",
13
+ "翻译管理后台",
14
+ "多语种 SEO 字段"
15
+ ],
16
+ "riskLevel": "normal"
17
+ },
18
+ "keyFormatBehavior": {
19
+ "supportedFormats": "**支持任意字符串作为 langKey**:短码('zh'/'en')、BCP 47('zh-CN'/'en-US'/'ja-JP')、自定义键名都可以。组件**不校验键名格式**,只把 langList 条目当作 value 对象的 key 使用",
20
+ "examples": "// 都合法:\n<InputLang langList={['zh', 'en']} value={{zh: '你好', en: 'Hello'}} />\n<InputLang langList={['zh-CN', 'en-US']} value={{'zh-CN': '你好', 'en-US': 'Hello'}} />\n<InputLang langList={['simplified', 'traditional']} value={{simplified: '你好', traditional: '妳好'}} />",
21
+ "warning": "**value 对象的 key 必须与 langList 字符串/value 字段完全匹配**(区分大小写 + 区分连字符)。例如 langList=['zh-CN'] 但 value={zh: '你好'} 时,InputLang 切到 zh-CN 标签后读不到值"
22
+ },
23
+ "langListDisplayBehavior": {
24
+ "stringMode": "**简写 string[] 模式**:每个字符串既是 value(内部 key)又是 label(弹层显示文本)。例 `langList={['zh-CN', 'en-US']}` 时,弹层切换 tab 显示的是 'zh-CN' / 'en-US' 字符串本身,**不是 '中文' / '英文' 本地化名称**",
25
+ "objectMode": "**对象 `{label, value}[]` 模式**:label 用于弹层显示,value 用于 value 对象的 key。例 `langList={[{label: '中文', value: 'zh-CN'}, {label: 'English', value: 'en-US'}]}`,弹层显示 '中文' / 'English' 友好文本,内部 value 对象用 'zh-CN' / 'en-US' 作 key",
26
+ "useWhen": "纯开发场景(配置 / 调试):用 string[] 简洁。**用户面向场景:用 {label, value}[] 配本地化文本**(string[] 显示原始 key 不友好)"
27
+ },
28
+ "variants": {
29
+ "default": {
30
+ "meaning": "默认样式"
31
+ }
32
+ },
33
+ "states": [
34
+ "default",
35
+ "disabled",
36
+ "error"
37
+ ],
38
+ "idealProps": {
39
+ "size": {
40
+ "type": "enum",
41
+ "values": [
42
+ "small",
43
+ "medium",
44
+ "large"
45
+ ],
46
+ "default": "large",
47
+ "description": "大小"
48
+ },
49
+ "label": {
50
+ "type": "ReactNode",
51
+ "description": "标题"
52
+ },
53
+ "labelTooltip": {
54
+ "type": "LabelTooltipProps",
55
+ "description": "标题旁帮助提示;对象,见 Label 组件 LabelTooltipProps"
56
+ },
57
+ "placeholder": {
58
+ "type": "string",
59
+ "description": "输入值的提示语(非语言键)"
60
+ },
61
+ "placeholderKey": {
62
+ "type": "string",
63
+ "description": "语言键侧的提示语;label='国际化' 模式常配合 placeholder 使用"
64
+ },
65
+ "placeholderValue": {
66
+ "type": "string",
67
+ "description": "翻译值侧的提示语"
68
+ },
69
+ "langList": {
70
+ "type": "(string | { label: string; value: string })[]",
71
+ "default": "['zh', 'en']",
72
+ "description": "**支持的语种列表**。两种形态:① 简写 string[] 如 `['zh', 'en']` —— 弹层显示原始 key 字符串(非本地化名);② 对象 `{label, value}[]` 如 `[{label:'中文',value:'zh'}]` —— 弹层显示 label 文本,内部用 value 作 key。**任意字符串都可作 langKey**(短码 / BCP 47 / 自定义,见 keyFormatBehavior)"
73
+ },
74
+ "value": {
75
+ "type": "string | { [name: string]: string }",
76
+ "description": "**受控值,形态由 typeOutput 控制**:typeOutput='object'(默认)→ `{zh:'输入框', en:'...'}` 多语对象;typeOutput='string' → JSON 字符串如 `'{\"zh\":\"输入框\",\"en\":\"...\",\"_i18n\":1}'`。**注:不是 Record<string,string>**(虽然语义上等价,签名是 `{[name]: string}` 索引签名形态),业务用 Record<string,string> 时需要 `as unknown as` 中转"
77
+ },
78
+ "defaultValue": {
79
+ "type": "string | { [name: string]: string }",
80
+ "description": "非受控初始值;形态同 value。可与 langList string[] 简写组合使用(两者正交)"
81
+ },
82
+ "onChange": {
83
+ "type": "(val: string | { [name: string]: string }) => void",
84
+ "description": "值变化回调;val 形态随 typeOutput 变化(string 或对象)。**业务签名 (val: Record<string, string>) => void**:可用 typeof 守卫 + `as unknown as Record<string,string>` 处理"
85
+ },
86
+ "typeOutput": {
87
+ "type": "enum",
88
+ "values": [
89
+ "string",
90
+ "object"
91
+ ],
92
+ "default": "object",
93
+ "description": "输出类型;'object' 输出多语对象,'string' 输出 JSON 字符串(含 _i18n 标识位)"
94
+ },
95
+ "required": {
96
+ "type": "boolean",
97
+ "default": "false",
98
+ "description": "是否必填"
99
+ },
100
+ "disabled": {
101
+ "type": "boolean",
102
+ "default": "false",
103
+ "description": "是否禁用"
104
+ },
105
+ "disabledTooltip": {
106
+ "type": "TooltipProps",
107
+ "description": "禁用态 hover 提示。**常用字段**:`title: ReactNode`(提示内容,最常用)、`placement?: 'top'|'bottom'|'left'|'right'|...`(方向)、`arrow?: boolean`(显示箭头)。完整字段见 Tooltip 组件文档"
108
+ },
109
+ "error": {
110
+ "type": "boolean",
111
+ "default": "false",
112
+ "description": "错误态视觉"
113
+ },
114
+ "helperText": {
115
+ "type": "ReactNode",
116
+ "description": "错误文本/辅助文本"
117
+ },
118
+ "hideErrorDom": {
119
+ "type": "boolean | null",
120
+ "description": "true=无错误时不渲染占位;false=都渲染;null=不渲染直接返回 null。见 HelperText 同名 prop"
121
+ },
122
+ "limitLength": {
123
+ "type": "number",
124
+ "description": "输入长度上限"
125
+ },
126
+ "i18n": {
127
+ "type": "boolean",
128
+ "description": "i18n 标识;typeOutput='string' 时默认 true(向输出 JSON 注入 _i18n=1)"
129
+ }
130
+ },
131
+ "commonMisconceptions": {
132
+ "M1": {
133
+ "wrong": "传 langList=['zh-CN', 'en-US'] 但 value={{ zh: '你好', en: 'Hello' }}(value 用短码 key)",
134
+ "result": "InputLang 切换到 'zh-CN' / 'en-US' 标签时读不到 value(因为 value 对象用的是 'zh'/'en' 短码 key) → 显示空内容",
135
+ "fix": "**langList 字符串/value 字段与 value 对象 key 必须完全一致**:要么都用短码(`langList=['zh','en']` + `value={{zh:'',en:''}}`),要么都用 BCP 47(`langList=['zh-CN','en-US']` + `value={{'zh-CN':'','en-US':''}}`)"
136
+ },
137
+ "M2": {
138
+ "wrong": "用 langList=['zh-CN', 'en-US'] 期望弹层显示 '中文' / 'English' 友好文本",
139
+ "result": "**string[] 简写模式弹层显示原始字符串**(显示 'zh-CN' / 'en-US' 而非翻译名)",
140
+ "fix": "用对象形式 `langList={[{label: '中文', value: 'zh-CN'}, {label: 'English', value: 'en-US'}]}` —— label 是显示文本,value 是内部 key"
141
+ },
142
+ "M3": {
143
+ "wrong": "在 onChange 回调签名是 `(val: Record<string, string>) => void` 的业务接口里直接接 InputLang.onChange,期望 TS 自动兼容",
144
+ "result": "**InputLang.onChange 签名是 `(val: string | { [name: string]: string }) => void`**,有 string 联合分支。直接传业务 callback 会因 string 分支不兼容 → TS 报错",
145
+ "fix": "用 typeof 守卫 + cast: `onChange={(val) => { if (typeof val !== 'string') businessCallback(val as unknown as Record<string, string>); }}` 或者用 typeOutput='object' 保证不会出现 string 分支"
146
+ },
147
+ "M4": {
148
+ "wrong": "假设 langList 默认值是空数组",
149
+ "result": "**默认值是 `['zh', 'en']`**(代码 L114 实证)。不传 langList 时 InputLang 仍然显示 zh/en 两个语种 tab",
150
+ "fix": "需要纯空白:显式传 `langList={[]}`(罕见)。需要完全自定义语种:传完整 langList 覆盖默认"
151
+ }
152
+ },
153
+ "do": [
154
+ "**langList 字符串/value 字段与 value 对象 key 一致**(全短码或全 BCP 47,见 M1)",
155
+ "**用户面向场景用对象形式 langList**(配 label 本地化文本,M2)",
156
+ "**业务 callback Record<string,string>**:typeof 守卫 + as unknown as 中转(M3)",
157
+ "**typeOutput 默认 'object'** —— 直接用对象形态;只在需要 JSON 持久化时用 'string'",
158
+ "禁用态配合 disabledTooltip={{title: '已归档,不可编辑'}} 给业务语义化提示"
159
+ ],
160
+ "dont": [
161
+ "**不要**让 langList key 与 value 对象 key 不一致 —— 读不到值(M1)",
162
+ "**不要**用 string[] langList 期望本地化显示 —— 显示原始 key(M2)",
163
+ "**不要**直接对接 Record<string,string> 业务 callback —— 联合签名不兼容(M3)",
164
+ "**不要**忘记不传 langList 时默认 ['zh','en'] —— 不是空数组(M4)",
165
+ "语言列表过多(>5)导致下拉过长 —— 考虑分组",
166
+ "忽略默认语言设置"
167
+ ],
168
+ "events": {
169
+ "onChange": {
170
+ "signature": "(val: string | { [name: string]: string }) => void",
171
+ "asyncSupported": false,
172
+ "examples": [
173
+ "typeOutput='object'(默认): onChange={(val) => { if (typeof val !== 'string') setState(val as Record<string,string>); }} — 对象形态,{zh:'内容', en:'content'}",
174
+ "typeOutput='string': onChange={(val) => { if (typeof val === 'string') setState(val); }} — JSON 字符串形态,'{\"zh\":\"内容\",\"_i18n\":1}'",
175
+ "弹窗关闭时触发(不是实时):用户在弹窗内修改其他语种值,关闭弹窗后 onChange 才触发一次完整 val"
176
+ ],
177
+ "commonMistakes": [
178
+ "onChange 签名写成 (val: Record<string, string>) => void 直接接入——TypeScript 报错,InputLang.onChange 联合 string 分支,需 typeof 守卫",
179
+ "期望每次按键都触发 onChange——主语言(当前展示语言)实时触发,其他语言在弹窗关闭时批量触发一次",
180
+ "typeOutput='string' 时期望 onChange 返回的 val 是纯 JSON——实际含 _i18n 标识位,需 JSON.parse 后 delete _i18n 才是干净数据"
181
+ ]
182
+ }
183
+ },
184
+ "typescriptPitfalls": [
185
+ {
186
+ "issue": "onChange 签名是联合类型,直接接业务 Record<string,string> 回调触发 TS 不兼容",
187
+ "wrong": "const handler = (val: Record<string, string>) => setState(val); <InputLang onChange={handler} /> // 报 TS2322:string 分支和 Record 不兼容",
188
+ "right": "<InputLang onChange={(val) => { if (typeof val !== 'string') setState(val as unknown as Record<string,string>); }} />"
189
+ },
190
+ {
191
+ "issue": "value 类型签名是 `string | { [name: string]: string }` 不是 `Record<string, string>`,在 TS 5.x 可能触发 TS2352 直接 as cast 失败",
192
+ "wrong": "const data: Record<string,string> = {zh: '你好'}; <InputLang value={data as { [name: string]: string }} /> // TS5 strict 模式下拒绝结构兼容 as",
193
+ "right": "<InputLang value={data as unknown as { [name: string]: string }} /> // 用 unknown 中转"
194
+ },
195
+ {
196
+ "issue": "langList 默认值是 ['zh', 'en'],不传时已经有两个语种 tab,不是空列表",
197
+ "wrong": "// 期望没有多语切换,不传 langList\n<InputLang value={val} onChange={onChange} /> // 实际显示 zh/en 两个 tab,点击地球图标弹出语种选择",
198
+ "right": "// 需要禁用多语:传 langList={[]}(无弹出语种)或 disabledAdd + disabledDelete + disabledKey 锁定行为"
199
+ }
200
+ ],
201
+ "mapping": {
202
+ "realComponent": "InputLang",
203
+ "adapter": null
204
+ }
205
+ }
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const u=require("../_virtual/jsx-runtime.js"),s=require("react"),be=require("../TextField/index.js"),he=require("../HelperText/index.js"),me=require("../MultiBox/index.js"),ve=require("../AutoTips/index.js"),je=require("../Popover/index.js"),ye=require("../node_modules/@para-ui/icons/Internet/index.js"),W=require("@paraview/lib"),g=require("../GlobalContext/constant.js"),Ce=require("../Hooks/useGlobalProps.js");;/* empty css */const z=f=>{const{className:R,style:H,label:K,labelTooltip:F,size:v="large",placeholder:q,placeholderKey:G,placeholderValue:J,error:L=!1,hideErrorDom:w,helperText:Q="",required:U=!1,popoverClassName:N,value:M,onChange:O,langList:x=["zh","en"],limitLength:$,disabled:_=!1,disabledTooltip:X,defaultLang:j,disabledDelete:S,disabledAdd:Y,disabledKey:E,typeOutput:V="object",i18n:D}=Ce.default(f,"InputLang"),[Z,k]=s.useState(!1),[o,ee]=s.useState(W.GetLanguage()||"zh"),[I,te]=s.useState({}),[b,T]=s.useState({}),[d,A]=s.useState([]),a=s.useRef({lang:o,valueCom:b,langMapping:{},langLabelMapping:{}}),P=s.useRef(null);a.current.lang=o,a.current.disabledDelete=S,a.current.typeOutput=V,a.current.i18n=V==="string"&&D===void 0?!0:D,s.useEffect(()=>{f.defaultValue!==void 0&&y(f.defaultValue)},[]),s.useEffect(()=>{M!==void 0&&y(M)},[M]),s.useEffect(()=>{j!==void 0&&(ee(j),a.current.lang=j,y())},[j]),s.useEffect(()=>{if(x){const e={},t={};for(let l=0,i=x.length;l<i;l++){const n=x[l];typeof n=="string"?(e[n]={label:n,value:n},t[n]={label:n,value:n}):(e[n.value]=n,t[n.label]=n)}a.current.langMapping=e,a.current.langLabelMapping=t,te(e),y()}},[f.langList]);const y=e=>{let t;if(e){try{typeof e=="string"?t=JSON.parse(e):t=e||{}}catch{t={}}a.current.i18n===!0&&(a.current._i18n=t._i18n||1,delete t._i18n)}const l={...t||a.current.valueCom},i=[],n={};if(a.current.disabledDelete){const r=Object.keys(a.current.langMapping)||[];for(let h=0,p=r.length;h<p;h++){const C=a.current.langMapping[r[h]]||{},m=C.value,fe=C.label,xe=l[m];m!==a.current.lang&&(n[m]=!0,i.push({label:fe,value:xe||""}))}}const c=Object.keys(l);for(let r=0,h=c.length;r<h;r++){const p=c[r],C=l[p];if(!n[p]&&p!==a.current.lang){const m=a.current.langMapping[p]||{};i.push({label:m.label||p,value:C||""})}}a.current.valueCom={...l},A(i),T(l)},B=e=>{let t={...e};if(f.value===void 0&&(a.current.valueCom={...t},T(t)),a.current.typeOutput==="string")try{a.current.i18n===!0&&(t._i18n=a.current._i18n||1),t=JSON.stringify(t)}catch{}O&&O(t)},ne=e=>{b[o]=e.target.value;const t={...b};B(t)},le=e=>{A([...e])},ae=(e,t)=>{const l=[],i=W.ArrayToObject("label",d);for(let n=0,c=x.length;n<c;n++){let r=x[n];typeof r=="object"&&(r=r.label),!i[r]&&r!==(I[o]?.label||o)&&l.push({label:r,value:r})}t(l)},re=()=>{k(!0)},se=e=>{if(e)return;k(!1);const t={};t[o]=b[o]||"";for(let l=0,i=d.length;l<i;l++){const n=d[l],c=a.current.langLabelMapping[n.label]?.value||n.label||"";c.trim()!==""&&(t[c]=n.value||"")}B(t)},ie=()=>u.jsxRuntimeExports.jsx("div",{className:"lang-key",children:u.jsxRuntimeExports.jsx(ve.default,{tipMaxWidth:"none",children:I[o]?.label||o})}),oe=s.useMemo(()=>u.jsxRuntimeExports.jsx("div",{className:"lang-list-icon",children:u.jsxRuntimeExports.jsx(ye.Internet,{})}),[]),ue=()=>{let e=`${g.$prefixCls}-input-lang-popover`;return N&&(e+=` ${N}`),Y&&(e+=` ${g.$prefixCls}-input-lang-popover-disabled-add`),S&&(e+=` ${g.$prefixCls}-input-lang-popover-disabled-delete`),e},ce=()=>{if(_===!0)return!0;const e=[];if(E){const t=typeof E=="object";for(let l=0,i=d.length;l<i;l++){const n=d[l].label||"",c=a.current.langLabelMapping[n]||{};t?e.push({[n]:E.indexOf(c.value||n)!==-1}):n.trim()!==""&&e.push({[n]:!0})}}return e},pe=(e,t)=>{const l={};return $&&(l.limitLength=$),l},de=()=>u.jsxRuntimeExports.jsx("div",{className:"input-lang-list",children:u.jsxRuntimeExports.jsx(me.MultiBox,{className:"input-lang-multi-box",size:v,disabled:ce(),value:d,onChange:le,fetchSuggestionsKey:ae,placeholderKey:G,placeholderValue:J||q,valueOtherProps:pe})}),ge=()=>{let e=`${g.$prefixCls}-input-lang`;return v&&(e+=` ${g.$prefixCls}-input-lang-${v}`),L&&(e+=` ${g.$prefixCls}-input-lang-error`),R&&(e+=` ${R}`),e};return u.jsxRuntimeExports.jsxs("div",{className:ge(),style:H,ref:P,children:[u.jsxRuntimeExports.jsx(je.Popover,{placement:"bottom-end",visible:Z,content:de(),onVisibleChange:se,overlayClassName:ue(),maxWidth:"none",overlayInnerStyle:{minWidth:"440px",width:`${P.current?.offsetWidth}px`},children:u.jsxRuntimeExports.jsx(be.TextField,{className:"input-lang-text-field",size:v,error:L,disabled:_,disabledTooltip:X,required:U,label:K,labelTooltip:F,placeholder:q,value:b[o]||"",rightIcon:oe,addonBefore:ie(),hideErrorDom:!0,limitLength:$,onClickIcon:re,onChange:ne})}),u.jsxRuntimeExports.jsx(he.default,{className:"input-lang-error-text",error:L,helperText:Q,hideErrorDom:w})]})};exports.InputLang=z;exports.default=z;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const u=require("../_virtual/jsx-runtime.js"),r=require("react"),be=require("../TextField/index.js"),he=require("../HelperText/index.js"),me=require("../MultiBox/index.js"),ve=require("../AutoTips/index.js"),je=require("../Popover/index.js"),ye=require("../node_modules/@para-ui/icons/Internet/index.js"),K=require("../Utils/snack-kit-shims.js"),g=require("../GlobalContext/constant.js"),Ce=require("../Hooks/useGlobalProps.js");;/* empty css */const W=f=>{const{className:$,style:z,label:H,labelTooltip:F,size:v="large",placeholder:q,placeholderKey:G,placeholderValue:J,error:L=!1,hideErrorDom:w,helperText:Q="",required:U=!1,popoverClassName:S,value:M,onChange:N,langList:x=["zh","en"],limitLength:E,disabled:O=!1,disabledTooltip:X,defaultLang:j,disabledDelete:_,disabledAdd:Y,disabledKey:R,typeOutput:V="object",i18n:k}=Ce.default(f,"InputLang"),[Z,D]=r.useState(!1),[o,ee]=r.useState(K.GetLanguage()||"zh"),[I,te]=r.useState({}),[b,T]=r.useState({}),[d,A]=r.useState([]),a=r.useRef({lang:o,valueCom:b,langMapping:{},langLabelMapping:{}}),P=r.useRef(null);a.current.lang=o,a.current.disabledDelete=_,a.current.typeOutput=V,a.current.i18n=V==="string"&&k===void 0?!0:k,r.useEffect(()=>{f.defaultValue!==void 0&&y(f.defaultValue)},[]),r.useEffect(()=>{M!==void 0&&y(M)},[M]),r.useEffect(()=>{j!==void 0&&(ee(j),a.current.lang=j,y())},[j]),r.useEffect(()=>{if(x){const e={},t={};for(let l=0,i=x.length;l<i;l++){const n=x[l];typeof n=="string"?(e[n]={label:n,value:n},t[n]={label:n,value:n}):(e[n.value]=n,t[n.label]=n)}a.current.langMapping=e,a.current.langLabelMapping=t,te(e),y()}},[f.langList]);const y=e=>{let t;if(e){try{typeof e=="string"?t=JSON.parse(e):t=e||{}}catch{t={}}a.current.i18n===!0&&(a.current._i18n=t._i18n||1,delete t._i18n)}const l={...t||a.current.valueCom},i=[],n={};if(a.current.disabledDelete){const s=Object.keys(a.current.langMapping)||[];for(let h=0,p=s.length;h<p;h++){const C=a.current.langMapping[s[h]]||{},m=C.value,fe=C.label,xe=l[m];m!==a.current.lang&&(n[m]=!0,i.push({label:fe,value:xe||""}))}}const c=Object.keys(l);for(let s=0,h=c.length;s<h;s++){const p=c[s],C=l[p];if(!n[p]&&p!==a.current.lang){const m=a.current.langMapping[p]||{};i.push({label:m.label||p,value:C||""})}}a.current.valueCom={...l},A(i),T(l)},B=e=>{let t={...e};if(f.value===void 0&&(a.current.valueCom={...t},T(t)),a.current.typeOutput==="string")try{a.current.i18n===!0&&(t._i18n=String(a.current._i18n||1)),t=JSON.stringify(t)}catch{}N&&N(t)},ne=e=>{b[o]=e.target.value;const t={...b};B(t)},le=e=>{A([...e])},ae=(e,t)=>{const l=[],i=K.ArrayToObject("label",d);for(let n=0,c=x.length;n<c;n++){let s=x[n];typeof s=="object"&&(s=s.label),!i[s]&&s!==(I[o]?.label||o)&&l.push({label:s,value:s})}t(l)},se=()=>{D(!0)},re=e=>{if(e)return;D(!1);const t={};t[o]=b[o]||"";for(let l=0,i=d.length;l<i;l++){const n=d[l],c=a.current.langLabelMapping[n.label]?.value||n.label||"";c.trim()!==""&&(t[c]=n.value||"")}B(t)},ie=()=>u.jsxRuntimeExports.jsx("div",{className:"lang-key",children:u.jsxRuntimeExports.jsx(ve.default,{tipMaxWidth:"none",children:I[o]?.label||o})}),oe=r.useMemo(()=>u.jsxRuntimeExports.jsx("div",{className:"lang-list-icon",children:u.jsxRuntimeExports.jsx(ye.Internet,{})}),[]),ue=()=>{let e=`${g.$prefixCls}-input-lang-popover`;return S&&(e+=` ${S}`),Y&&(e+=` ${g.$prefixCls}-input-lang-popover-disabled-add`),_&&(e+=` ${g.$prefixCls}-input-lang-popover-disabled-delete`),e},ce=()=>{if(O===!0)return!0;const e=[];if(R){const t=typeof R=="object";for(let l=0,i=d.length;l<i;l++){const n=d[l].label||"",c=a.current.langLabelMapping[n]||{};t?e.push({[n]:R.indexOf(c.value||n)!==-1}):n.trim()!==""&&e.push({[n]:!0})}}return e},pe=(e,t)=>{const l={};return E&&(l.limitLength=E),l},de=()=>u.jsxRuntimeExports.jsx("div",{className:"input-lang-list",children:u.jsxRuntimeExports.jsx(me.MultiBox,{className:"input-lang-multi-box",size:v,disabled:ce(),value:d,onChange:le,fetchSuggestionsKey:ae,placeholderKey:G,placeholderValue:J||q,valueOtherProps:pe})}),ge=()=>{let e=`${g.$prefixCls}-input-lang`;return v&&(e+=` ${g.$prefixCls}-input-lang-${v}`),L&&(e+=` ${g.$prefixCls}-input-lang-error`),$&&(e+=` ${$}`),e};return u.jsxRuntimeExports.jsxs("div",{className:ge(),style:z,ref:P,children:[u.jsxRuntimeExports.jsx(je.Popover,{placement:"bottom-end",visible:Z,content:de(),onVisibleChange:re,overlayClassName:ue(),maxWidth:"none",overlayInnerStyle:{minWidth:"440px",width:`${P.current?.offsetWidth}px`},children:u.jsxRuntimeExports.jsx(be.TextField,{className:"input-lang-text-field",size:v,error:L,disabled:O,disabledTooltip:X,required:U,label:H,labelTooltip:F,placeholder:q,value:b[o]||"",rightIcon:oe,addonBefore:ie(),hideErrorDom:!0,limitLength:E,onClickIcon:se,onChange:ne})}),u.jsxRuntimeExports.jsx(he.default,{className:"input-lang-error-text",error:L,helperText:Q,hideErrorDom:w})]})};exports.InputLang=W;exports.default=W;
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,162 @@
1
+ {
2
+ "name": "InputNumber",
3
+ "category": "Data Entry",
4
+ "description": "数字输入框,提供加减按钮",
5
+ "semantic": {
6
+ "intent": [
7
+ "数字录入",
8
+ "数量调整"
9
+ ],
10
+ "useCases": [
11
+ "商品数量",
12
+ "金额输入",
13
+ "年龄录入"
14
+ ],
15
+ "riskLevel": "low"
16
+ },
17
+ "variants": {
18
+ "default": {
19
+ "meaning": "标准数字显示"
20
+ }
21
+ },
22
+ "states": [
23
+ "focus",
24
+ "blur",
25
+ "disabled",
26
+ "error"
27
+ ],
28
+ "idealProps": {
29
+ "value": {
30
+ "type": "number | null | undefined",
31
+ "description": "受控值;clearable=true 时类型为 number | null,默认为 number | undefined"
32
+ },
33
+ "defaultValue": {
34
+ "type": "number | null | undefined",
35
+ "description": "非受控默认值;类型规则同 value"
36
+ },
37
+ "onChange": {
38
+ "type": "(value: number | null) => void",
39
+ "description": "值变化回调;clearable=true 时入参 number | null;默认时收敛为 number"
40
+ },
41
+ "clearable": {
42
+ "type": "boolean",
43
+ "default": false,
44
+ "description": "是否允许清空;true 时 onChange 入参 number | null;false(默认)时清空被拦截、失焦回填上一值。组件泛型 InputNumberProps<C extends boolean> 由该 prop 驱动"
45
+ },
46
+ "max": {
47
+ "type": "number",
48
+ "description": "最大值;超出后加按钮禁用,失焦回收"
49
+ },
50
+ "min": {
51
+ "type": "number",
52
+ "description": "最小值;低于后减按钮禁用,失焦回收"
53
+ },
54
+ "step": {
55
+ "type": "number",
56
+ "default": 1,
57
+ "description": "步进值"
58
+ },
59
+ "btnMode": {
60
+ "type": "'lr' | 'tb' | 'none'",
61
+ "values": ["lr", "tb", "none"],
62
+ "default": "tb",
63
+ "description": "按钮模式;lr=左右加减、tb=右侧上下加减、none=无按钮"
64
+ },
65
+ "formatter": {
66
+ "type": "(value: number | string, info: { userTyping: boolean; input: string }) => string",
67
+ "description": "数字 → 展示字符串;必须与 parser 配对"
68
+ },
69
+ "parser": {
70
+ "type": "(displayValue: string) => number",
71
+ "description": "展示字符串 → 数字;与 formatter 配对,返回值作为 onChange 入参"
72
+ },
73
+ "disabled": {
74
+ "type": "boolean",
75
+ "default": false,
76
+ "description": "是否禁用"
77
+ },
78
+ "size": {
79
+ "type": "'small' | 'medium' | 'large'",
80
+ "values": ["small", "medium", "large"],
81
+ "default": "large",
82
+ "description": "尺寸"
83
+ }
84
+ },
85
+ "do": [
86
+ "限制 min 和 max 以符合业务逻辑",
87
+ "需要小数精度时通过 formatter / parser 组合实现",
88
+ "受控模式必须同时传 value 和 onChange",
89
+ "需要清空场景显式传 clearable=true,并用 number | null 类型的 state"
90
+ ],
91
+ "dont": [
92
+ "使用 Text Input 录入需要计算的数字",
93
+ "步进值 (step) 设置过大导致无法精确调节",
94
+ "clearable=false(默认)时把 state 初始化为 null —— 会触发类型错误",
95
+ "传 formatter 不传 parser(或反之)—— 二者必须配对"
96
+ ],
97
+ "events": {
98
+ "onChange": {
99
+ "signature": "clearable=false: (value: number) => void | clearable=true: (value: number | null) => void",
100
+ "asyncSupported": false,
101
+ "examples": [
102
+ "clearable=false(默认): onChange={(val) => setState(val)} — val 是 number,清空被拦截,失焦时回填上一次有效值",
103
+ "clearable=true: onChange={(val) => setState(val)} — val 是 number | null,用户清空后 val=null 传出",
104
+ "加减按钮点击也触发 onChange,通过内部精度计算避免浮点误差(12位精度)"
105
+ ],
106
+ "commonMistakes": [
107
+ "clearable=false 时把 state 类型声明为 number | null——ts 会报错 null 不符合 onChange 签名的 number 入参",
108
+ "期望 onChange 在 mount 时触发初始 defaultValue——组件不触发初始 onChange,只在用户交互时触发",
109
+ "使用受控 value 但不传 onChange——value 更新不回流到组件,显示值和 state 不同步"
110
+ ]
111
+ },
112
+ "onBlur": {
113
+ "signature": "(event: React.FocusEvent<HTMLInputElement>) => void",
114
+ "asyncSupported": false,
115
+ "examples": [
116
+ "onBlur={(e) => validate(e.target.value)} — 失焦时校验",
117
+ "clearable=false 时 onBlur 之后组件内部回填上一次有效值(如用户清空输入框)——在 onBlur 里读 e.target.value 可能是回填前的空串",
118
+ "onBlur={(e) => setError(Number(e.target.value) < min ? '低于最小值' : '')} — 配合 min/max 做自定义错误提示"
119
+ ],
120
+ "commonMistakes": [
121
+ "在 onBlur 里读 e.target.value 作为最终值——clearable=false 失焦会触发回填,此时 value 可能已被重写,应用 onChange 最新值或 ref 维护",
122
+ "期望 onBlur 和 onChange 同时触发——清空后失焦只触发 onBlur(onChange 被拦截了),需在 onBlur 里独立处理",
123
+ "期望 onBlur 的 e.target 是最终显示值——回填逻辑发生在 onBlur handler 内部,timing 依赖 dom.value 写入"
124
+ ]
125
+ },
126
+ "onEnter": {
127
+ "signature": "(event: React.KeyboardEvent<HTMLInputElement>) => void",
128
+ "asyncSupported": false,
129
+ "examples": [
130
+ "onEnter={(e) => submitForm()} — 按回车提交表单",
131
+ "onEnter={(e) => { e.preventDefault(); nextFieldRef.current?.focus(); }} — 回车跳到下一字段",
132
+ "onEnter 和 onChange 独立触发——回车不会触发失焦,不会触发回填逻辑"
133
+ ],
134
+ "commonMistakes": [
135
+ "在 onEnter 里读 e.target.value 期望是最终数字——回车时 rc-input-number 可能还没 commit 值,建议用受控 value 而非 target.value",
136
+ "期望 onEnter 代替 onBlur 触发校验——两者行为不同,回车不失焦,需独立监听",
137
+ "传 onKeyDown 期望捕获回车——底层用的是 onPressEnter(rc-input-number),应用 onEnter prop"
138
+ ]
139
+ }
140
+ },
141
+ "typescriptPitfalls": [
142
+ {
143
+ "issue": "InputNumber 是泛型组件 InputNumber<C extends boolean>,clearable 决定 onChange/value 类型,不传 clearable 时默认 false(number 类型)",
144
+ "wrong": "const [val, setVal] = useState<number | null>(null); <InputNumber value={val} onChange={setVal} /> // val 和 setVal 含 null,但 clearable 默认 false 不允许 null,TS 报错",
145
+ "right": "const [val, setVal] = useState<number | null>(null); <InputNumber<true> clearable value={val} onChange={setVal} /> // 显式泛型参数或 clearable=true 驱动类型"
146
+ },
147
+ {
148
+ "issue": "formatter 和 parser 必须成对使用,只传一个会导致显示和实际值不同步",
149
+ "wrong": "formatter={(val) => `${val}%`} // 没有 parser,用户看到 '50%' 但内部 onChange 收到 '50%' 字符串而非数字",
150
+ "right": "formatter={(val) => `${val}%`} parser={(val) => parseFloat(val.replace('%', '')) as any} // 成对,parser 把展示串转回数字"
151
+ },
152
+ {
153
+ "issue": "addonBefore/addonAfter 是 ReactNode,传字符串可能 TS 允许但布局与 ReactNode 写法不一致",
154
+ "wrong": "<InputNumber addonBefore='¥' /> // 字符串是合法 ReactNode,但建议显式包 span 控制样式",
155
+ "right": "<InputNumber addonBefore={<span>¥</span>} /> // 或直接字符串;字符串也 OK,仅风格建议"
156
+ }
157
+ ],
158
+ "mapping": {
159
+ "realComponent": "InputNumber",
160
+ "adapter": null
161
+ }
162
+ }
@@ -1,8 +1,8 @@
1
- import { default as React, FunctionComponent, ReactNode } from 'react';
1
+ import { default as React, ReactNode } from 'react';
2
2
  import { LabelTooltipProps } from '../Label';
3
3
  import { HelperTextDetailProps } from '../HelperText';
4
4
  import { TooltipProps } from '../Tooltip';
5
- export interface InputNumberProps extends HelperTextDetailProps {
5
+ export interface InputNumberProps<Clearable extends boolean = false> extends HelperTextDetailProps {
6
6
  /** 样式class */
7
7
  className?: string;
8
8
  /** style */
@@ -47,6 +47,12 @@ export interface InputNumberProps extends HelperTextDetailProps {
47
47
  autoFocus?: boolean;
48
48
  /** 只读 */
49
49
  readOnly?: boolean;
50
+ /**
51
+ * 是否允许清空(清空后 onChange 回传 null);
52
+ * 默认 false 时 onChange 入参收敛为 number,清空操作会被组件内部拦截并在失焦时回填上一次有效值;
53
+ * 显式 true 时 onChange 入参为 number | null,沿用历史行为
54
+ */
55
+ clearable?: Clearable;
50
56
  /** 指定输入框展示值的格式 */
51
57
  formatter?: (value: number | string, info: {
52
58
  userTyping: boolean;
@@ -55,15 +61,15 @@ export interface InputNumberProps extends HelperTextDetailProps {
55
61
  /** 指定从 formatter 里转换回数字的方式,和 formatter 搭配使用 */
56
62
  parser?: (displayValue: string) => number;
57
63
  /** 默认值 不受控 */
58
- defaultValue?: number | null;
64
+ defaultValue?: Clearable extends true ? number | null : number | undefined;
59
65
  /** 默认值 受控 */
60
- value?: number | null;
66
+ value?: Clearable extends true ? number | null : number | undefined;
61
67
  /** 前缀 */
62
68
  addonBefore?: ReactNode;
63
69
  /** 后缀 */
64
70
  addonAfter?: ReactNode;
65
- /** 改变事件 number / null */
66
- onChange?: (value: number | null) => void;
71
+ /** 改变事件 number(默认)或 number | null(clearable=true) */
72
+ onChange?: (value: Clearable extends true ? number | null : number) => void;
67
73
  /** 回车事件 */
68
74
  onEnter?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
69
75
  /** 失去焦点 */
@@ -73,5 +79,5 @@ export interface InputNumberProps extends HelperTextDetailProps {
73
79
  /** name */
74
80
  name?: string;
75
81
  }
76
- export declare const InputNumber: FunctionComponent<InputNumberProps>;
82
+ export declare function InputNumber<C extends boolean = false>(props: InputNumberProps<C>): JSX.Element;
77
83
  export default InputNumber;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const n=require("../_virtual/jsx-runtime.js"),l=require("react"),me=require("rc-input-number"),fe=require("../node_modules/@para-ui/icons/Up/index.js"),pe=require("../node_modules/@para-ui/icons/Down/index.js"),be=require("../Label/index.js"),je=require("../HelperText/index.js"),T=require("../Tooltip/index.js"),s=require("../GlobalContext/constant.js");;/* empty css */const z=i=>{const{className:q,style:U,step:h=1,min:o,max:u,size:g="large",placeholder:B="",label:x,labelTooltip:m,labelMode:R="outside",labelSign:a,btnMode:v="tb",disabled:d=!1,disabledTooltip:F,disabledTooltipAdd:G,disabledTooltipReduce:J,readOnly:f=!1,disabledAdd:M=!1,disabledReduce:P=!1,required:p=!1,error:V=!1,hideErrorDom:K,helperText:Q="",keyboard:W=!0,autoFocus:X=!1,formatter:Y,parser:Z,value:b,onChange:k,onEnter:ee,onBlur:S,onFocus:w,addonBefore:C,addonAfter:E,...ne}=i,[_,A]=l.useState(!1),[$,N]=l.useState(),D=l.useRef(null);l.useEffect(()=>{i.defaultValue!==void 0&&N(i.defaultValue)},[]),l.useEffect(()=>{b!==void 0&&N(b)},[b]);const I=()=>i.value===void 0?$:b,te=()=>{if(d||f)return;D?.current?.focus()},se=e=>{A(!0),w&&w(e)},re=e=>{A(!1),S&&S(e)},L=(e,...r)=>{const t=Math.pow(10,12),c=r.map(xe=>Math.round(xe*t)).reduce(e)/t;return parseFloat(c.toFixed(12))},O=e=>()=>{if(e==="add"&&(d||M||f)||e==="reduce"&&(d||P||f))return;const r=$===void 0?0:Number($);let t;if(e==="add"){if(u!==void 0&&r>=u)return;t=L((j,c)=>j+c,r,h),u!==void 0&&t>u&&(t=u)}else{if(o!==void 0&&r<=o)return;t=L((j,c)=>j-c,r,h),o!==void 0&&t<o&&(t=o)}y(t)},y=e=>{i.value===void 0&&N(e),k&&k(e)},ie=l.useMemo(()=>{if(R==="outside"&&!!(p||a||x)){const r=()=>{let t="input-number-label";return m&&m.className&&(t+=` ${m.className}`),t};return n.jsxRuntimeExports.jsx(be.default,{label:x,required:p,labelSign:a,...m,className:r()})}},[R,x,a,p]),oe=()=>{const e=I();if(_||e!=null)return;const r=()=>R==="outside"?B:n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[x||B,p&&n.jsxRuntimeExports.jsx("span",{className:"input-number-required",children:"*"}),a&&n.jsxRuntimeExports.jsx("span",{children:a})]});return n.jsxRuntimeExports.jsx("span",{className:"input-number-label-placeholder",onClick:te,children:r()})},ue=()=>{if(E)return n.jsxRuntimeExports.jsx("div",{className:"input-number-content-after",children:E})},le=()=>{if(C)return n.jsxRuntimeExports.jsx("div",{className:"input-number-content-before",children:C})},ae=()=>v==="none"?null:n.jsxRuntimeExports.jsxs("div",{className:"input-number-btn",children:[n.jsxRuntimeExports.jsx(T.Tooltip,{disabled:!0,placement:"top-end",...G,children:n.jsxRuntimeExports.jsx("span",{className:"tb-btn-top",onClick:O("add"),children:n.jsxRuntimeExports.jsx(fe.Up,{})})}),n.jsxRuntimeExports.jsx(T.Tooltip,{disabled:!0,placement:"bottom-end",...J,children:n.jsxRuntimeExports.jsx("span",{className:"tb-btn-bottom",onClick:O("reduce"),children:n.jsxRuntimeExports.jsx(pe.Down,{})})})]}),H=()=>n.jsxRuntimeExports.jsxs("div",{className:"input-number-content",children:[le(),n.jsxRuntimeExports.jsxs("div",{className:"input-number-content-within",children:[n.jsxRuntimeExports.jsx(me,{ref:D,step:h,min:o,max:u,keyboard:W,disabled:d,value:I()??void 0,defaultValue:i.defaultValue===null?void 0:i.defaultValue,autoFocus:X,readOnly:f,formatter:Y,parser:Z,prefixCls:s.$rcPrefixCls,onChange:y,onFocus:se,onBlur:re,onPressEnter:ee,...ne}),oe()]}),ue(),ae()]}),de=()=>F?n.jsxRuntimeExports.jsx(T.Tooltip,{disabled:!0,...F,children:H()}):H(),ce=()=>{let e=`${s.$prefixCls}-input-number `;return q&&(e+=` ${q}`),g&&(e+=` ${s.$prefixCls}-input-number-${g}`),v&&(e+=` ${s.$prefixCls}-input-number-${v==="none"?"none":"tb"}`),_&&(e+=` ${s.$prefixCls}-input-number-focus`),d&&(e+=` ${s.$prefixCls}-input-number-disabled`),M&&(e+=` ${s.$prefixCls}-input-number-disabled-add`),P&&(e+=` ${s.$prefixCls}-input-number-disabled-reduce`),V&&(e+=` ${s.$prefixCls}-input-number-error`),E&&(e+=` ${s.$prefixCls}-input-number-after`),C&&(e+=` ${s.$prefixCls}-input-number-before`),e};return n.jsxRuntimeExports.jsxs("div",{className:ce(),style:U,children:[ie,de(),n.jsxRuntimeExports.jsx(je.default,{className:"input-number-error-text",error:V,helperText:Q,hideErrorDom:K})]})};exports.InputNumber=z;exports.default=z;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const n=require("../_virtual/jsx-runtime.js"),i=require("react"),pe=require("rc-input-number"),be=require("../node_modules/@para-ui/icons/Up/index.js"),je=require("../node_modules/@para-ui/icons/Down/index.js"),he=require("../Label/index.js"),ve=require("../HelperText/index.js"),q=require("../Tooltip/index.js"),u=require("../GlobalContext/constant.js");;/* empty css */function G(s){const{className:g,style:J,step:R=1,min:o,max:l,size:B="large",placeholder:F="",label:p,labelTooltip:b,labelMode:C="outside",labelSign:d,btnMode:E="tb",disabled:c=!1,disabledTooltip:M,disabledTooltipAdd:K,disabledTooltipReduce:Q,readOnly:j=!1,disabledAdd:P=!1,disabledReduce:S=!1,required:h=!1,error:k=!1,hideErrorDom:W,helperText:X="",keyboard:Y=!0,autoFocus:Z=!1,formatter:ee,parser:ne,value:a,clearable:w=!1,onChange:_,onEnter:te,onBlur:A,onFocus:D,addonBefore:$,addonAfter:N,...re}=s,[I,L]=i.useState(!1),[T,f]=i.useState(),V=i.useRef(null),m=i.useRef(void 0);i.useEffect(()=>{s.defaultValue!==void 0&&s.defaultValue!==null?(f(s.defaultValue),m.current=s.defaultValue):s.defaultValue!==void 0&&f(s.defaultValue)},[]),i.useEffect(()=>{a!==void 0&&(f(a),a!==null&&(m.current=a))},[a]);const O=()=>s.value===void 0?T:a,se=()=>{if(c||j)return;V?.current?.focus()},ue=e=>{L(!0),D&&D(e)},ie=e=>{if(L(!1),!w){const r=V.current;if(r&&r.value===""&&m.current!==void 0){const t=m.current;s.value===void 0?f(t):r.value=String(t)}}A&&A(e)},y=(e,...r)=>{const t=Math.pow(10,12),x=r.map(xe=>Math.round(xe*t)).reduce(e)/t;return parseFloat(x.toFixed(12))},H=e=>()=>{if(e==="add"&&(c||P||j)||e==="reduce"&&(c||S||j))return;const r=T===void 0?0:Number(T);let t;if(e==="add"){if(l!==void 0&&r>=l)return;t=y((v,x)=>v+x,r,R),l!==void 0&&t>l&&(t=l)}else{if(o!==void 0&&r<=o)return;t=y((v,x)=>v-x,r,R),o!==void 0&&t<o&&(t=o)}z(t)},z=e=>{!w&&e===null||(e!=null&&(m.current=e),s.value===void 0&&f(e),_&&_(e))},oe=i.useMemo(()=>{if(C==="outside"&&!!(h||d||p)){const r=()=>{let t="input-number-label";return b&&b.className&&(t+=` ${b.className}`),t};return n.jsxRuntimeExports.jsx(he.default,{label:p,required:h,labelSign:d,...b,className:r()})}},[C,p,d,h]),le=()=>{const e=O();if(I||e!=null)return;const r=()=>C==="outside"?F:n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[p||F,h&&n.jsxRuntimeExports.jsx("span",{className:"input-number-required",children:"*"}),d&&n.jsxRuntimeExports.jsx("span",{children:d})]});return n.jsxRuntimeExports.jsx("span",{className:"input-number-label-placeholder",onClick:se,children:r()})},ae=()=>{if(N)return n.jsxRuntimeExports.jsx("div",{className:"input-number-content-after",children:N})},de=()=>{if($)return n.jsxRuntimeExports.jsx("div",{className:"input-number-content-before",children:$})},ce=()=>E==="none"?null:n.jsxRuntimeExports.jsxs("div",{className:"input-number-btn",children:[n.jsxRuntimeExports.jsx(q.Tooltip,{disabled:!0,placement:"top-end",...K,children:n.jsxRuntimeExports.jsx("span",{className:"tb-btn-top",onClick:H("add"),children:n.jsxRuntimeExports.jsx(be.Up,{})})}),n.jsxRuntimeExports.jsx(q.Tooltip,{disabled:!0,placement:"bottom-end",...Q,children:n.jsxRuntimeExports.jsx("span",{className:"tb-btn-bottom",onClick:H("reduce"),children:n.jsxRuntimeExports.jsx(je.Down,{})})})]}),U=()=>n.jsxRuntimeExports.jsxs("div",{className:"input-number-content",children:[de(),n.jsxRuntimeExports.jsxs("div",{className:"input-number-content-within",children:[n.jsxRuntimeExports.jsx(pe,{ref:V,step:R,min:o,max:l,keyboard:Y,disabled:c,value:O()??void 0,defaultValue:s.defaultValue===null?void 0:s.defaultValue,autoFocus:Z,readOnly:j,formatter:ee,parser:ne,prefixCls:u.$rcPrefixCls,onChange:z,onFocus:ue,onBlur:ie,onPressEnter:te,...re}),le()]}),ae(),ce()]}),fe=()=>M?n.jsxRuntimeExports.jsx(q.Tooltip,{disabled:!0,...M,children:U()}):U(),me=()=>{let e=`${u.$prefixCls}-input-number `;return g&&(e+=` ${g}`),B&&(e+=` ${u.$prefixCls}-input-number-${B}`),E&&(e+=` ${u.$prefixCls}-input-number-${E==="none"?"none":"tb"}`),I&&(e+=` ${u.$prefixCls}-input-number-focus`),c&&(e+=` ${u.$prefixCls}-input-number-disabled`),P&&(e+=` ${u.$prefixCls}-input-number-disabled-add`),S&&(e+=` ${u.$prefixCls}-input-number-disabled-reduce`),k&&(e+=` ${u.$prefixCls}-input-number-error`),N&&(e+=` ${u.$prefixCls}-input-number-after`),$&&(e+=` ${u.$prefixCls}-input-number-before`),e};return n.jsxRuntimeExports.jsxs("div",{className:me(),style:J,children:[oe,fe(),n.jsxRuntimeExports.jsx(ve.default,{className:"input-number-error-text",error:k,helperText:X,hideErrorDom:W})]})}exports.InputNumber=G;exports.default=G;
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,126 @@
1
+ {
2
+ "name": "Label",
3
+ "category": "Data Display",
4
+ "description": "表单标签,显示字段标题,支持必填红星、帮助提示(icon 或下划线两种样式)、自定义标题后缀",
5
+ "semantic": {
6
+ "intent": [
7
+ "字段标题",
8
+ "表单标签"
9
+ ],
10
+ "useCases": [
11
+ "表单字段",
12
+ "配置项",
13
+ "详情展示"
14
+ ],
15
+ "riskLevel": "low"
16
+ },
17
+ "variants": {
18
+ "icon": {
19
+ "meaning": "tooltipType='icon' — label 后渲染问号图标,hover 显示 tooltip"
20
+ },
21
+ "line": {
22
+ "meaning": "tooltipType='line' — label 文字加下划线,hover 整个 label 显示 tooltip"
23
+ }
24
+ },
25
+ "states": [
26
+ "default",
27
+ "required"
28
+ ],
29
+ "idealProps": {
30
+ "label": {
31
+ "type": "ReactNode",
32
+ "description": "标题文案;可传字符串或 ReactNode;不传时只渲染必填红星/tooltip 区域"
33
+ },
34
+ "required": {
35
+ "type": "boolean",
36
+ "default": false,
37
+ "description": "是否必填;true 时在 label 后渲染 `<span class='label-required'>*</span>` 红星"
38
+ },
39
+ "tooltip": {
40
+ "type": "ReactNode",
41
+ "description": "帮助提示内容;tooltipType='icon' 时渲染 Help 图标;tooltipType='line' 时整个 label 加下划线触发。**不传时不渲染 tooltip 区域**"
42
+ },
43
+ "tooltipType": {
44
+ "type": "enum",
45
+ "values": [
46
+ "icon",
47
+ "line"
48
+ ],
49
+ "default": "icon",
50
+ "description": "提示类型:icon=问号图标(默认),line=label 文字下划线"
51
+ },
52
+ "tooltipIcon": {
53
+ "type": "ReactNode",
54
+ "description": "自定义 tooltip 触发图标(tooltipType='icon' 时生效);不传时使用 Help 组件默认问号图标"
55
+ },
56
+ "labelSign": {
57
+ "type": "ReactNode",
58
+ "description": "标题旁的次级标记,渲染在必填红星之后(如 '(可选)' '(Beta)' 等短文本)"
59
+ },
60
+ "placement": {
61
+ "type": "enum",
62
+ "values": ["top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end", "right", "right-start", "right-end"],
63
+ "default": "top-start",
64
+ "description": "tooltip 弹出方向(透传给底层 Help 组件)"
65
+ },
66
+ "arrow": {
67
+ "type": "boolean",
68
+ "default": true,
69
+ "description": "tooltip 箭头"
70
+ },
71
+ "onClick": {
72
+ "type": "(e: React.MouseEvent<HTMLLabelElement>) => void",
73
+ "description": "点击 label 元素时触发"
74
+ },
75
+ "className": {
76
+ "type": "string",
77
+ "description": "label 容器类名"
78
+ }
79
+ },
80
+ "do": [
81
+ "为每个表单字段提供清晰的 Label,文案简洁(< 10 字)",
82
+ "必填字段传 required={true} 显示红星",
83
+ "需要字段说明时用 tooltip prop + 选择合适的 tooltipType(icon 更常用,line 适合较长 label)"
84
+ ],
85
+ "dont": [
86
+ "Label 过长(> 15 字)——会撑宽表单布局,截断或换行",
87
+ "忽略 Label 的可访问性——for/htmlFor 关联逻辑由外层 FormItem 管理,Label 本身不自动关联"
88
+ ],
89
+ "events": {
90
+ "onClick": {
91
+ "signature": "(e: React.MouseEvent<HTMLLabelElement>) => void",
92
+ "asyncSupported": false,
93
+ "examples": [
94
+ "onClick={(e) => console.log('clicked', e.currentTarget.textContent)} — 点击 label 时触发",
95
+ "通常不需要监听 label click——表单字段聚焦由 <label for> 或 FormItem 关联处理",
96
+ "自定义行为:onClick={(e) => { e.preventDefault(); openHelperModal(); }} — 阻止默认并打开详细说明"
97
+ ],
98
+ "commonMistakes": [
99
+ "期望 onClick 触发对应输入框聚焦——Label 组件的 <label> 没有 htmlFor 属性,聚焦关联由外层 FormItem 控制",
100
+ "传 onClick 期望阻止 tooltip 弹出——onClick 和 tooltip(hover)是独立行为,onClick 不影响 Tooltip 的 hover 逻辑",
101
+ "期望 label text 点击和 tooltipIcon 点击都触发同一 onClick——tooltipIcon 的点击事件由 Help 组件内部处理(hover),不冒泡到 Label onClick"
102
+ ]
103
+ }
104
+ },
105
+ "typescriptPitfalls": [
106
+ {
107
+ "issue": "tooltip 类型是 ReactNode,但底层 Help 组件要求 NonNullable<ReactNode>,直接传可选字段可能报 TS2322",
108
+ "wrong": "const tip: ReactNode | undefined = getTooltip(); <Label tooltip={tip} /> // 若 tip 推断含 undefined 分支,Help 内部 title 报 TS2322",
109
+ "right": "const tip = getTooltip(); <Label tooltip={tip ?? ''} /> // 用空字符串兜底(空字符串不显示 Tooltip 弹层)"
110
+ },
111
+ {
112
+ "issue": "LabelProps 通过 extends LabelTooltipProps 继承了 [name: string]: any 索引签名,导致所有额外 prop 被 TS 接受但无效",
113
+ "wrong": "<Label label='姓名' onFocus={handler} /> // TS 不报错(索引签名兜底),但 onFocus 不会触发任何行为",
114
+ "right": "<Label label='姓名' onClick={handler} /> // 只用 LabelProps 实际声明的 onClick prop"
115
+ },
116
+ {
117
+ "issue": "labelSign 是 ReactNode,不会被 required 的 * 替换——两者独立渲染",
118
+ "wrong": "// 期望 required=true 时 labelSign 文本替换红星\n<Label required label='邮箱' labelSign='(必填)' /> // 实际渲染:邮箱 * (必填)——两者都显示",
119
+ "right": "// 只传 required 控制红星;labelSign 是额外后缀,不替换\n<Label required label='邮箱' /> // 只显示 邮箱 *"
120
+ }
121
+ ],
122
+ "mapping": {
123
+ "realComponent": "Label",
124
+ "adapter": null
125
+ }
126
+ }