@para-ui/core 5.0.0-beta.11 → 5.0.0-beta.13

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 (650) 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/FieldForm/component.json +196 -0
  36. package/Form/component.json +161 -0
  37. package/FormItem/component.json +171 -0
  38. package/FunctionModal/component.json +197 -0
  39. package/Help/component.json +118 -0
  40. package/HelperText/component.json +126 -0
  41. package/Image/component.json +165 -0
  42. package/InputCode/component.json +191 -0
  43. package/InputLang/component.json +205 -0
  44. package/InputNumber/component.json +162 -0
  45. package/Label/component.json +126 -0
  46. package/Loading/component.json +91 -0
  47. package/Menu/component.json +180 -0
  48. package/Message/component.json +246 -0
  49. package/Modal/component.json +277 -0
  50. package/MultiBox/component.json +216 -0
  51. package/Notification/component.json +184 -0
  52. package/OperateBtn/component.json +134 -0
  53. package/PageHeader/component.json +112 -0
  54. package/Pagination/component.json +181 -0
  55. package/PasswordRules/component.json +105 -0
  56. package/PopConfirm/component.json +227 -0
  57. package/PopMenu/component.json +131 -0
  58. package/Popover/component.json +165 -0
  59. package/Progress/component.json +161 -0
  60. package/Prompt/component.json +144 -0
  61. package/Querying/component.json +96 -0
  62. package/QuickReply/component.json +129 -0
  63. package/Radio/component.json +136 -0
  64. package/RadioGroup/component.json +149 -0
  65. package/RangeInput/component.json +198 -0
  66. package/Result/component.json +104 -0
  67. package/ScrollBar/component.json +115 -0
  68. package/Search/component.json +177 -0
  69. package/Select/component.json +244 -0
  70. package/SelectInput/component.json +184 -0
  71. package/Selector/component.json +203 -0
  72. package/SelectorPicker/component.json +179 -0
  73. package/SingleBox/component.json +151 -0
  74. package/Slider/component.json +181 -0
  75. package/SortBox/component.json +108 -0
  76. package/Status/component.json +104 -0
  77. package/Stepper/component.json +129 -0
  78. package/Switch/component.json +207 -0
  79. package/Table/component.json +547 -0
  80. package/Tabs/component.json +227 -0
  81. package/Tag/component.json +221 -0
  82. package/TextEditor/component.json +186 -0
  83. package/TextField/component.json +290 -0
  84. package/TimePicker/component.json +176 -0
  85. package/Timeline/component.json +110 -0
  86. package/Title/component.json +156 -0
  87. package/ToggleButton/component.json +153 -0
  88. package/Tooltip/component.json +176 -0
  89. package/Transfer/component.json +157 -0
  90. package/Tree/component.json +512 -0
  91. package/Upload/component.json +450 -0
  92. package/ai-workflows/01-crud-list-multi-drawer.md +278 -0
  93. package/ai-workflows/02-rbac-operation-buttons.md +290 -0
  94. package/ai-workflows/03-complex-form-async-cascade.md +350 -0
  95. package/ai-workflows/04-array-field-form.md +281 -0
  96. package/ai-workflows/05-popconfirm-async-message-queue.md +333 -0
  97. package/ai-workflows/06-modal-drawer-form-workflow.md +385 -0
  98. package/ai-workflows/07-search-filter-table-trio.md +387 -0
  99. package/ai-workflows/08-table-advanced-features.md +365 -0
  100. package/ai-workflows/09-batch-operation-export-progress.md +367 -0
  101. package/ai-workflows/10-cross-component-state-coordination.md +412 -0
  102. package/es/AlignBox/component.json +89 -0
  103. package/es/AlignBox/index.css +1 -1
  104. package/es/AlignBox/index.d.ts +6 -2
  105. package/es/AlignBox/index.js +1 -1
  106. package/es/AlignBox/style/index.css +1 -1
  107. package/es/Anchor/anchorMenu/index.d.ts +2 -1
  108. package/es/Anchor/anchorMenu/index.js +36 -33
  109. package/es/Anchor/component.json +130 -0
  110. package/es/Anchor/index.js +52 -49
  111. package/es/Anchor/type.d.ts +8 -4
  112. package/es/Argv/component.json +216 -0
  113. package/es/Argv/dataGenerator/index.js +1 -1
  114. package/es/Argv/index.d.ts +5 -6
  115. package/es/Argv/index.js +1 -1
  116. package/es/AutoBox/component.json +133 -0
  117. package/es/AutoBox/index.d.ts +3 -3
  118. package/es/AutoBox/index.js +1 -1
  119. package/es/AutoBox/protal.d.ts +2 -2
  120. package/es/AutoBox/protal.js +33 -30
  121. package/es/AutoButton/component.json +109 -0
  122. package/es/AutoButton/index.js +1 -1
  123. package/es/AutoTips/autoTipsMultiline/index.d.ts +1 -1
  124. package/es/AutoTips/autoTipsMultiline/index.js +1 -1
  125. package/es/AutoTips/component.json +121 -0
  126. package/es/AutoTips/index.js +1 -1
  127. package/es/Badge/component.json +92 -0
  128. package/es/Breadcrumbs/component.json +142 -0
  129. package/es/Breadcrumbs/index.js +1 -1
  130. package/es/Button/SplitButton.d.ts +2 -2
  131. package/es/Button/component.json +168 -0
  132. package/es/Button/index.js +44 -44
  133. package/es/ButtonGroup/component.json +132 -0
  134. package/es/ButtonGroup/index.d.ts +1 -1
  135. package/es/Card/component.json +162 -0
  136. package/es/Card/index.d.ts +2 -2
  137. package/es/Card/index.js +2 -2
  138. package/es/Carousel/component.json +142 -0
  139. package/es/Carousel/index.d.ts +1 -1
  140. package/es/Cascader/Cascader.js +1 -1
  141. package/es/Cascader/OptionList/Column.js +1 -1
  142. package/es/Cascader/OptionList/index.js +1 -1
  143. package/es/Cascader/component.json +196 -0
  144. package/es/Cascader/hooks/useEntities.js +7 -7
  145. package/es/Cascader/interface.d.ts +1 -0
  146. package/es/Cascader/utils/commonUtil.d.ts +1 -1
  147. package/es/Cascader/utils/commonUtil.js +16 -16
  148. package/es/Cascader/utils/treeUtil.d.ts +14 -5
  149. package/es/Cascader/utils/treeUtil.js +1 -1
  150. package/es/Checkbox/component.json +138 -0
  151. package/es/CheckboxGroup/component.json +152 -0
  152. package/es/CheckboxGroup/index.js +1 -1
  153. package/es/CodeEditor/component.json +189 -0
  154. package/es/CodeEditor/index.d.ts +11 -10
  155. package/es/CodeEditor/index.js +19 -19
  156. package/es/Collapse/component.json +166 -0
  157. package/es/Collapse/index.d.ts +1 -1
  158. package/es/Collapse/index.js +23 -22
  159. package/es/CollapseBox/component.json +84 -0
  160. package/es/CollapseLayout/component.json +155 -0
  161. package/es/ColorPicker/component.json +142 -0
  162. package/es/ComboSelect/component.json +181 -0
  163. package/es/ComboSelect/index.js +115 -109
  164. package/es/ComboSelect/interface.d.ts +2 -2
  165. package/es/ComboSelect/utils.d.ts +3 -3
  166. package/es/ComboSelect/utils.js +1 -1
  167. package/es/Container/component.json +111 -0
  168. package/es/ContentBox/component.json +81 -0
  169. package/es/CopyText/component.json +118 -0
  170. package/es/CycleSelector/component.json +98 -0
  171. package/es/CycleSelector/index.js +14 -13
  172. package/es/DatePicker/component.json +192 -0
  173. package/es/DatePicker/generatePicker/generateRangePicker.js +11 -11
  174. package/es/DatePicker/generatePicker/generateSinglePicker.js +2 -2
  175. package/es/Descriptions/component.json +142 -0
  176. package/es/Descriptions/index.d.ts +1 -1
  177. package/es/Desktop/component.json +171 -0
  178. package/es/Desktop/index.js +1 -1
  179. package/es/DragVerify/component.json +114 -0
  180. package/es/DragVerify/index.js +19 -19
  181. package/es/Drawer/component.json +200 -0
  182. package/es/Drawer/index.js +86 -86
  183. package/es/Drawer/interface.d.ts +1 -1
  184. package/es/Drawer/util.d.ts +1 -6
  185. package/es/Drawer/util.js +9 -6
  186. package/es/Dropdown/component.json +147 -0
  187. package/es/Dropdown/index.js +1 -1
  188. package/es/DynamicMultiBox/component.json +278 -0
  189. package/es/DynamicMultiBox/formItem.d.ts +1 -1
  190. package/es/DynamicMultiBox/index.js +1 -1
  191. package/es/DynamicMultiBox/rowForm.d.ts +2 -2
  192. package/es/Empty/component.json +123 -0
  193. package/es/Empty/index.css +1 -1
  194. package/es/Empty/index.d.ts +2 -2
  195. package/es/Empty/index.js +27 -26
  196. package/es/Empty/style/index.css +1 -1
  197. package/es/FieldForm/FieldFormItem/ItemHolder.js +1 -1
  198. package/es/FieldForm/FieldFormItem/MemoInput.d.ts +2 -2
  199. package/es/FieldForm/FieldFormItem/StatusProvider.js +1 -1
  200. package/es/FieldForm/FieldFormItem/index.d.ts +6 -6
  201. package/es/FieldForm/Form.d.ts +2 -2
  202. package/es/FieldForm/Form.js +1 -1
  203. package/es/FieldForm/FormItemInput.js +1 -1
  204. package/es/FieldForm/FormItemLabel.js +1 -1
  205. package/es/FieldForm/FormList.d.ts +2 -2
  206. package/es/FieldForm/component.json +196 -0
  207. package/es/FieldForm/context.d.ts +5 -1
  208. package/es/FieldForm/context.js +2 -2
  209. package/es/FieldForm/hooks/useForm.d.ts +4 -3
  210. package/es/FieldForm/hooks/useFormInstance.d.ts +1 -1
  211. package/es/FieldForm/hooks/useFormItemStatus.d.ts +9 -5
  212. package/es/FieldForm/hooks/useFormItemStatus.js +2 -2
  213. package/es/FieldForm/hooks/useItemRef.d.ts +1 -1
  214. package/es/FieldForm/hooks/useItemRef.js +6 -6
  215. package/es/Form/component.json +161 -0
  216. package/es/Form/index.d.ts +52 -49
  217. package/es/Form/index.js +1 -1
  218. package/es/FormItem/compoments/defaultCompoments/index.d.ts +5 -5
  219. package/es/FormItem/compoments/defaultCompoments/index.js +12 -11
  220. package/es/FormItem/compoments/formCheckboxGroup/index.d.ts +2 -2
  221. package/es/FormItem/compoments/formFile/index.js +8 -8
  222. package/es/FormItem/compoments/formRadioGroup/index.d.ts +1 -1
  223. package/es/FormItem/compoments/formSelect/index.d.ts +1 -1
  224. package/es/FormItem/component.json +171 -0
  225. package/es/FormItem/index.d.ts +5 -5
  226. package/es/FormItem/index.js +23 -23
  227. package/es/FormItem/itemType.js +1 -1
  228. package/es/FunctionModal/component.json +197 -0
  229. package/es/FunctionModal/dialog.d.ts +1 -1
  230. package/es/FunctionModal/modalContext.d.ts +4 -1
  231. package/es/GlobalContext/confirmLocale.js +1 -1
  232. package/es/GlobalContext/index.js +1 -1
  233. package/es/Help/component.json +118 -0
  234. package/es/HelperText/component.json +126 -0
  235. package/es/Image/PreviewGroup.js +1 -1
  236. package/es/Image/component.json +165 -0
  237. package/es/Image/index.js +1 -1
  238. package/es/InputCode/component.json +191 -0
  239. package/es/InputCode/index.d.ts +2 -2
  240. package/es/InputLang/component.json +205 -0
  241. package/es/InputLang/index.js +2 -2
  242. package/es/InputNumber/component.json +162 -0
  243. package/es/Label/component.json +126 -0
  244. package/es/Label/index.d.ts +2 -2
  245. package/es/Loading/component.json +91 -0
  246. package/es/Menu/component.json +180 -0
  247. package/es/Menu/verticalMenuList.js +1 -1
  248. package/es/Message/component.json +246 -0
  249. package/es/Message/index.d.ts +2 -2
  250. package/es/Message/index.js +2 -2
  251. package/es/Modal/Confirm/index.d.ts +1 -1
  252. package/es/Modal/Confirm/index.js +1 -1
  253. package/es/Modal/component.json +277 -0
  254. package/es/Modal/index.d.ts +85 -5
  255. package/es/Modal/index.js +159 -122
  256. package/es/Modal/interface.d.ts +1 -0
  257. package/es/MultiBox/component.json +216 -0
  258. package/es/MultiBox/index.js +19 -14
  259. package/es/Notification/component.json +184 -0
  260. package/es/OperateBtn/component.json +134 -0
  261. package/es/OperateBtn/index.d.ts +3 -3
  262. package/es/PageHeader/component.json +112 -0
  263. package/es/PageHeader/horizontalMeun.js +1 -1
  264. package/es/PageHeader/horizontalMeunRight.js +1 -1
  265. package/es/Pagination/component.json +181 -0
  266. package/es/Pagination/index.js +15 -15
  267. package/es/ParauiProvider/index.js +1 -1
  268. package/es/PasswordRules/component.json +105 -0
  269. package/es/PasswordRules/index.d.ts +4 -4
  270. package/es/PopConfirm/component.json +227 -0
  271. package/es/PopConfirm/index.d.ts +1 -1
  272. package/es/PopConfirm/index.js +1 -1
  273. package/es/PopMenu/component.json +131 -0
  274. package/es/PopMenu/hooks.d.ts +1 -1
  275. package/es/PopMenu/index.js +8 -8
  276. package/es/Popover/component.json +165 -0
  277. package/es/Popover/index.js +1 -1
  278. package/es/Progress/component.json +161 -0
  279. package/es/Prompt/component.json +144 -0
  280. package/es/Querying/component.json +96 -0
  281. package/es/Querying/index.css +1 -1
  282. package/es/Querying/index.d.ts +2 -2
  283. package/es/Querying/index.js +20 -19
  284. package/es/Querying/style/index.css +1 -1
  285. package/es/QuickReply/QuickReplyCode/index.js +1 -1
  286. package/es/QuickReply/component.json +129 -0
  287. package/es/QuickReply/index.d.ts +1 -1
  288. package/es/Radio/component.json +136 -0
  289. package/es/RadioGroup/component.json +149 -0
  290. package/es/RangeInput/component.json +198 -0
  291. package/es/RangeInput/index.js +20 -20
  292. package/es/Result/component.json +104 -0
  293. package/es/ScrollBar/component.json +115 -0
  294. package/es/Search/component.json +177 -0
  295. package/es/Search/index.d.ts +1 -1
  296. package/es/Select/component.json +244 -0
  297. package/es/Select/index.js +114 -114
  298. package/es/SelectInput/component.json +184 -0
  299. package/es/Selector/component.json +203 -0
  300. package/es/Selector/index.js +56 -50
  301. package/es/Selector/interface.d.ts +2 -2
  302. package/es/Selector/selectorData/index.js +1 -1
  303. package/es/Selector/selectorMain/index.js +3 -3
  304. package/es/Selector/selectorNode/index.js +1 -1
  305. package/es/Selector/util.d.ts +3 -3
  306. package/es/Selector/util.js +6 -12
  307. package/es/SelectorPicker/component.json +179 -0
  308. package/es/SelectorPicker/index.d.ts +5 -5
  309. package/es/SelectorPicker/index.js +15 -15
  310. package/es/SingleBox/component.json +151 -0
  311. package/es/SingleBox/index.d.ts +2 -2
  312. package/es/Slider/component.json +181 -0
  313. package/es/SortBox/component.json +108 -0
  314. package/es/Status/component.json +104 -0
  315. package/es/Stepper/component.json +129 -0
  316. package/es/Stepper/index.d.ts +2 -2
  317. package/es/Switch/component.json +207 -0
  318. package/es/Switch/index.css +1 -1
  319. package/es/Switch/index.d.ts +3 -2
  320. package/es/Switch/index.js +60 -59
  321. package/es/Switch/style/index.css +1 -1
  322. package/es/Table/component.json +547 -0
  323. package/es/Table/index.d.ts +2 -2
  324. package/es/Table/index.js +385 -382
  325. package/es/Table/interface.d.ts +30 -0
  326. package/es/Table/tableHead.js +1 -1
  327. package/es/Table/util.d.ts +1 -1
  328. package/es/Table/util.js +3 -12
  329. package/es/Tabs/component.json +227 -0
  330. package/es/Tag/component.json +221 -0
  331. package/es/Tag/index.css +1 -1
  332. package/es/Tag/index.d.ts +1 -1
  333. package/es/Tag/index.js +20 -20
  334. package/es/Tag/style/index.css +1 -1
  335. package/es/TextEditor/component.json +186 -0
  336. package/es/TextEditor/index.d.ts +5 -5
  337. package/es/TextEditor/index.js +1 -1
  338. package/es/TextField/component.json +290 -0
  339. package/es/TextField/index.d.ts +2 -2
  340. package/es/TextField/index.js +1 -1
  341. package/es/TimePicker/component.json +176 -0
  342. package/es/Timeline/component.json +110 -0
  343. package/es/Title/component.json +156 -0
  344. package/es/ToggleButton/component.json +153 -0
  345. package/es/ToggleButton/index.js +1 -1
  346. package/es/Tooltip/component.json +176 -0
  347. package/es/Tooltip/index.js +58 -53
  348. package/es/Tooltip/interface.d.ts +14 -1
  349. package/es/Tooltip/utils.js +6 -6
  350. package/es/Transfer/component.json +157 -0
  351. package/es/Tree/OperateBar/index.js +1 -1
  352. package/es/Tree/Tree.js +3 -3
  353. package/es/Tree/component.json +512 -0
  354. package/es/Tree/interface.d.ts +1 -1
  355. package/es/Upload/component.json +450 -0
  356. package/es/Upload/util.js +1 -1
  357. package/es/Utils/snack-kit-shims.d.ts +18 -0
  358. package/es/Utils/snack-kit-shims.js +19 -0
  359. package/es/Utils/type.d.ts +0 -2
  360. package/es/_virtual/index.js +5 -3
  361. package/es/_virtual/index2.js +2 -5
  362. package/es/index.d.ts +2 -0
  363. package/es/index.js +1 -1
  364. package/es/locale/en_US.d.ts +361 -0
  365. package/es/locale/en_US.js +364 -0
  366. package/es/locale/index.d.ts +1 -723
  367. package/es/locale/index2.js +10 -0
  368. package/es/locale/zh_CN.d.ts +361 -0
  369. package/es/locale/zh_CN.js +364 -0
  370. package/es/node_modules/classnames/index.js +1 -1
  371. package/lib/AlignBox/component.json +89 -0
  372. package/lib/AlignBox/index.css +1 -1
  373. package/lib/AlignBox/index.d.ts +6 -2
  374. package/lib/AlignBox/index.js +1 -1
  375. package/lib/AlignBox/style/index.css +1 -1
  376. package/lib/Anchor/anchorMenu/index.d.ts +2 -1
  377. package/lib/Anchor/anchorMenu/index.js +1 -1
  378. package/lib/Anchor/component.json +130 -0
  379. package/lib/Anchor/index.js +1 -1
  380. package/lib/Anchor/type.d.ts +8 -4
  381. package/lib/Argv/component.json +216 -0
  382. package/lib/Argv/dataGenerator/index.js +1 -1
  383. package/lib/Argv/index.d.ts +5 -6
  384. package/lib/Argv/index.js +1 -1
  385. package/lib/AutoBox/component.json +133 -0
  386. package/lib/AutoBox/index.d.ts +3 -3
  387. package/lib/AutoBox/index.js +1 -1
  388. package/lib/AutoBox/protal.d.ts +2 -2
  389. package/lib/AutoBox/protal.js +1 -1
  390. package/lib/AutoButton/component.json +109 -0
  391. package/lib/AutoButton/index.js +1 -1
  392. package/lib/AutoTips/autoTipsMultiline/index.d.ts +1 -1
  393. package/lib/AutoTips/autoTipsMultiline/index.js +1 -1
  394. package/lib/AutoTips/component.json +121 -0
  395. package/lib/AutoTips/index.js +1 -1
  396. package/lib/Badge/component.json +92 -0
  397. package/lib/Breadcrumbs/component.json +142 -0
  398. package/lib/Breadcrumbs/index.js +1 -1
  399. package/lib/Button/SplitButton.d.ts +2 -2
  400. package/lib/Button/component.json +168 -0
  401. package/lib/Button/index.js +1 -1
  402. package/lib/ButtonGroup/component.json +132 -0
  403. package/lib/ButtonGroup/index.d.ts +1 -1
  404. package/lib/Card/component.json +162 -0
  405. package/lib/Card/index.d.ts +2 -2
  406. package/lib/Card/index.js +1 -1
  407. package/lib/Carousel/component.json +142 -0
  408. package/lib/Carousel/index.d.ts +1 -1
  409. package/lib/Cascader/Cascader.js +1 -1
  410. package/lib/Cascader/OptionList/Column.js +1 -1
  411. package/lib/Cascader/OptionList/index.js +1 -1
  412. package/lib/Cascader/component.json +196 -0
  413. package/lib/Cascader/hooks/useEntities.js +1 -1
  414. package/lib/Cascader/interface.d.ts +1 -0
  415. package/lib/Cascader/utils/commonUtil.d.ts +1 -1
  416. package/lib/Cascader/utils/commonUtil.js +1 -1
  417. package/lib/Cascader/utils/treeUtil.d.ts +14 -5
  418. package/lib/Cascader/utils/treeUtil.js +1 -1
  419. package/lib/Checkbox/component.json +138 -0
  420. package/lib/CheckboxGroup/component.json +152 -0
  421. package/lib/CheckboxGroup/index.js +1 -1
  422. package/lib/CodeEditor/component.json +189 -0
  423. package/lib/CodeEditor/index.d.ts +11 -10
  424. package/lib/CodeEditor/index.js +1 -1
  425. package/lib/Collapse/component.json +166 -0
  426. package/lib/Collapse/index.d.ts +1 -1
  427. package/lib/Collapse/index.js +1 -1
  428. package/lib/CollapseBox/component.json +84 -0
  429. package/lib/CollapseLayout/component.json +155 -0
  430. package/lib/ColorPicker/component.json +142 -0
  431. package/lib/ComboSelect/component.json +181 -0
  432. package/lib/ComboSelect/index.js +1 -1
  433. package/lib/ComboSelect/interface.d.ts +2 -2
  434. package/lib/ComboSelect/utils.d.ts +3 -3
  435. package/lib/ComboSelect/utils.js +1 -1
  436. package/lib/Container/component.json +111 -0
  437. package/lib/ContentBox/component.json +81 -0
  438. package/lib/CopyText/component.json +118 -0
  439. package/lib/CycleSelector/component.json +98 -0
  440. package/lib/CycleSelector/index.js +1 -1
  441. package/lib/DatePicker/component.json +192 -0
  442. package/lib/DatePicker/generatePicker/generateRangePicker.js +1 -1
  443. package/lib/DatePicker/generatePicker/generateSinglePicker.js +1 -1
  444. package/lib/Descriptions/component.json +142 -0
  445. package/lib/Descriptions/index.d.ts +1 -1
  446. package/lib/Desktop/component.json +171 -0
  447. package/lib/Desktop/index.js +1 -1
  448. package/lib/DragVerify/component.json +114 -0
  449. package/lib/DragVerify/index.js +1 -1
  450. package/lib/Drawer/component.json +200 -0
  451. package/lib/Drawer/index.js +1 -1
  452. package/lib/Drawer/interface.d.ts +1 -1
  453. package/lib/Drawer/util.d.ts +1 -6
  454. package/lib/Drawer/util.js +1 -1
  455. package/lib/Dropdown/component.json +147 -0
  456. package/lib/Dropdown/index.js +1 -1
  457. package/lib/DynamicMultiBox/component.json +278 -0
  458. package/lib/DynamicMultiBox/formItem.d.ts +1 -1
  459. package/lib/DynamicMultiBox/index.js +1 -1
  460. package/lib/DynamicMultiBox/rowForm.d.ts +2 -2
  461. package/lib/Empty/component.json +123 -0
  462. package/lib/Empty/index.css +1 -1
  463. package/lib/Empty/index.d.ts +2 -2
  464. package/lib/Empty/index.js +1 -1
  465. package/lib/Empty/style/index.css +1 -1
  466. package/lib/FieldForm/FieldFormItem/ItemHolder.js +1 -1
  467. package/lib/FieldForm/FieldFormItem/MemoInput.d.ts +2 -2
  468. package/lib/FieldForm/FieldFormItem/StatusProvider.js +1 -1
  469. package/lib/FieldForm/FieldFormItem/index.d.ts +6 -6
  470. package/lib/FieldForm/Form.d.ts +2 -2
  471. package/lib/FieldForm/Form.js +1 -1
  472. package/lib/FieldForm/FormItemInput.js +1 -1
  473. package/lib/FieldForm/FormItemLabel.js +1 -1
  474. package/lib/FieldForm/FormList.d.ts +2 -2
  475. package/lib/FieldForm/component.json +196 -0
  476. package/lib/FieldForm/context.d.ts +5 -1
  477. package/lib/FieldForm/context.js +1 -1
  478. package/lib/FieldForm/hooks/useForm.d.ts +4 -3
  479. package/lib/FieldForm/hooks/useFormInstance.d.ts +1 -1
  480. package/lib/FieldForm/hooks/useFormItemStatus.d.ts +9 -5
  481. package/lib/FieldForm/hooks/useFormItemStatus.js +1 -1
  482. package/lib/FieldForm/hooks/useItemRef.d.ts +1 -1
  483. package/lib/FieldForm/hooks/useItemRef.js +1 -1
  484. package/lib/Form/component.json +161 -0
  485. package/lib/Form/index.d.ts +52 -49
  486. package/lib/Form/index.js +1 -1
  487. package/lib/FormItem/compoments/defaultCompoments/index.d.ts +5 -5
  488. package/lib/FormItem/compoments/defaultCompoments/index.js +1 -1
  489. package/lib/FormItem/compoments/formCheckboxGroup/index.d.ts +2 -2
  490. package/lib/FormItem/compoments/formFile/index.js +1 -1
  491. package/lib/FormItem/compoments/formRadioGroup/index.d.ts +1 -1
  492. package/lib/FormItem/compoments/formSelect/index.d.ts +1 -1
  493. package/lib/FormItem/component.json +171 -0
  494. package/lib/FormItem/index.d.ts +5 -5
  495. package/lib/FormItem/index.js +1 -1
  496. package/lib/FormItem/itemType.js +1 -1
  497. package/lib/FunctionModal/component.json +197 -0
  498. package/lib/FunctionModal/dialog.d.ts +1 -1
  499. package/lib/FunctionModal/modalContext.d.ts +4 -1
  500. package/lib/GlobalContext/confirmLocale.js +1 -1
  501. package/lib/GlobalContext/index.js +1 -1
  502. package/lib/Help/component.json +118 -0
  503. package/lib/HelperText/component.json +126 -0
  504. package/lib/Image/PreviewGroup.js +1 -1
  505. package/lib/Image/component.json +165 -0
  506. package/lib/Image/index.js +1 -1
  507. package/lib/InputCode/component.json +191 -0
  508. package/lib/InputCode/index.d.ts +2 -2
  509. package/lib/InputLang/component.json +205 -0
  510. package/lib/InputLang/index.js +1 -1
  511. package/lib/InputNumber/component.json +162 -0
  512. package/lib/Label/component.json +126 -0
  513. package/lib/Label/index.d.ts +2 -2
  514. package/lib/Loading/component.json +91 -0
  515. package/lib/Menu/component.json +180 -0
  516. package/lib/Menu/verticalMenuList.js +1 -1
  517. package/lib/Message/component.json +246 -0
  518. package/lib/Message/index.d.ts +2 -2
  519. package/lib/Message/index.js +1 -1
  520. package/lib/Modal/Confirm/index.d.ts +1 -1
  521. package/lib/Modal/Confirm/index.js +1 -1
  522. package/lib/Modal/component.json +277 -0
  523. package/lib/Modal/index.d.ts +85 -5
  524. package/lib/Modal/index.js +1 -1
  525. package/lib/Modal/interface.d.ts +1 -0
  526. package/lib/MultiBox/component.json +216 -0
  527. package/lib/MultiBox/index.js +1 -1
  528. package/lib/Notification/component.json +184 -0
  529. package/lib/OperateBtn/component.json +134 -0
  530. package/lib/OperateBtn/index.d.ts +3 -3
  531. package/lib/PageHeader/component.json +112 -0
  532. package/lib/PageHeader/horizontalMeun.js +1 -1
  533. package/lib/PageHeader/horizontalMeunRight.js +1 -1
  534. package/lib/Pagination/component.json +181 -0
  535. package/lib/Pagination/index.js +1 -1
  536. package/lib/ParauiProvider/index.js +1 -1
  537. package/lib/PasswordRules/component.json +105 -0
  538. package/lib/PasswordRules/index.d.ts +4 -4
  539. package/lib/PopConfirm/component.json +227 -0
  540. package/lib/PopConfirm/index.d.ts +1 -1
  541. package/lib/PopConfirm/index.js +1 -1
  542. package/lib/PopMenu/component.json +131 -0
  543. package/lib/PopMenu/hooks.d.ts +1 -1
  544. package/lib/PopMenu/index.js +1 -1
  545. package/lib/Popover/component.json +165 -0
  546. package/lib/Popover/index.js +1 -1
  547. package/lib/Progress/component.json +161 -0
  548. package/lib/Prompt/component.json +144 -0
  549. package/lib/Querying/component.json +96 -0
  550. package/lib/Querying/index.css +1 -1
  551. package/lib/Querying/index.d.ts +2 -2
  552. package/lib/Querying/index.js +1 -1
  553. package/lib/Querying/style/index.css +1 -1
  554. package/lib/QuickReply/QuickReplyCode/index.js +1 -1
  555. package/lib/QuickReply/component.json +129 -0
  556. package/lib/QuickReply/index.d.ts +1 -1
  557. package/lib/Radio/component.json +136 -0
  558. package/lib/RadioGroup/component.json +149 -0
  559. package/lib/RangeInput/component.json +198 -0
  560. package/lib/RangeInput/index.js +1 -1
  561. package/lib/Result/component.json +104 -0
  562. package/lib/ScrollBar/component.json +115 -0
  563. package/lib/Search/component.json +177 -0
  564. package/lib/Search/index.d.ts +1 -1
  565. package/lib/Select/component.json +244 -0
  566. package/lib/Select/index.js +1 -1
  567. package/lib/SelectInput/component.json +184 -0
  568. package/lib/Selector/component.json +203 -0
  569. package/lib/Selector/index.js +1 -1
  570. package/lib/Selector/interface.d.ts +2 -2
  571. package/lib/Selector/selectorData/index.js +1 -1
  572. package/lib/Selector/selectorMain/index.js +1 -1
  573. package/lib/Selector/selectorNode/index.js +1 -1
  574. package/lib/Selector/util.d.ts +3 -3
  575. package/lib/Selector/util.js +1 -1
  576. package/lib/SelectorPicker/component.json +179 -0
  577. package/lib/SelectorPicker/index.d.ts +5 -5
  578. package/lib/SelectorPicker/index.js +1 -1
  579. package/lib/SingleBox/component.json +151 -0
  580. package/lib/SingleBox/index.d.ts +2 -2
  581. package/lib/Slider/component.json +181 -0
  582. package/lib/SortBox/component.json +108 -0
  583. package/lib/Status/component.json +104 -0
  584. package/lib/Stepper/component.json +129 -0
  585. package/lib/Stepper/index.d.ts +2 -2
  586. package/lib/Switch/component.json +207 -0
  587. package/lib/Switch/index.css +1 -1
  588. package/lib/Switch/index.d.ts +3 -2
  589. package/lib/Switch/index.js +1 -1
  590. package/lib/Switch/style/index.css +1 -1
  591. package/lib/Table/component.json +547 -0
  592. package/lib/Table/index.d.ts +2 -2
  593. package/lib/Table/index.js +1 -1
  594. package/lib/Table/interface.d.ts +30 -0
  595. package/lib/Table/tableHead.js +1 -1
  596. package/lib/Table/util.d.ts +1 -1
  597. package/lib/Table/util.js +1 -1
  598. package/lib/Tabs/component.json +227 -0
  599. package/lib/Tag/component.json +221 -0
  600. package/lib/Tag/index.css +1 -1
  601. package/lib/Tag/index.d.ts +1 -1
  602. package/lib/Tag/index.js +1 -1
  603. package/lib/Tag/style/index.css +1 -1
  604. package/lib/TextEditor/component.json +186 -0
  605. package/lib/TextEditor/index.d.ts +5 -5
  606. package/lib/TextEditor/index.js +1 -1
  607. package/lib/TextField/component.json +290 -0
  608. package/lib/TextField/index.d.ts +2 -2
  609. package/lib/TextField/index.js +1 -1
  610. package/lib/TimePicker/component.json +176 -0
  611. package/lib/Timeline/component.json +110 -0
  612. package/lib/Title/component.json +156 -0
  613. package/lib/ToggleButton/component.json +153 -0
  614. package/lib/ToggleButton/index.js +1 -1
  615. package/lib/Tooltip/component.json +176 -0
  616. package/lib/Tooltip/index.js +1 -1
  617. package/lib/Tooltip/interface.d.ts +14 -1
  618. package/lib/Tooltip/utils.js +1 -1
  619. package/lib/Transfer/component.json +157 -0
  620. package/lib/Tree/OperateBar/index.js +2 -2
  621. package/lib/Tree/Tree.js +1 -1
  622. package/lib/Tree/component.json +512 -0
  623. package/lib/Tree/interface.d.ts +1 -1
  624. package/lib/Upload/component.json +450 -0
  625. package/lib/Upload/util.js +1 -1
  626. package/lib/Utils/snack-kit-shims.d.ts +18 -0
  627. package/lib/Utils/snack-kit-shims.js +2 -0
  628. package/lib/Utils/type.d.ts +0 -2
  629. package/lib/_virtual/index.js +1 -1
  630. package/lib/_virtual/index2.js +1 -1
  631. package/lib/index.d.ts +2 -0
  632. package/lib/index.js +1 -1
  633. package/lib/locale/en_US.d.ts +361 -0
  634. package/lib/locale/en_US.js +2 -0
  635. package/lib/locale/index.d.ts +1 -723
  636. package/lib/locale/index2.js +2 -0
  637. package/lib/locale/zh_CN.d.ts +361 -0
  638. package/lib/locale/zh_CN.js +2 -0
  639. package/lib/node_modules/classnames/index.js +1 -1
  640. package/package.json +11 -4
  641. package/es/_virtual/index3.js +0 -5
  642. package/es/_virtual/index4.js +0 -5
  643. package/es/node_modules/@para-snack/core/dist/index.js +0 -5231
  644. package/lib/_virtual/index3.js +0 -2
  645. package/lib/_virtual/index4.js +0 -2
  646. package/lib/node_modules/@para-snack/core/dist/index.js +0 -20
  647. /package/es/{Utils/Hooks → Hooks}/useResizeObserver.d.ts +0 -0
  648. /package/es/{Utils/Hooks → Hooks}/useResizeObserver.js +0 -0
  649. /package/lib/{Utils/Hooks → Hooks}/useResizeObserver.d.ts +0 -0
  650. /package/lib/{Utils/Hooks → Hooks}/useResizeObserver.js +0 -0
@@ -0,0 +1,171 @@
1
+ {
2
+ "name": "Desktop",
3
+ "category": "Layout",
4
+ "description": "桌面布局组件,支持拖拽排序的网格布局。**API 设计上有 3 个已知硬约束**(见 limitations):1) onClick/onSort 回调返回完整数组而非单项;2) icon 只接受 base64 string 不接受 ReactNode;3) 无 children / render prop 不支持任意内容渲染",
5
+ "semantic": {
6
+ "intent": [
7
+ "拖拽排序的应用网格",
8
+ "可自定义顺序的图标列表",
9
+ "持久化用户布局偏好"
10
+ ],
11
+ "useCases": [
12
+ "工作台(可拖拽的应用入口集合)",
13
+ "仪表盘首页(应用列表,需要内容用 base64 icon)",
14
+ "个性化首页(顺序持久化到 localStorage)"
15
+ ],
16
+ "riskLevel": "low"
17
+ },
18
+ "limitations": {
19
+ "L1_onClick_returns_full_array": {
20
+ "issue": "**onClick(data) 的 data 是完整 DesktopDataItem 数组,不是被点击的单个 item**。无法直接知道用户点的是第几项",
21
+ "rootCause": "src/Desktop/index.tsx:44 实证:click handler 传 `[...data]` 给外部",
22
+ "workaround": "在 data 项挂 _payload 扩展字段(如 _index / _app),配合 onSort 维护当前顺序的引用,在 onClick 内根据 e.target.closest('[data-key]') 或自维护的 currentClickedKey 反查 —— 但**Desktop 内部没有暴露 click 时的 key,只能改用 data[0] 假设是被点击项或外部加 React 事件代理**。**结构性限制,docs 救不了**",
23
+ "alternative": "**强烈建议**:如果业务需要识别点击项,改用 Container + Card 自行实现网格 + onClick,或者只用 Desktop 做'排序'功能,'打开应用'功能由 data 项上的 children 字段(若需嵌入按钮)在外层另起 UI"
24
+ },
25
+ "L2_icon_no_reactnode": {
26
+ "issue": "**icon 字段只接受 base64 string,不接受 React.ReactNode**(SVG 组件 / 图标组件等)",
27
+ "rootCause": "Desktop 内部用 `<img src={icon} />` 渲染,React.ReactNode 会触发 TypeScript 类型错误或运行时 ReactNode-as-string 错误",
28
+ "workaround": "**适配上层 AppItem.icon: ReactNode 接口的 3 种方式**:\n1. **改业务接口**(推荐):AppItem.icon 改成 `string | { reactNode: ReactNode }`,Desktop 只读 string 分支\n2. **运行时转换**:用 dom-to-image / html-to-image 把 ReactNode 渲染成 base64(performance 代价大)\n3. **降级**:typeof icon === 'string' 时透传,否则不传 icon 字段(显示无图标,只显示 name)\n\n业务方常踩坑写 `<Desktop data={[{key, name, icon: <Icon />}]} />` 直接传 ReactNode,会 tsc 报错",
29
+ "alternative": "需要任意 ReactNode 渲染:换用 Container + 自实现网格,或者 RcDraggable 类组件"
30
+ },
31
+ "L3_no_children_render": {
32
+ "issue": "**Desktop 不支持 children / render prop / itemRender 自定义格子内容**。每个格子只能渲染 icon (img) + name (text)",
33
+ "rootCause": "src/Desktop/index.tsx:33 - DesktopProps 无 children / renderItem / itemRender 等字段",
34
+ "workaround": "无 —— 这是结构性限制",
35
+ "alternative": "需要每格放 React 组件(如 Widget / Card / 按钮组):**不要用 Desktop**,改用 Container + 自己用 react-grid-layout / dnd-kit 实现拖拽网格"
36
+ }
37
+ },
38
+ "adaptationPatterns": {
39
+ "patternA_localStorageOrder": "**持久化排序到 localStorage**(主流场景):\n```ts\n// 1. 读初始顺序\nconst orderKey = 'myApp:desktopOrder';\nconst initialOrder: string[] = JSON.parse(localStorage.getItem(orderKey) || '[]');\n// 2. 按持久化顺序对业务数据排序\nconst orderedApps = useMemo(() => {\n if (!initialOrder.length) return apps;\n return [...apps].sort((a, b) => initialOrder.indexOf(a.id) - initialOrder.indexOf(b.id));\n}, [apps, initialOrder]);\n// 3. onSort 时只保存 key 序列,sort prop 保持 {}\nconst handleSort = (nextData) => {\n setApps(nextData.map(d => d._app));\n localStorage.setItem(orderKey, JSON.stringify(nextData.map(d => d.key)));\n};\n```\n**关键:sort prop 只在'恢复历史 sort 对象'场景才需要,正常持久化 key 序列就够**",
40
+ "patternB_clickIdentification": "**识别点击项 (workaround,有限可靠)**:\nDesktop 的 onClick(data) 不告诉你点了哪项,只能用 DOM 事件代理:\n```ts\n<div onClick={(e) => {\n const cell = (e.target as HTMLElement).closest('[data-id]');\n const id = cell?.getAttribute('data-id');\n if (id) handleAppClick(id);\n}}>\n <Desktop data={dataWithDataIdAttr} ... />\n</div>\n```\n或更**推荐:不依赖 Desktop.onClick,Desktop 只管排序,'打开应用'的点击行为另起方案**",
41
+ "patternC_reactNodeIcon": "**业务接口声明 icon: ReactNode 的衔接**:\n```ts\ninterface BusinessApp { id: string; name: string; icon: ReactNode; iconUrl?: string; }\n// 映射时只取 iconUrl(base64),不传 ReactNode\nconst desktopData = apps.map(app => ({\n key: app.id,\n name: app.name,\n icon: app.iconUrl // 只透传 string,ReactNode 不传\n}));\n```"
42
+ },
43
+ "variants": {
44
+ "default": {
45
+ "meaning": "默认样式"
46
+ }
47
+ },
48
+ "states": [
49
+ "default",
50
+ "dragging"
51
+ ],
52
+ "idealProps": {
53
+ "data": {
54
+ "type": "Array<DesktopDataItem>",
55
+ "required": true,
56
+ "description": "拖拽列表数据;DesktopDataItem 接口 src/Desktop/index.tsx:23 已 export,字段:key(string 必填 唯一)、name(string?)、disable(boolean?)、icon(string? base64,**不支持 React.ReactNode** —— 见 limitations.L2)、disabledTooltip(TooltipProps?)、可挂任意扩展字段(`[k]: string|boolean|number|...`,常用 _payload / _app 挂业务模型)"
57
+ },
58
+ "sort": {
59
+ "type": "{ [key: string]: mapProps[] }",
60
+ "description": "排序映射,**可选受控**;value 为内部 mapProps[](opaque),`interface mapProps` 未 export,**调用方不应手动构造**。**典型用法 1**:首次渲染传 `{}`,组件按 data 顺序推导默认排序(推荐,99% 场景)。**典型用法 2**:从 localStorage 反序列化某次 onSort 后保存的 sort 对象再透传(罕见,通常直接持久化 key 序列即可)。**onSort 回调后通常无需更新 sort prop** —— 组件会基于新 data 顺序自动重排"
61
+ },
62
+ "onSort": {
63
+ "type": "(data: Array<DesktopDataItem>) => void",
64
+ "signature": "(data: Array<DesktopDataItem>) => void",
65
+ "description": "排序变化回调;**⚠️ data 参数为【排序后的完整 DesktopDataItem 数组】,不是 sort 映射对象,也不是 diff**。src/Desktop/index.tsx:42 实证;持久化新顺序时:**推荐保存 data.map(d => d.key) 数组**(简单稳定),而不是 sort 对象(opaque + 易过期)"
66
+ },
67
+ "onClick": {
68
+ "type": "(data: Array<DesktopDataItem>) => void",
69
+ "signature": "(data: Array<DesktopDataItem>) => void",
70
+ "description": "点击回调;**⚠️ data 参数为【完整 DesktopDataItem 数组】,不是被点击的单个 item**(已知 API 限制,见 limitations.L1)。**workaround**:在 Desktop 外层 div 用 React 事件代理 + 自维护 data-id 属性(见 adaptationPatterns.patternB)。**或不用 onClick**——只用 Desktop 排序,'打开应用'另起方案"
71
+ },
72
+ "tipMaxWidth": {
73
+ "type": "number",
74
+ "description": "禁用项 Tooltip 的最大宽度(px);仅在 DesktopDataItem 设置了 disable=true + disabledTooltip 字段时生效"
75
+ }
76
+ },
77
+ "commonMisconceptions": {
78
+ "M1": {
79
+ "wrong": "把 onSort(data) 的 data 当成 sort 映射对象处理:`onSort: (sortObj) => setSort(sortObj)`",
80
+ "result": "**data 实际是数组**,setSort 收到数组而期望对象 → TS 类型错误 + sort prop 状态混乱",
81
+ "fix": "改成 `onSort: (nextData) => setData(nextData)` —— data 是【排序后的完整 DesktopDataItem 数组】。sort prop 通常不需要在 onSort 回调里更新,保持 {} 即可"
82
+ },
83
+ "M2": {
84
+ "wrong": "在 data 项的 icon 字段传 React.ReactNode: `<Desktop data={[{key, name, icon: <Icon />}]} />`",
85
+ "result": "**TS 报错**(icon: string 字段类型不匹配) 或 runtime 渲染 [object Object]",
86
+ "fix": "icon 必须是 base64 string。需要 SVG / 图标组件:**预先用工具转 base64**(`btoa` + SVG 字符串),或**不传 icon**(显示无图标,只显示 name)。见 adaptationPatterns.patternC"
87
+ },
88
+ "M3": {
89
+ "wrong": "期望 onClick(data) 的 data 就是被点击的单项: `onClick: (item) => openApp(item.key)`",
90
+ "result": "**item 实际是完整数组**,`item.key` 是 undefined,openApp(undefined) 触发空指针",
91
+ "fix": "Desktop **结构性不支持识别单项点击**(L1)。两种 workaround:1) 外层 div 事件代理 + data-id(patternB);2) 不依赖 Desktop.onClick,改用 Desktop 仅管排序,点击行为另起 UI"
92
+ },
93
+ "M4": {
94
+ "wrong": "期望 Desktop 接受 children / renderItem 自定义格子内容: `<Desktop>{apps.map(...)}</Desktop>` 或 `<Desktop renderItem={...} />`",
95
+ "result": "**DesktopProps 无 children / renderItem 字段**,传入被静默忽略,格子仍只渲染 icon + name",
96
+ "fix": "需要每格放 React 组件:**不要用 Desktop**,改 Container + react-grid-layout / dnd-kit"
97
+ },
98
+ "M5": {
99
+ "wrong": "手动构造 sort prop 的 mapProps[] 形态: `sort={{ 'group-1': [{type: 'app', key: 'a', index: 0, ...}] }}`",
100
+ "result": "mapProps 接口未 export,字段会变(opaque),手动构造容易引发不可预期的渲染状态",
101
+ "fix": "sort 只用两种值:`{}` (默认,组件按 data 顺序推导) 或 上次 onSort 后从 localStorage 反序列化的整个 sort 对象。**永远不手动写 sort 字面量**"
102
+ }
103
+ },
104
+ "do": [
105
+ "**默认用法**:`<Desktop data={data} sort={{}} onSort={setData} />`(sort 用空对象,Desktop 自动推导)",
106
+ "用户排序偏好:保存 `nextData.map(d => d.key)` 到 localStorage(而非 sort 对象,见 patternA)",
107
+ "业务模型挂在 data 项的扩展字段(`_app`, `_payload` 等),onSort 时 map(_app) 取回",
108
+ "上层接口 icon 是 ReactNode 时:映射时只取 string 字段(iconUrl / iconBase64),不传 ReactNode(patternC)",
109
+ "需要识别点击项:外层 div 事件代理 + data-id 自维护(patternB);或不用 Desktop.onClick"
110
+ ],
111
+ "dont": [
112
+ "**不要**把 onSort 的参数当 sort 对象处理——是数组(M1)",
113
+ "**不要**给 icon 传 React.ReactNode——只接受 base64 string(M2,L2)",
114
+ "**不要**期望 onClick 知道点的是哪一项——是数组(M3,L1)",
115
+ "**不要**用 children / renderItem 自定义格子——不存在(M4,L3)",
116
+ "**不要**手动构造 sort prop 的 mapProps 字面量——opaque(M5)",
117
+ "**不要**在每格需要嵌入任意 React 组件的场景使用 Desktop——换 Container + dnd-kit",
118
+ "拖拽项过多(>100)导致性能问题"
119
+ ],
120
+ "events": {
121
+ "onSort": {
122
+ "signature": "(data: Array<DesktopDataItem>) => void",
123
+ "asyncSupported": false,
124
+ "examples": [
125
+ "基本排序:<Desktop data={data} sort={{}} onSort={(nextData) => setData(nextData)} />",
126
+ "持久化排序:onSort={(nextData) => { setData(nextData); localStorage.setItem('order', JSON.stringify(nextData.map(d => d.key))); }}",
127
+ "onSort 的 data 参数是排序后的完整 DesktopDataItem 数组(不是 diff,不是 sort 映射对象)"
128
+ ],
129
+ "commonMistakes": [
130
+ "把 onSort(data) 的 data 当 sort 映射对象处理:setSort(data)——data 是数组,sort 期望 { [key]: mapProps[] }",
131
+ "期望 onSort 在初始化时触发——只有用户拖拽后才触发",
132
+ "持久化保存整个 data 数组(含业务 _payload 字段)——推荐只保存 data.map(d => d.key) 的 key 序列"
133
+ ]
134
+ },
135
+ "onClick": {
136
+ "signature": "(data: Array<DesktopDataItem>) => void",
137
+ "asyncSupported": false,
138
+ "examples": [
139
+ "注意:data 是完整数组,不是被点击的单项——识别点击项需要外层事件代理",
140
+ "外层事件代理识别点击项:通过 e.target.closest('[data-id]') 反查 id",
141
+ "若不需要识别单项:仅用 onClick 感知'有项被点击'的触发,具体 item 由 sort 顺序推断"
142
+ ],
143
+ "commonMistakes": [
144
+ "期望 onClick(item) 的 item 是被点击的单个 DesktopDataItem——实际是完整数组",
145
+ "item.key 是 undefined(因为 item 是数组):openApp(item.key) 触发空指针",
146
+ "期望通过 children/renderItem 自定义格子点击行为——Desktop 不支持 children/renderItem"
147
+ ]
148
+ }
149
+ },
150
+ "typescriptPitfalls": [
151
+ {
152
+ "issue": "icon 字段只接受 base64 string,传 ReactNode 会 TS 报错或运行时渲染 [object Object]",
153
+ "wrong": "data={[{ key: 'app1', name: '应用1', icon: <AppIcon /> }]} // TS 报错:icon: string 类型不匹配",
154
+ "right": "// icon 必须是 base64 字符串,ReactNode 图标需预先转 base64\ndata={[{ key: 'app1', name: '应用1', icon: 'data:image/png;base64,...' }]}"
155
+ },
156
+ {
157
+ "issue": "onSort/onClick 的参数 data 是完整数组,不是单个 item,类型声明也是 Array<DesktopDataItem>",
158
+ "wrong": "onClick={(item) => openApp(item.key)} // item 实际是数组,item.key 是 undefined",
159
+ "right": "// Desktop 不支持识别单项点击,只能用事件代理:\n<div onClick={(e) => { const id = (e.target as HTMLElement).closest('[data-id]')?.getAttribute('data-id'); }}>\n <Desktop ... />\n</div>"
160
+ },
161
+ {
162
+ "issue": "sort prop 的 mapProps[] 接口未 export,不能手动构造 sort 字面量",
163
+ "wrong": "sort={{ 'group-1': [{ type: 'app', key: 'a', index: 0 }] }} // mapProps 接口未公开,字段会变",
164
+ "right": "sort={{}} // 传空对象,Desktop 自动按 data 顺序推导"
165
+ }
166
+ ],
167
+ "mapping": {
168
+ "realComponent": "Desktop",
169
+ "adapter": null
170
+ }
171
+ }
@@ -0,0 +1,114 @@
1
+ {
2
+ "name": "DragVerify",
3
+ "category": "Data Entry",
4
+ "description": "拖拽验证,用于人机验证",
5
+ "semantic": {
6
+ "intent": [
7
+ "人机验证",
8
+ "安全校验"
9
+ ],
10
+ "useCases": [
11
+ "登录验证",
12
+ "表单提交",
13
+ "敏感操作"
14
+ ],
15
+ "riskLevel": "high"
16
+ },
17
+ "variants": {
18
+ "default": {
19
+ "meaning": "默认样式"
20
+ }
21
+ },
22
+ "states": [
23
+ "default",
24
+ "success",
25
+ "error"
26
+ ],
27
+ "idealProps": {
28
+ "getImgInfo": {
29
+ "type": "function",
30
+ "signature": "() => Promise<DragVerifyImgProps> | DragVerifyImgProps",
31
+ "required": true,
32
+ "description": "获取图片接口;返回 DragVerifyImgProps 接口(src/DragVerify/index.tsx:18 已 export),字段:sourceImage(string? 背景图 URL)、newImage(string? 滑块拼图 URL)、y(number? Y 轴目标位置 px,src 内部用 `imgInfo.y!/imgScale` 定位,**不传会 NaN**)、可挂任意扩展字段(`[k]: string|number|undefined`)。⚠️ 业务侧常错猜字段名 bgUrl/sliderUrl/xPos — 实际是 sourceImage/newImage/y。组件在挂载与 refresh 变化时调用此接口"
33
+ },
34
+ "verify": {
35
+ "type": "function",
36
+ "signature": "(xPos: number, imgInfo: DragVerifyImgProps) => Promise<boolean> | boolean",
37
+ "required": true,
38
+ "description": "提交校验接口;xPos = 用户滑动落点的 x 坐标(已按图片真实尺寸缩放回原图坐标);⚠️ 返回 **true = 通过 / false = 不通过**(src/DragVerify/index.tsx:42-46 注释实证)。组件根据返回值切换 success/error class。**目前无 onSuccess/onError 回调 prop**,父组件感知验证结果的唯一办法是在 verify 内部包装一层拦截返回值(见 codeString.ts verifyWithCallback 示例);后续可能升级,见 discussions/DragVerify-onSuccess-onError-callback-epic.md"
39
+ },
40
+ "refresh": {
41
+ "type": "string | number",
42
+ "description": "刷新触发器;⚠️ 实际类型 string|number(组件 src/DragVerify/index.tsx:39 实证,旧 api.ts 写 any 不准);组件 useEffect 监听该值,值变化即重新调用 getImgInfo 并复位 state。典型用法:外层 useState<number> 自增"
43
+ },
44
+ "width": {
45
+ "type": "number | string",
46
+ "description": "图片框宽度;number 视为 px(如 300 → 300px),string 直接透传(支持 '100%' / '80vw' 等响应式单位,src handStyle 实证);未传则 CSS 默认"
47
+ },
48
+ "height": {
49
+ "type": "number | string",
50
+ "description": "图片框高度;number 视为 px,string 直接透传;未传则 CSS 默认"
51
+ }
52
+ },
53
+ "do": [
54
+ "在需要防止机器人的场景使用(登录/注册/敏感操作)",
55
+ "提供刷新和重试机制:父组件维护 useState<number> 计数器,每次刷新时 setRefresh(n+1) 触发组件重新获取图片",
56
+ "通过 verify 包装层感知验证结果(组件无 onSuccess/onError 回调,在 verify 内拦截返回值):verify={async (x, info) => { const ok = await api.check(x, info); if (ok) toast('验证通过'); return ok; }}",
57
+ "若 API 返回字段名不是 sourceImage/newImage/y:在 getImgInfo 内部做字段映射后返回标准 DragVerifyImgProps"
58
+ ],
59
+ "dont": [
60
+ "在低风险操作中使用(增加用户摩擦,适用登录/支付/批量操作等场景)",
61
+ "猜测 DragVerifyImgProps 字段名为 bgUrl/sliderUrl/xPos——实际是 sourceImage/newImage/y(见 src/DragVerify/index.tsx:18 interface 实证)",
62
+ "在 verify 内总是 return true——绕过验证,失去安全意义"
63
+ ],
64
+ "events": {
65
+ "getImgInfo": {
66
+ "signature": "() => Promise<DragVerifyImgProps> | DragVerifyImgProps",
67
+ "asyncSupported": true,
68
+ "examples": [
69
+ "异步获取:getImgInfo={async () => { const res = await api.getCaptcha(); return { sourceImage: res.bg, newImage: res.slider, y: res.yPos }; }}",
70
+ "组件在挂载时和 refresh prop 变化时自动调用此函数",
71
+ "返回值字段:sourceImage(背景图 URL)、newImage(滑块图 URL)、y(滑块 Y 轴位置 px)"
72
+ ],
73
+ "commonMistakes": [
74
+ "直接返回 API 响应对象未映射字段名——API 字段 bgUrl/sliderImg/yOffset 需映射为 sourceImage/newImage/y",
75
+ "y 字段不传导致 NaN——src 内部用 imgInfo.y!/imgScale 定位,缺失 y 会 NaN,滑块位置异常",
76
+ "期望 getImgInfo 在用户刷新时自动调用——刷新需要父组件修改 refresh prop 值"
77
+ ]
78
+ },
79
+ "verify": {
80
+ "signature": "(xPos: number, imgInfo: DragVerifyImgProps) => Promise<boolean> | boolean",
81
+ "asyncSupported": true,
82
+ "examples": [
83
+ "API 校验:verify={async (x, info) => { const ok = await api.verify({ x, ...info }); return ok; }}",
84
+ "返回 true=通过(组件显示成功状态),返回 false=失败(组件显示错误状态并自动重置)",
85
+ "在 verify 内包装 onSuccess 回调:verify={async (x, info) => { const ok = await check(x); if (ok) onSuccess(); return ok; }}"
86
+ ],
87
+ "commonMistakes": [
88
+ "期望通过 verify 回调外的 onSuccess prop 感知成功——组件无 onSuccess/onError prop,需在 verify 内包装",
89
+ "返回非 boolean 类型(如 '1'/'0' 字符串)——truthiness 判断可能意外通过,必须返回 boolean"
90
+ ]
91
+ }
92
+ },
93
+ "typescriptPitfalls": [
94
+ {
95
+ "issue": "DragVerifyImgProps 字段名是 sourceImage/newImage/y,不是 bgUrl/sliderUrl/xPos",
96
+ "wrong": "getImgInfo={async () => ({ bgUrl: res.bg, sliderUrl: res.slider, yPos: res.y })} // 字段名不匹配,图片不显示",
97
+ "right": "getImgInfo={async () => ({ sourceImage: res.bg, newImage: res.slider, y: res.y })} // 正确字段名"
98
+ },
99
+ {
100
+ "issue": "getImgInfo 和 verify 是必填 prop(无问号),不传会 TS 报错",
101
+ "wrong": "<DragVerify /> // 缺少必填 getImgInfo 和 verify",
102
+ "right": "<DragVerify getImgInfo={fetchCaptcha} verify={verifyCaptcha} />"
103
+ },
104
+ {
105
+ "issue": "refresh prop 的实际类型是 string|number,不是 any",
106
+ "wrong": "const [refresh, setRefresh] = useState<boolean>(false); // boolean 类型赋给 string|number 会 TS 报错",
107
+ "right": "const [refresh, setRefresh] = useState<number>(0);\n// 刷新时:setRefresh(prev => prev + 1)"
108
+ }
109
+ ],
110
+ "mapping": {
111
+ "realComponent": "DragVerify",
112
+ "adapter": null
113
+ }
114
+ }
@@ -0,0 +1,200 @@
1
+ {
2
+ "name": "Drawer",
3
+ "category": "Feedback",
4
+ "description": "屏幕边缘滑出的浮层面板",
5
+ "semantic": {
6
+ "intent": [
7
+ "查看详情",
8
+ "辅助操作",
9
+ "复杂配置"
10
+ ],
11
+ "useCases": [
12
+ "详情页预览",
13
+ "系统配置侧边栏",
14
+ "多级筛选"
15
+ ],
16
+ "riskLevel": "normal"
17
+ },
18
+ "variants": {
19
+ "default": {
20
+ "meaning": "标准抽屉"
21
+ }
22
+ },
23
+ "states": [
24
+ "open",
25
+ "loading"
26
+ ],
27
+ "idealProps": {
28
+ "open": {
29
+ "type": "boolean",
30
+ "default": false,
31
+ "description": "**受控模式**:传 open + onClose;onClose 不会自动改 open,需父组件 setOpen(false)。仅暴露 open,**没有 visible 别名**——antd 早期 visible 命名已迁移到 open"
32
+ },
33
+ "title": {
34
+ "type": "ReactNode",
35
+ "description": "标题"
36
+ },
37
+ "placement": {
38
+ "type": "enum",
39
+ "values": ["right", "left", "top", "bottom"],
40
+ "default": "right",
41
+ "description": "抽屉滑出方向"
42
+ },
43
+ "size": {
44
+ "type": "enum",
45
+ "values": ["small", "medium", "large", "auto"],
46
+ "default": "large",
47
+ "description": "预设尺寸(small/medium/large 各对应固定 px;auto 不设默认值)。**优先级低于 width/height**:传 width/height 时 size 预设被覆盖(src/Drawer/index.tsx:89 实证)"
48
+ },
49
+ "width": {
50
+ "type": "string | number",
51
+ "description": "自定义宽度(仅 placement='left'|'right' 生效)。number 当 px 处理(如 480 → 480px);string 支持任意 CSS 长度(px/vw/%/em)。**优先级高于 size**:传 width 时忽略 size 预设宽度"
52
+ },
53
+ "height": {
54
+ "type": "string | number",
55
+ "description": "自定义高度(仅 placement='top'|'bottom' 生效)。number 当 px;string 支持任意 CSS 长度(px/vh/%/em)。优先级与 width 同——传 height 时覆盖 size 预设"
56
+ },
57
+ "destroyOnClose": {
58
+ "type": "boolean",
59
+ "default": false,
60
+ "description": "关闭时是否销毁内部内容(unmount children 子树,避免表单状态/请求残留)。默认 false 仅隐藏不卸载——表单类 Drawer 通常需显式传 true。src/Drawer/index.tsx:27/48/219 已实现"
61
+ },
62
+ "onClose": {
63
+ "type": "function",
64
+ "signature": "(event: React.MouseEvent | React.KeyboardEvent) => void",
65
+ "description": "关闭回调。当用户点击关闭按钮 / 点击遮罩(maskClosable=true 时)/ 按 ESC 时触发。回调收 event 参数(src/Drawer/index.tsx:102 `onClose?.(e)` 实证),与 src/Drawer/interface.ts:59 对齐"
66
+ },
67
+ "showExtra": {
68
+ "type": "boolean",
69
+ "default": true,
70
+ "description": "是否显示右上角的操作区域(extra 容器);false 则隐藏整个 extra 区域"
71
+ },
72
+ "showMask": {
73
+ "type": "boolean",
74
+ "default": true,
75
+ "description": "是否显示遮罩;false 则全透明且点击下层内容仍可交互"
76
+ },
77
+ "onOk": {
78
+ "type": "function",
79
+ "signature": "() => void",
80
+ "description": "点击底部确定按钮的回调(src/Drawer/interface.ts:85 实证)。**Drawer 不自动关闭**——需业务方在 onOk 内自行 setOpen(false)。未传时默认渲染确定按钮但点击无回调"
81
+ },
82
+ "onCancel": {
83
+ "type": "function",
84
+ "signature": "() => void",
85
+ "description": "点击底部取消按钮的回调(src/Drawer/interface.ts:87 实证)。⚠️ **与 onClose 区分**:onCancel 仅绑定底部取消按钮;onClose 绑定右上角 X / ESC / 遮罩关闭路径。两者可同时使用"
86
+ },
87
+ "afterVisibleChange": {
88
+ "type": "function",
89
+ "signature": "(open: boolean) => void",
90
+ "description": "动画结束后的回调(src/Drawer/interface.ts:55 实证,参数名 open 表示当前是否可见)。**在 transition end 时触发**,适合「动画完成后再执行」的场景(如滚动位置重置、DOM 测量等)。与 onChange 区分:onChange 在 open 状态切换时立即触发,afterVisibleChange 在动画结束后触发"
91
+ },
92
+ "push": {
93
+ "type": "boolean | object",
94
+ "objectShape": {
95
+ "distance": { "type": "string | number", "description": "子 Drawer 推入父 Drawer 的距离,默认 100(px)" }
96
+ },
97
+ "default": "{ distance: 100 }",
98
+ "description": "多层 Drawer 时的推入行为配置(src/Drawer/interface.ts:93 实证)。传 `{ distance: number | string }` 指定偏移量;传 `false` 禁用推入效果(子 Drawer 直接覆盖,父 Drawer 不偏移)。**仅在嵌套 Drawer 场景下生效**"
99
+ }
100
+ },
101
+ "do": [
102
+ "在需要保持上下文(不跳转页面)的情况下使用 Drawer 展示详情",
103
+ "提供清晰的标题和关闭按钮",
104
+ "受控模式必须同时处理 onClose 并调用 setOpen(false)——Drawer 不会自动关闭,onClose 仅是通知回调(src/Drawer/index.tsx:102 实证)",
105
+ "表单类内容使用 destroyOnClose={true},确保关闭后状态重置,避免下次打开显示上次残留数据",
106
+ "区分 onClose / onOk / onCancel 三个回调职责:onClose 绑定 X/ESC/遮罩关闭路径,onOk 绑定底部确定按钮,onCancel 绑定底部取消按钮"
107
+ ],
108
+ "dont": [
109
+ "在 Drawer 中嵌套过深的 Drawer(多层级建议使用页面跳转)",
110
+ "在 Drawer 中使用全屏 Modal(遮挡感过强)",
111
+ "不要假设 onOk/onCancel 点击后 Drawer 自动关闭——src 实现中两者只调回调,不修改 open 状态,必须业务方自行 setOpen(false)",
112
+ "不要用 visible 替代 open——Drawer 只有 open prop,无 visible 别名(与 antd v4 命名不同)",
113
+ "不要在 placement='top'|'bottom' 时传 width,或在 placement='left'|'right' 时传 height——方向不对时对应的尺寸 prop 无效(src/Drawer/index.tsx:84-91 实证)"
114
+ ],
115
+ "events": {
116
+ "onClose": {
117
+ "signature": "(event: React.MouseEvent | React.KeyboardEvent) => void",
118
+ "asyncSupported": false,
119
+ "examples": [
120
+ "点击右上角 X 按钮关闭时触发,event 来自 rc-drawer 内部关闭路径",
121
+ "maskClosable=true 时点击遮罩触发,event.type 一般为 'click'",
122
+ "keyboard=true 时按 ESC 触发,event.type 为 'keydown'"
123
+ ],
124
+ "commonMistakes": [
125
+ "假设 onClose 触发后 Drawer 自动关闭 → 必须在 onClose 内调 setOpen(false),否则 Drawer 保持打开",
126
+ "假设回调无参数 → 实际收 event 参数(React.MouseEvent | React.KeyboardEvent),src/Drawer/index.tsx:102 实证",
127
+ "将 onClose 和 onCancel 当作同一回调 → onClose 是 X/ESC/遮罩关闭路径,onCancel 只绑定底部取消按钮",
128
+ "不区分 onClose 与 afterVisibleChange → onClose 在用户触发关闭时立即调用,afterVisibleChange 是动画结束后的回调"
129
+ ]
130
+ },
131
+ "onOk": {
132
+ "signature": "() => void",
133
+ "asyncSupported": false,
134
+ "examples": [
135
+ "点击底部确定按钮时触发(showExtra=true 且未传自定义 extra 时显示默认确定/取消按钮)",
136
+ "在 onOk 内提交表单数据后调 setOpen(false) 关闭 Drawer",
137
+ "配合 okButtonProps={{ loading: true }} 模拟异步提交中状态"
138
+ ],
139
+ "commonMistakes": [
140
+ "假设 onOk 执行后 Drawer 自动关闭 → 必须手动 setOpen(false),src/Drawer/index.tsx:104-106 仅调 onOk?.() 不改 open",
141
+ "假设 onOk 接收 event 参数 → 签名是 () => void,无参数(src/Drawer/interface.ts:85 实证)",
142
+ "在 extra 已自定义的情况下期望 onOk 仍然触发 → 传了 extra prop 时默认确定/取消按钮区域被整体替换"
143
+ ]
144
+ },
145
+ "onCancel": {
146
+ "signature": "() => void",
147
+ "asyncSupported": false,
148
+ "examples": [
149
+ "点击底部取消按钮时触发",
150
+ "onCancel 内调 setOpen(false) 关闭 Drawer,清空临时状态",
151
+ "配合 cancelButtonProps={{ children: '放弃修改' }} 自定义取消按钮文字"
152
+ ],
153
+ "commonMistakes": [
154
+ "把 onCancel 当作关闭监听 → onCancel 只绑定底部取消按钮,X/ESC/遮罩关闭走 onClose",
155
+ "假设 onCancel 接收 event 参数 → 签名是 () => void,无参数(src/Drawer/interface.ts:87 实证)",
156
+ "不调 setOpen(false) → onCancel 不自动关闭 Drawer,需手动 setOpen(false)"
157
+ ]
158
+ },
159
+ "afterVisibleChange": {
160
+ "signature": "(open: boolean) => void",
161
+ "asyncSupported": false,
162
+ "examples": [
163
+ "动画结束后重置滚动位置(open=false 时清理)",
164
+ "动画结束后触发懒加载请求(open=true 时执行)",
165
+ "DOM 测量场景:等 Drawer 完全展开后再读取 offsetWidth"
166
+ ],
167
+ "commonMistakes": [
168
+ "把 afterVisibleChange 当作 onClose 使用 → afterVisibleChange 传入当前 open 状态(true/false),不是关闭事件",
169
+ "在 afterVisibleChange 里调 setOpen(false) 导致循环 → open=false 时 afterVisibleChange 已在关闭动画结束后触发,不要再次关闭",
170
+ "假设 open=true 时 afterVisibleChange 先于内容渲染触发 → afterVisibleChange 是动画结束后触发,此时内容已渲染"
171
+ ]
172
+ }
173
+ },
174
+ "typescriptPitfalls": [
175
+ {
176
+ "issue": "DrawerProps 未导出子类型,不要用 any 声明 props",
177
+ "wrong": "const MyDrawer = (props: any) => <Drawer {...props} />;",
178
+ "right": "import { DrawerProps } from '@para-ui/core'; const MyDrawer = (props: DrawerProps) => <Drawer {...props} />;"
179
+ },
180
+ {
181
+ "issue": "size 枚举值 'medium' 不是 'mid',与 Modal 的 'md' 不同",
182
+ "wrong": "<Drawer size='mid' /> // 不存在,TS 报类型错",
183
+ "right": "<Drawer size='medium' /> // 合法值:'small' | 'medium' | 'large' | 'auto'"
184
+ },
185
+ {
186
+ "issue": "onClose 参数类型是联合类型,不要假设是 MouseEvent",
187
+ "wrong": "onClose={(e: React.MouseEvent) => setOpen(false)} // ESC 触发时 e 是 KeyboardEvent,类型不兼容",
188
+ "right": "onClose={(e: React.MouseEvent | React.KeyboardEvent) => setOpen(false)}"
189
+ },
190
+ {
191
+ "issue": "placement 枚举值只有 'left'|'top'|'right'|'bottom',不接受 antd 风格写法",
192
+ "wrong": "<Drawer placement='bottom-start' /> // 非法,Drawer placement 无 dash 写法",
193
+ "right": "<Drawer placement='bottom' /> // 合法值:'left' | 'top' | 'right' | 'bottom'(src/Drawer/interface.ts:13 IPlacement)"
194
+ }
195
+ ],
196
+ "mapping": {
197
+ "realComponent": "Drawer",
198
+ "adapter": null
199
+ }
200
+ }
@@ -0,0 +1,147 @@
1
+ {
2
+ "name": "Dropdown",
3
+ "category": "Navigation",
4
+ "description": "下拉菜单浮层。children 必须是**单一 React 元素**(rc-dropdown 内部需挂 ref);overlay 必须是**单一 ReactElement**(不接受 ReactNode/字符串/数组/Fragment),不传则不渲染浮层。",
5
+ "semantic": {
6
+ "intent": [
7
+ "下拉选择",
8
+ "菜单展示"
9
+ ],
10
+ "useCases": [
11
+ "用户操作菜单",
12
+ "导航下拉",
13
+ "右键上下文菜单",
14
+ "快捷操作"
15
+ ],
16
+ "riskLevel": "low"
17
+ },
18
+ "variants": {
19
+ "default": {
20
+ "meaning": "默认样式"
21
+ }
22
+ },
23
+ "states": [
24
+ "open",
25
+ "closed"
26
+ ],
27
+ "idealProps": {
28
+ "overlay": {
29
+ "type": "React.ReactElement | (() => React.ReactElement)",
30
+ "description": "下拉浮层内容。**必须是单个 JSX 元素或返回单个 JSX 元素的函数**——不接受字符串/数字/数组/Fragment/ReactNode(否则 TS2322)。要传多个节点请用单一容器(如 `<div>` / `<ul>`)包裹。**如封装组件以 `ReactNode` 类型 prop 接收浮层内容,推荐封装写法:`overlay={<div>{contentProp}</div>}`**——额外的 div 容器不影响 rc-dropdown 内部定位。"
31
+ },
32
+ "children": {
33
+ "type": "React.ReactElement",
34
+ "description": "触发浮层的目标节点(必填,**单一可接收 ref 的 React 元素**)。传 string / Fragment / 数组会触发 TS2322;如需多节点触发器,外层包一层 `<span>` 或具体组件即可。**如封装组件以 `ReactNode` 类型 prop 接收触发器内容,推荐封装写法:`<Dropdown ...><span>{triggerNodeProp}</span></Dropdown>`**——`<span>` 容器可正常挂 ref,不影响触发行为。"
35
+ },
36
+ "trigger": {
37
+ "type": "('click' | 'hover' | 'contextMenu')[]",
38
+ "values": ["click", "hover", "contextMenu"],
39
+ "default": ["hover"],
40
+ "description": "触发下拉的行为列表;数组形式可同时启用多种触发(如 ['click','hover'])。'contextMenu' 用于右键上下文菜单场景。"
41
+ },
42
+ "placement": {
43
+ "type": "'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight'",
44
+ "values": ["top", "topLeft", "topRight", "bottom", "bottomLeft", "bottomRight"],
45
+ "default": "bottomLeft",
46
+ "description": "菜单弹出位置;6 枚举值已展开。默认 'bottomLeft'(左对齐从下方弹出);'bottom' 为居中对齐,'bottomRight' 为右对齐。"
47
+ },
48
+ "visible": {
49
+ "type": "boolean",
50
+ "description": "受控显示状态;传值则交由外部控制开合,不传走非受控由 trigger 触发。"
51
+ },
52
+ "onVisibleChange": {
53
+ "type": "(visible: boolean) => void",
54
+ "description": "菜单显隐切换回调;受控/非受控均会触发,可用作 visible 同步源。"
55
+ },
56
+ "destroyPopupOnHide": {
57
+ "type": "boolean",
58
+ "default": false,
59
+ "description": "关闭时是否销毁浮层 DOM(避免后台仍渲染)。"
60
+ },
61
+ "overlayClassName": {
62
+ "type": "string",
63
+ "description": "浮层最外层 class 名"
64
+ },
65
+ "overlayStyle": {
66
+ "type": "React.CSSProperties",
67
+ "description": "浮层最外层样式"
68
+ },
69
+ "mouseEnterDelay": {
70
+ "type": "number",
71
+ "description": "trigger='hover' 鼠标进入延迟(秒)"
72
+ },
73
+ "mouseLeaveDelay": {
74
+ "type": "number",
75
+ "description": "trigger='hover' 鼠标移出延迟(秒)"
76
+ },
77
+ "getPopupContainer": {
78
+ "type": "(triggerNode: HTMLElement) => HTMLElement",
79
+ "description": "浮层渲染容器;默认 body,可指定挂载到自定义 DOM 节点(滚动容器场景常用)"
80
+ },
81
+ "forceRender": {
82
+ "type": "boolean",
83
+ "default": false,
84
+ "description": "首次渲染前强制创建浮层 DOM(SSR / 首次过渡动画场景)"
85
+ },
86
+ "isolationPopupOnHide": {
87
+ "type": "boolean",
88
+ "default": false,
89
+ "description": "关闭时把浮层定位至屏幕之外,隔离 DOM 污染(默认 false)"
90
+ }
91
+ },
92
+ "do": [
93
+ "overlay 包成单一 JSX 元素(<div>/<ul>/自定义浮层组件),不要传字符串或多节点数组",
94
+ "children 必须是单一可挂 ref 的元素;非组件节点用 <span> 包裹",
95
+ "封装 Dropdown 时,外部 prop 类型为 ReactNode → children 传 `<span>{prop}</span>`,overlay 传 `<div>{prop}</div>`——这是官方推荐封装模式,不影响定位和 ref 挂载",
96
+ "右键上下文菜单场景用 trigger={['contextMenu']}",
97
+ "需要受控开合时同时传 visible + onVisibleChange,保证状态来源唯一"
98
+ ],
99
+ "dont": [
100
+ "不要给 overlay 传 ReactNode/字符串/数组/Fragment——overlay 必须是单个 ReactElement(JSX 元素)",
101
+ "不要给 children 传字符串/Fragment/数组——会因无法挂 ref 导致触发不生效",
102
+ "不要在 overlay 里依赖 children 的 onClick——点击事件需在 overlay 内部自行处理",
103
+ "不要嵌套过深的 Dropdown(下拉里再下拉),交互复杂且不利于键盘可达性"
104
+ ],
105
+ "events": {
106
+ "onVisibleChange": {
107
+ "signature": "(visible: boolean) => void",
108
+ "asyncSupported": false,
109
+ "examples": [
110
+ "受控模式:onVisibleChange={v => setOpen(v)},配合 visible={open} 实现完全受控",
111
+ "非受控模式:onVisibleChange={v => console.log('dropdown', v ? '打开' : '关闭')},不传 visible 由 trigger 控制",
112
+ "点击外部关闭时 onVisibleChange(false) 也会触发"
113
+ ],
114
+ "commonMistakes": [
115
+ "只传 visible 不传 onVisibleChange → 受控模式下下拉无法关闭(visible 永远不更新)",
116
+ "假设 onVisibleChange 接受 (visible, event) 两个参数 → 实际只有一个 boolean 参数",
117
+ "在 onVisibleChange 里直接修改 overlay 内容期望触发重渲染 → overlay 变化不会重触发 onVisibleChange"
118
+ ]
119
+ }
120
+ },
121
+ "typescriptPitfalls": [
122
+ {
123
+ "issue": "overlay 类型是 React.ReactElement | (() => React.ReactElement),不是 ReactNode",
124
+ "wrong": "overlay={<><div>A</div><div>B</div></>} // Fragment 作为 overlay 会触发 TS2322 类型错",
125
+ "right": "overlay={<div><div>A</div><div>B</div></div>} // 用单一容器元素包裹多节点"
126
+ },
127
+ {
128
+ "issue": "children 类型是 React.ReactElement,不是 ReactNode,传字符串或 Fragment 会 TS 报错",
129
+ "wrong": "<Dropdown overlay={menu}>触发文字</Dropdown> // 字符串不是 ReactElement,TS2322",
130
+ "right": "<Dropdown overlay={menu}><span>触发文字</span></Dropdown> // 用 span 包裹字符串"
131
+ },
132
+ {
133
+ "issue": "trigger prop 是数组类型,不是字符串",
134
+ "wrong": "trigger='click' // TS2322: Type 'string' is not assignable to type '...'",
135
+ "right": "trigger={['click']} // 数组形式,支持 ['click'] / ['hover'] / ['click', 'hover']"
136
+ },
137
+ {
138
+ "issue": "Placement 枚举只有 6 个有效值,不包含 'left' / 'right'",
139
+ "wrong": "placement='left' // TS 报错:不在 Placement 枚举中",
140
+ "right": "placement='bottomLeft' // 合法值: 'top'|'topLeft'|'topRight'|'bottom'|'bottomLeft'|'bottomRight'"
141
+ }
142
+ ],
143
+ "mapping": {
144
+ "realComponent": "Dropdown",
145
+ "adapter": null
146
+ }
147
+ }