@para-ui/core 5.0.0-beta.12 → 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 (556) 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 +50 -47
  111. package/es/Anchor/type.d.ts +8 -4
  112. package/es/Argv/component.json +216 -0
  113. package/es/Argv/index.d.ts +5 -6
  114. package/es/AutoBox/component.json +133 -0
  115. package/es/AutoBox/index.d.ts +3 -3
  116. package/es/AutoBox/index.js +1 -1
  117. package/es/AutoBox/protal.d.ts +2 -2
  118. package/es/AutoBox/protal.js +32 -29
  119. package/es/AutoButton/component.json +109 -0
  120. package/es/AutoButton/index.js +1 -1
  121. package/es/AutoTips/autoTipsMultiline/index.d.ts +1 -1
  122. package/es/AutoTips/autoTipsMultiline/index.js +1 -1
  123. package/es/AutoTips/component.json +121 -0
  124. package/es/Badge/component.json +92 -0
  125. package/es/Breadcrumbs/component.json +142 -0
  126. package/es/Breadcrumbs/index.js +1 -1
  127. package/es/Button/SplitButton.d.ts +2 -2
  128. package/es/Button/component.json +168 -0
  129. package/es/Button/index.js +44 -44
  130. package/es/ButtonGroup/component.json +132 -0
  131. package/es/ButtonGroup/index.d.ts +1 -1
  132. package/es/Card/component.json +162 -0
  133. package/es/Card/index.d.ts +2 -2
  134. package/es/Card/index.js +2 -2
  135. package/es/Carousel/component.json +142 -0
  136. package/es/Carousel/index.d.ts +1 -1
  137. package/es/Cascader/component.json +196 -0
  138. package/es/Cascader/hooks/useEntities.js +7 -7
  139. package/es/Cascader/interface.d.ts +1 -0
  140. package/es/Cascader/utils/commonUtil.d.ts +1 -1
  141. package/es/Cascader/utils/commonUtil.js +16 -16
  142. package/es/Cascader/utils/treeUtil.d.ts +14 -5
  143. package/es/Cascader/utils/treeUtil.js +1 -1
  144. package/es/Checkbox/component.json +138 -0
  145. package/es/CheckboxGroup/component.json +152 -0
  146. package/es/CodeEditor/component.json +189 -0
  147. package/es/CodeEditor/index.d.ts +10 -9
  148. package/es/Collapse/component.json +166 -0
  149. package/es/Collapse/index.d.ts +1 -1
  150. package/es/Collapse/index.js +23 -22
  151. package/es/CollapseBox/component.json +84 -0
  152. package/es/CollapseLayout/component.json +155 -0
  153. package/es/ColorPicker/component.json +142 -0
  154. package/es/ComboSelect/component.json +181 -0
  155. package/es/ComboSelect/index.js +73 -68
  156. package/es/ComboSelect/interface.d.ts +2 -2
  157. package/es/ComboSelect/utils.d.ts +3 -3
  158. package/es/ComboSelect/utils.js +1 -1
  159. package/es/Container/component.json +111 -0
  160. package/es/ContentBox/component.json +81 -0
  161. package/es/CopyText/component.json +118 -0
  162. package/es/CycleSelector/component.json +98 -0
  163. package/es/CycleSelector/index.js +14 -13
  164. package/es/DatePicker/component.json +192 -0
  165. package/es/DatePicker/generatePicker/generateRangePicker.js +10 -10
  166. package/es/DatePicker/generatePicker/generateSinglePicker.js +1 -1
  167. package/es/Descriptions/component.json +142 -0
  168. package/es/Descriptions/index.d.ts +1 -1
  169. package/es/Desktop/component.json +171 -0
  170. package/es/DragVerify/component.json +114 -0
  171. package/es/DragVerify/index.js +19 -19
  172. package/es/Drawer/component.json +200 -0
  173. package/es/Drawer/index.js +86 -86
  174. package/es/Drawer/interface.d.ts +1 -1
  175. package/es/Drawer/util.d.ts +1 -6
  176. package/es/Drawer/util.js +9 -6
  177. package/es/Dropdown/component.json +147 -0
  178. package/es/DynamicMultiBox/component.json +278 -0
  179. package/es/DynamicMultiBox/formItem.d.ts +1 -1
  180. package/es/DynamicMultiBox/rowForm.d.ts +2 -2
  181. package/es/Empty/component.json +123 -0
  182. package/es/Empty/index.css +1 -1
  183. package/es/Empty/index.d.ts +2 -2
  184. package/es/Empty/index.js +27 -26
  185. package/es/Empty/style/index.css +1 -1
  186. package/es/FieldForm/FieldFormItem/MemoInput.d.ts +2 -2
  187. package/es/FieldForm/FieldFormItem/index.d.ts +6 -6
  188. package/es/FieldForm/Form.d.ts +2 -2
  189. package/es/FieldForm/FormList.d.ts +2 -2
  190. package/es/FieldForm/component.json +196 -0
  191. package/es/FieldForm/context.d.ts +5 -1
  192. package/es/FieldForm/context.js +2 -2
  193. package/es/FieldForm/hooks/useForm.d.ts +4 -3
  194. package/es/FieldForm/hooks/useFormInstance.d.ts +1 -1
  195. package/es/FieldForm/hooks/useFormItemStatus.d.ts +9 -5
  196. package/es/FieldForm/hooks/useFormItemStatus.js +2 -2
  197. package/es/FieldForm/hooks/useItemRef.d.ts +1 -1
  198. package/es/FieldForm/hooks/useItemRef.js +6 -6
  199. package/es/Form/component.json +161 -0
  200. package/es/Form/index.d.ts +52 -49
  201. package/es/FormItem/compoments/defaultCompoments/index.d.ts +5 -5
  202. package/es/FormItem/compoments/defaultCompoments/index.js +12 -11
  203. package/es/FormItem/compoments/formCheckboxGroup/index.d.ts +2 -2
  204. package/es/FormItem/compoments/formFile/index.js +8 -8
  205. package/es/FormItem/compoments/formRadioGroup/index.d.ts +1 -1
  206. package/es/FormItem/compoments/formSelect/index.d.ts +1 -1
  207. package/es/FormItem/component.json +171 -0
  208. package/es/FormItem/index.d.ts +5 -5
  209. package/es/FormItem/index.js +23 -23
  210. package/es/FormItem/itemType.js +1 -1
  211. package/es/FunctionModal/component.json +197 -0
  212. package/es/FunctionModal/dialog.d.ts +1 -1
  213. package/es/FunctionModal/modalContext.d.ts +4 -1
  214. package/es/Help/component.json +118 -0
  215. package/es/HelperText/component.json +126 -0
  216. package/es/Image/component.json +165 -0
  217. package/es/InputCode/component.json +191 -0
  218. package/es/InputCode/index.d.ts +2 -2
  219. package/es/InputLang/component.json +205 -0
  220. package/es/InputLang/index.js +1 -1
  221. package/es/InputNumber/component.json +162 -0
  222. package/es/Label/component.json +126 -0
  223. package/es/Label/index.d.ts +2 -2
  224. package/es/Loading/component.json +91 -0
  225. package/es/Menu/component.json +180 -0
  226. package/es/Message/component.json +246 -0
  227. package/es/Message/index.d.ts +2 -2
  228. package/es/Message/index.js +2 -2
  229. package/es/Modal/Confirm/index.d.ts +1 -1
  230. package/es/Modal/component.json +277 -0
  231. package/es/Modal/index.d.ts +85 -5
  232. package/es/Modal/index.js +159 -122
  233. package/es/Modal/interface.d.ts +1 -0
  234. package/es/MultiBox/component.json +216 -0
  235. package/es/MultiBox/index.js +19 -14
  236. package/es/Notification/component.json +184 -0
  237. package/es/OperateBtn/component.json +134 -0
  238. package/es/OperateBtn/index.d.ts +3 -3
  239. package/es/PageHeader/component.json +112 -0
  240. package/es/Pagination/component.json +181 -0
  241. package/es/Pagination/index.js +15 -15
  242. package/es/PasswordRules/component.json +105 -0
  243. package/es/PasswordRules/index.d.ts +4 -4
  244. package/es/PopConfirm/component.json +227 -0
  245. package/es/PopConfirm/index.d.ts +1 -1
  246. package/es/PopConfirm/index.js +1 -1
  247. package/es/PopMenu/component.json +131 -0
  248. package/es/PopMenu/hooks.d.ts +1 -1
  249. package/es/PopMenu/index.js +8 -8
  250. package/es/Popover/component.json +165 -0
  251. package/es/Popover/index.js +1 -1
  252. package/es/Progress/component.json +161 -0
  253. package/es/Prompt/component.json +144 -0
  254. package/es/Querying/component.json +96 -0
  255. package/es/Querying/index.css +1 -1
  256. package/es/Querying/index.d.ts +2 -2
  257. package/es/Querying/index.js +20 -19
  258. package/es/Querying/style/index.css +1 -1
  259. package/es/QuickReply/component.json +129 -0
  260. package/es/QuickReply/index.d.ts +1 -1
  261. package/es/Radio/component.json +136 -0
  262. package/es/RadioGroup/component.json +149 -0
  263. package/es/RangeInput/component.json +198 -0
  264. package/es/RangeInput/index.js +1 -1
  265. package/es/Result/component.json +104 -0
  266. package/es/ScrollBar/component.json +115 -0
  267. package/es/Search/component.json +177 -0
  268. package/es/Search/index.d.ts +1 -1
  269. package/es/Select/component.json +244 -0
  270. package/es/Select/index.js +113 -113
  271. package/es/SelectInput/component.json +184 -0
  272. package/es/Selector/component.json +203 -0
  273. package/es/Selector/index.js +28 -27
  274. package/es/Selector/interface.d.ts +1 -1
  275. package/es/Selector/selectorMain/index.js +2 -2
  276. package/es/Selector/selectorNode/index.js +1 -1
  277. package/es/Selector/util.d.ts +2 -2
  278. package/es/SelectorPicker/component.json +179 -0
  279. package/es/SelectorPicker/index.d.ts +5 -5
  280. package/es/SelectorPicker/index.js +15 -15
  281. package/es/SingleBox/component.json +151 -0
  282. package/es/SingleBox/index.d.ts +2 -2
  283. package/es/Slider/component.json +181 -0
  284. package/es/SortBox/component.json +108 -0
  285. package/es/Status/component.json +104 -0
  286. package/es/Stepper/component.json +129 -0
  287. package/es/Stepper/index.d.ts +2 -2
  288. package/es/Switch/component.json +207 -0
  289. package/es/Switch/index.css +1 -1
  290. package/es/Switch/index.d.ts +3 -2
  291. package/es/Switch/index.js +60 -59
  292. package/es/Switch/style/index.css +1 -1
  293. package/es/Table/component.json +547 -0
  294. package/es/Table/index.d.ts +2 -2
  295. package/es/Table/index.js +414 -414
  296. package/es/Table/interface.d.ts +6 -0
  297. package/es/Tabs/component.json +227 -0
  298. package/es/Tag/component.json +221 -0
  299. package/es/Tag/index.css +1 -1
  300. package/es/Tag/index.d.ts +1 -1
  301. package/es/Tag/index.js +20 -20
  302. package/es/Tag/style/index.css +1 -1
  303. package/es/TextEditor/component.json +186 -0
  304. package/es/TextEditor/index.d.ts +5 -5
  305. package/es/TextField/component.json +290 -0
  306. package/es/TextField/index.d.ts +2 -2
  307. package/es/TimePicker/component.json +176 -0
  308. package/es/Timeline/component.json +110 -0
  309. package/es/Title/component.json +156 -0
  310. package/es/ToggleButton/component.json +153 -0
  311. package/es/Tooltip/component.json +176 -0
  312. package/es/Tooltip/index.js +58 -53
  313. package/es/Tooltip/interface.d.ts +14 -1
  314. package/es/Tooltip/utils.js +6 -6
  315. package/es/Transfer/component.json +157 -0
  316. package/es/Tree/component.json +512 -0
  317. package/es/Upload/component.json +450 -0
  318. package/es/Utils/type.d.ts +0 -2
  319. package/es/index.d.ts +2 -0
  320. package/es/index.js +1 -1
  321. package/es/locale/en_US.d.ts +361 -0
  322. package/es/locale/en_US.js +364 -0
  323. package/es/locale/index.d.ts +1 -723
  324. package/es/locale/index2.js +10 -0
  325. package/es/locale/zh_CN.d.ts +361 -0
  326. package/es/locale/zh_CN.js +364 -0
  327. package/lib/AlignBox/component.json +89 -0
  328. package/lib/AlignBox/index.css +1 -1
  329. package/lib/AlignBox/index.d.ts +6 -2
  330. package/lib/AlignBox/index.js +1 -1
  331. package/lib/AlignBox/style/index.css +1 -1
  332. package/lib/Anchor/anchorMenu/index.d.ts +2 -1
  333. package/lib/Anchor/anchorMenu/index.js +1 -1
  334. package/lib/Anchor/component.json +130 -0
  335. package/lib/Anchor/index.js +1 -1
  336. package/lib/Anchor/type.d.ts +8 -4
  337. package/lib/Argv/component.json +216 -0
  338. package/lib/Argv/index.d.ts +5 -6
  339. package/lib/AutoBox/component.json +133 -0
  340. package/lib/AutoBox/index.d.ts +3 -3
  341. package/lib/AutoBox/index.js +1 -1
  342. package/lib/AutoBox/protal.d.ts +2 -2
  343. package/lib/AutoBox/protal.js +1 -1
  344. package/lib/AutoButton/component.json +109 -0
  345. package/lib/AutoButton/index.js +1 -1
  346. package/lib/AutoTips/autoTipsMultiline/index.d.ts +1 -1
  347. package/lib/AutoTips/autoTipsMultiline/index.js +1 -1
  348. package/lib/AutoTips/component.json +121 -0
  349. package/lib/Badge/component.json +92 -0
  350. package/lib/Breadcrumbs/component.json +142 -0
  351. package/lib/Breadcrumbs/index.js +1 -1
  352. package/lib/Button/SplitButton.d.ts +2 -2
  353. package/lib/Button/component.json +168 -0
  354. package/lib/Button/index.js +1 -1
  355. package/lib/ButtonGroup/component.json +132 -0
  356. package/lib/ButtonGroup/index.d.ts +1 -1
  357. package/lib/Card/component.json +162 -0
  358. package/lib/Card/index.d.ts +2 -2
  359. package/lib/Card/index.js +1 -1
  360. package/lib/Carousel/component.json +142 -0
  361. package/lib/Carousel/index.d.ts +1 -1
  362. package/lib/Cascader/component.json +196 -0
  363. package/lib/Cascader/hooks/useEntities.js +1 -1
  364. package/lib/Cascader/interface.d.ts +1 -0
  365. package/lib/Cascader/utils/commonUtil.d.ts +1 -1
  366. package/lib/Cascader/utils/commonUtil.js +1 -1
  367. package/lib/Cascader/utils/treeUtil.d.ts +14 -5
  368. package/lib/Cascader/utils/treeUtil.js +1 -1
  369. package/lib/Checkbox/component.json +138 -0
  370. package/lib/CheckboxGroup/component.json +152 -0
  371. package/lib/CodeEditor/component.json +189 -0
  372. package/lib/CodeEditor/index.d.ts +10 -9
  373. package/lib/Collapse/component.json +166 -0
  374. package/lib/Collapse/index.d.ts +1 -1
  375. package/lib/Collapse/index.js +1 -1
  376. package/lib/CollapseBox/component.json +84 -0
  377. package/lib/CollapseLayout/component.json +155 -0
  378. package/lib/ColorPicker/component.json +142 -0
  379. package/lib/ComboSelect/component.json +181 -0
  380. package/lib/ComboSelect/index.js +1 -1
  381. package/lib/ComboSelect/interface.d.ts +2 -2
  382. package/lib/ComboSelect/utils.d.ts +3 -3
  383. package/lib/ComboSelect/utils.js +1 -1
  384. package/lib/Container/component.json +111 -0
  385. package/lib/ContentBox/component.json +81 -0
  386. package/lib/CopyText/component.json +118 -0
  387. package/lib/CycleSelector/component.json +98 -0
  388. package/lib/CycleSelector/index.js +1 -1
  389. package/lib/DatePicker/component.json +192 -0
  390. package/lib/DatePicker/generatePicker/generateRangePicker.js +1 -1
  391. package/lib/DatePicker/generatePicker/generateSinglePicker.js +1 -1
  392. package/lib/Descriptions/component.json +142 -0
  393. package/lib/Descriptions/index.d.ts +1 -1
  394. package/lib/Desktop/component.json +171 -0
  395. package/lib/DragVerify/component.json +114 -0
  396. package/lib/DragVerify/index.js +1 -1
  397. package/lib/Drawer/component.json +200 -0
  398. package/lib/Drawer/index.js +1 -1
  399. package/lib/Drawer/interface.d.ts +1 -1
  400. package/lib/Drawer/util.d.ts +1 -6
  401. package/lib/Drawer/util.js +1 -1
  402. package/lib/Dropdown/component.json +147 -0
  403. package/lib/DynamicMultiBox/component.json +278 -0
  404. package/lib/DynamicMultiBox/formItem.d.ts +1 -1
  405. package/lib/DynamicMultiBox/rowForm.d.ts +2 -2
  406. package/lib/Empty/component.json +123 -0
  407. package/lib/Empty/index.css +1 -1
  408. package/lib/Empty/index.d.ts +2 -2
  409. package/lib/Empty/index.js +1 -1
  410. package/lib/Empty/style/index.css +1 -1
  411. package/lib/FieldForm/FieldFormItem/MemoInput.d.ts +2 -2
  412. package/lib/FieldForm/FieldFormItem/index.d.ts +6 -6
  413. package/lib/FieldForm/Form.d.ts +2 -2
  414. package/lib/FieldForm/FormList.d.ts +2 -2
  415. package/lib/FieldForm/component.json +196 -0
  416. package/lib/FieldForm/context.d.ts +5 -1
  417. package/lib/FieldForm/context.js +1 -1
  418. package/lib/FieldForm/hooks/useForm.d.ts +4 -3
  419. package/lib/FieldForm/hooks/useFormInstance.d.ts +1 -1
  420. package/lib/FieldForm/hooks/useFormItemStatus.d.ts +9 -5
  421. package/lib/FieldForm/hooks/useFormItemStatus.js +1 -1
  422. package/lib/FieldForm/hooks/useItemRef.d.ts +1 -1
  423. package/lib/FieldForm/hooks/useItemRef.js +1 -1
  424. package/lib/Form/component.json +161 -0
  425. package/lib/Form/index.d.ts +52 -49
  426. package/lib/FormItem/compoments/defaultCompoments/index.d.ts +5 -5
  427. package/lib/FormItem/compoments/defaultCompoments/index.js +1 -1
  428. package/lib/FormItem/compoments/formCheckboxGroup/index.d.ts +2 -2
  429. package/lib/FormItem/compoments/formFile/index.js +1 -1
  430. package/lib/FormItem/compoments/formRadioGroup/index.d.ts +1 -1
  431. package/lib/FormItem/compoments/formSelect/index.d.ts +1 -1
  432. package/lib/FormItem/component.json +171 -0
  433. package/lib/FormItem/index.d.ts +5 -5
  434. package/lib/FormItem/index.js +1 -1
  435. package/lib/FormItem/itemType.js +1 -1
  436. package/lib/FunctionModal/component.json +197 -0
  437. package/lib/FunctionModal/dialog.d.ts +1 -1
  438. package/lib/FunctionModal/modalContext.d.ts +4 -1
  439. package/lib/Help/component.json +118 -0
  440. package/lib/HelperText/component.json +126 -0
  441. package/lib/Image/component.json +165 -0
  442. package/lib/InputCode/component.json +191 -0
  443. package/lib/InputCode/index.d.ts +2 -2
  444. package/lib/InputLang/component.json +205 -0
  445. package/lib/InputLang/index.js +1 -1
  446. package/lib/InputNumber/component.json +162 -0
  447. package/lib/Label/component.json +126 -0
  448. package/lib/Label/index.d.ts +2 -2
  449. package/lib/Loading/component.json +91 -0
  450. package/lib/Menu/component.json +180 -0
  451. package/lib/Message/component.json +246 -0
  452. package/lib/Message/index.d.ts +2 -2
  453. package/lib/Message/index.js +1 -1
  454. package/lib/Modal/Confirm/index.d.ts +1 -1
  455. package/lib/Modal/component.json +277 -0
  456. package/lib/Modal/index.d.ts +85 -5
  457. package/lib/Modal/index.js +1 -1
  458. package/lib/Modal/interface.d.ts +1 -0
  459. package/lib/MultiBox/component.json +216 -0
  460. package/lib/MultiBox/index.js +1 -1
  461. package/lib/Notification/component.json +184 -0
  462. package/lib/OperateBtn/component.json +134 -0
  463. package/lib/OperateBtn/index.d.ts +3 -3
  464. package/lib/PageHeader/component.json +112 -0
  465. package/lib/Pagination/component.json +181 -0
  466. package/lib/Pagination/index.js +1 -1
  467. package/lib/PasswordRules/component.json +105 -0
  468. package/lib/PasswordRules/index.d.ts +4 -4
  469. package/lib/PopConfirm/component.json +227 -0
  470. package/lib/PopConfirm/index.d.ts +1 -1
  471. package/lib/PopConfirm/index.js +1 -1
  472. package/lib/PopMenu/component.json +131 -0
  473. package/lib/PopMenu/hooks.d.ts +1 -1
  474. package/lib/PopMenu/index.js +1 -1
  475. package/lib/Popover/component.json +165 -0
  476. package/lib/Popover/index.js +1 -1
  477. package/lib/Progress/component.json +161 -0
  478. package/lib/Prompt/component.json +144 -0
  479. package/lib/Querying/component.json +96 -0
  480. package/lib/Querying/index.css +1 -1
  481. package/lib/Querying/index.d.ts +2 -2
  482. package/lib/Querying/index.js +1 -1
  483. package/lib/Querying/style/index.css +1 -1
  484. package/lib/QuickReply/component.json +129 -0
  485. package/lib/QuickReply/index.d.ts +1 -1
  486. package/lib/Radio/component.json +136 -0
  487. package/lib/RadioGroup/component.json +149 -0
  488. package/lib/RangeInput/component.json +198 -0
  489. package/lib/RangeInput/index.js +1 -1
  490. package/lib/Result/component.json +104 -0
  491. package/lib/ScrollBar/component.json +115 -0
  492. package/lib/Search/component.json +177 -0
  493. package/lib/Search/index.d.ts +1 -1
  494. package/lib/Select/component.json +244 -0
  495. package/lib/Select/index.js +1 -1
  496. package/lib/SelectInput/component.json +184 -0
  497. package/lib/Selector/component.json +203 -0
  498. package/lib/Selector/index.js +1 -1
  499. package/lib/Selector/interface.d.ts +1 -1
  500. package/lib/Selector/selectorMain/index.js +1 -1
  501. package/lib/Selector/selectorNode/index.js +1 -1
  502. package/lib/Selector/util.d.ts +2 -2
  503. package/lib/SelectorPicker/component.json +179 -0
  504. package/lib/SelectorPicker/index.d.ts +5 -5
  505. package/lib/SelectorPicker/index.js +1 -1
  506. package/lib/SingleBox/component.json +151 -0
  507. package/lib/SingleBox/index.d.ts +2 -2
  508. package/lib/Slider/component.json +181 -0
  509. package/lib/SortBox/component.json +108 -0
  510. package/lib/Status/component.json +104 -0
  511. package/lib/Stepper/component.json +129 -0
  512. package/lib/Stepper/index.d.ts +2 -2
  513. package/lib/Switch/component.json +207 -0
  514. package/lib/Switch/index.css +1 -1
  515. package/lib/Switch/index.d.ts +3 -2
  516. package/lib/Switch/index.js +1 -1
  517. package/lib/Switch/style/index.css +1 -1
  518. package/lib/Table/component.json +547 -0
  519. package/lib/Table/index.d.ts +2 -2
  520. package/lib/Table/index.js +1 -1
  521. package/lib/Table/interface.d.ts +6 -0
  522. package/lib/Tabs/component.json +227 -0
  523. package/lib/Tag/component.json +221 -0
  524. package/lib/Tag/index.css +1 -1
  525. package/lib/Tag/index.d.ts +1 -1
  526. package/lib/Tag/index.js +1 -1
  527. package/lib/Tag/style/index.css +1 -1
  528. package/lib/TextEditor/component.json +186 -0
  529. package/lib/TextEditor/index.d.ts +5 -5
  530. package/lib/TextField/component.json +290 -0
  531. package/lib/TextField/index.d.ts +2 -2
  532. package/lib/TimePicker/component.json +176 -0
  533. package/lib/Timeline/component.json +110 -0
  534. package/lib/Title/component.json +156 -0
  535. package/lib/ToggleButton/component.json +153 -0
  536. package/lib/Tooltip/component.json +176 -0
  537. package/lib/Tooltip/index.js +1 -1
  538. package/lib/Tooltip/interface.d.ts +14 -1
  539. package/lib/Tooltip/utils.js +1 -1
  540. package/lib/Transfer/component.json +157 -0
  541. package/lib/Tree/component.json +512 -0
  542. package/lib/Upload/component.json +450 -0
  543. package/lib/Utils/type.d.ts +0 -2
  544. package/lib/index.d.ts +2 -0
  545. package/lib/index.js +1 -1
  546. package/lib/locale/en_US.d.ts +361 -0
  547. package/lib/locale/en_US.js +2 -0
  548. package/lib/locale/index.d.ts +1 -723
  549. package/lib/locale/index2.js +2 -0
  550. package/lib/locale/zh_CN.d.ts +361 -0
  551. package/lib/locale/zh_CN.js +2 -0
  552. package/package.json +9 -3
  553. /package/es/{Utils/Hooks → Hooks}/useResizeObserver.d.ts +0 -0
  554. /package/es/{Utils/Hooks → Hooks}/useResizeObserver.js +0 -0
  555. /package/lib/{Utils/Hooks → Hooks}/useResizeObserver.d.ts +0 -0
  556. /package/lib/{Utils/Hooks → Hooks}/useResizeObserver.js +0 -0
@@ -0,0 +1,161 @@
1
+ {
2
+ "name": "Form",
3
+ "category": "Data Entry",
4
+ "description": "基于配置的高性能表单组件",
5
+ "semantic": {
6
+ "intent": [
7
+ "数据录入",
8
+ "数据编辑",
9
+ "数据校验"
10
+ ],
11
+ "useCases": [
12
+ "登录注册",
13
+ "配置设置",
14
+ "信息填写"
15
+ ],
16
+ "riskLevel": "high"
17
+ },
18
+ "variants": {
19
+ "horizontal": {
20
+ "meaning": "水平布局表单"
21
+ },
22
+ "vertical": {
23
+ "meaning": "垂直布局表单"
24
+ }
25
+ },
26
+ "states": [
27
+ "loading",
28
+ "submitting",
29
+ "error"
30
+ ],
31
+ "idealProps": {
32
+ "configList": {
33
+ "type": "configListProps",
34
+ "description": "表单项配置数组(`type configListProps = Array<FormItemProps>`,src/Form/index.tsx:20 已 export)。**FormItemProps 核心字段(完整见 docs/view/form/api.ts apiDataFormItemProps)**:\n• `name: string`(必填,唯一标识;onChange / backData 的 key 都对应该值)\n• `label: string | ((props: FormItemProps) => ReactNode)`(显示文案)\n• `InputType: 'default' | 'number' | 'textarea' | 'select' | 'radioGroup' | 'checkGroup' | 'switch' | 'file' | FC<ItemTypeProps>`(⚠️ 控件类型用 **InputType**,不是 type;type 是布局覆盖)\n• `defaultValue: any`(字段初始值;backData[name] 优先级更高)\n• `rules: { validate: { required?, maxlength?, minLength?, pattern?, [customKey]? }, message: { [key]: string } }`(⚠️ **注意大小写**:`maxlength` 小写 l;`minLength` 驼峰 L——src 命名不一致,写错会导致校验规则被忽略)\n• `list: Array<{label, name?|value?}>`(radioGroup/checkGroup 子项用 `name`;select 子项用 `value`)\n• `disabled: boolean`(单项禁用)\n• `hide: boolean`(隐藏该项)\n• `hideError: boolean`(隐藏该项内置 error UI)\n• `type: 'vertical' | 'horizontal'`(单项布局覆盖;与顶层 type 同名,仅控制布局,不影响控件类型)"
35
+ },
36
+ "backData": {
37
+ "type": "{ [name: string]: any }",
38
+ "description": "整表回填数据。比 configList 中每项的 defaultValue 优先级更高;切换到该新对象会刷新表单。常配合 form.refreshForm(undefined, newBackData) 实现『换数据源』场景"
39
+ },
40
+ "type": {
41
+ "type": "enum",
42
+ "values": [
43
+ "vertical",
44
+ "horizontal"
45
+ ],
46
+ "default": "horizontal",
47
+ "description": "**布局类型**(vertical=竖 / horizontal=横);configList 中每项的 `type` 字段可覆盖顶层布局。⚠️ **此处 type 仅控制布局,与控件类型无关**——控件类型用 FormItemProps.`InputType`(default/select/radioGroup 等)"
48
+ },
49
+ "disabled": {
50
+ "type": "boolean",
51
+ "default": false,
52
+ "description": "是否全局禁用所有 FormItem 输入控件——对所有 InputType(default/textarea/number/file/switch/select/radioGroup/checkGroup/自定义函数)都生效,FormItem 内部把顶层 disabled 透传给每项。disabled 期间用户交互被屏蔽,onChange 不触发;不影响 form.current.check / reset / clear 等命令式调用"
53
+ },
54
+ "onChange": {
55
+ "type": "function",
56
+ "signature": "(name: string, value: any) => void",
57
+ "description": "表单值改变回调——任意字段(任意 InputType)变化都触发。**name 参数 = 对应 configList 该项的 `name` 字段值**;value 为该字段当前值。**触发时机**:input 类等价 onInput 实时(非 onBlur);select/radioGroup/checkGroup 在用户选中瞬时;switch 在 toggle 瞬时。**初始 backData 注入不触发 onChange**(仅用户交互或 form.current.refreshForm 才触发)。该回调不携带校验状态,需校验请用 form.current.check?.()"
58
+ },
59
+ "form": {
60
+ "type": "React.MutableRefObject<FormRefObject>",
61
+ "description": "**命令式 ref**——通过 form.current 调用 check / reset / clear / refreshForm / getValidValues 等方法。**FormRefObject 字段完整列表**(DEFECT-001/002):check(校验,**返回 false | { [name]: any }**——失败返 false 不抛错;**成功返回的对象 key = configList 每项的 `name` 字段值**,扁平结构非嵌套)/ reset(重置到初始 backData/defaultValue)/ clear(清空全部或指定字段,签名 `(name?: string | string[]) => void`)/ items({ [name]: ItemTypeProps })/ values / refreshForm / refData / getValidValues(过滤 hide=true 与未通过校验的字段)。docs/view/form/api.ts 末尾 RefObject 表列出全部字段。**5.x 仅整表 check,无 checkField(name) 单字段校验 API**——逐字段实时校验需在父组件用 onChange 桥接 + 业务方复刻 validate 逻辑。**FormRefObject 已公开 export**(Form-DEFECT-001 起),通过 `import { FormRefObject } from '@para-ui/core'` 或 `import { FormRefObject } from '@para-ui/core/Form'` 获取精确类型;推荐声明:`const formRef = useRef<FormRefObject>({} as FormRefObject)`"
62
+ },
63
+ "getCheckForm": {
64
+ "type": "function",
65
+ "signature": "(checkFrom: Function) => void",
66
+ "description": "**与 form ref 是同一能力的双通路(DEFECT-005)**。回调式:组件挂载后调用 getCheckForm(check) 把 check 函数交给父组件。**推荐统一用 form ref**——getCheckForm 是历史回调式 API"
67
+ },
68
+ "getForcedRefresh": {
69
+ "type": "function",
70
+ "signature": "(setConfigHook: (configList: configListProps, bData?: { [name: string]: any }) => void) => void",
71
+ "description": "强制刷新配置回调(src/Form/index.tsx:96-102 interface 实证):组件挂载后将内部 setConfig 方法交给父组件;父组件可通过 setConfigHook(newConfigList, newBackData) 命令式刷新整个表单结构和回填数据。⚠️ **推荐改用 form ref.refreshForm**——getForcedRefresh 是历史 API,与 form ref 功能重叠"
72
+ },
73
+ "disOnlySpace": {
74
+ "type": "boolean",
75
+ "description": "是否禁止纯空格提交(src/Form/index.tsx:111 interface 实证):true 时 rules.validate.required + 纯空格内容也会校验失败"
76
+ },
77
+ "className": {
78
+ "type": "string",
79
+ "description": "表单容器自定义类名(src/Form/index.tsx:122 interface 实证)"
80
+ },
81
+ "labelWidth": {
82
+ "type": "number",
83
+ "description": "Label 区块宽度,仅在顶层 type='vertical' 时生效(src/Form/index.tsx:131 interface 实证)"
84
+ }
85
+ },
86
+ "do": [
87
+ "使用 configList 进行配置化开发以减少模版代码",
88
+ "利用 form ref 进行手动校验和数据获取(推荐 form 单一通路而非 getCheckForm 双通路)",
89
+ "提交场景:`const values = formRef.current.check?.(); if (!values) return; submit(values);`——check 校验失败返 false,不抛错",
90
+ "重置场景:调用 form.current.reset?.() 而非 refreshForm(schema, {})(DEFECT-002 reset 是真实存在的 API)",
91
+ "FormItem 字段默认值用 FormItemProps.defaultValue(DEFECT-003 已实现,docs api.ts apiDataFormItemProps 已补)",
92
+ "**FormItemProps.list 子项 key 命名按 InputType 选用**(DEFECT-008 + src 实证):radioGroup / checkGroup 用 `{ label, name }`(用户选中产生的值 = name);select 用 `{ label, value }`(用户选中产生的值 = value)",
93
+ "**rules.validate 合法 key**(src/FormItem/index.tsx:54-60 实证):`required` / **`maxlength`**(小写 L)/ **`minLength`**(驼峰 L,与 maxlength 命名不一致是 src 现状)/ `pattern` / `disOnlySpace` / 任意自定义 key(值为 `(item, val) => boolean | string`)。message 中 key 与 validate key 一一对应",
94
+ "需要把同步 `check()` 包成 Promise 时:`async () => { const v = formRef.current.check?.(); return v || null; }`——失败返 null 而非 reject,避免业务方两套错误处理(参见 codeString.ts asyncCheckDemo)",
95
+ "需要逐字段实时校验:用顶层 onChange 桥接(任意字段变化都触发)+ 业务方在父组件复刻一份 validate 逻辑——5.x 没有 checkField(name) 单字段校验 API",
96
+ "需要父组件接管错误显示(服务端 / 异步校验):更新 configList 对应项的 `errorMessage` 字段注入自定义错误文案(FormItem 优先展示此值,check() 内部错误被覆盖);清除时传 `errorMessage: ''` 或 `undefined`。若需彻底隐藏内置 error UI 改用外部渲染,则配合 `hideError: true` + 父组件自定义 UI(议题 discussions/Form-error-takeover.md)"
97
+ ],
98
+ "dont": [
99
+ "在 render 中动态改变 configList 结构(应保持引用稳定)",
100
+ "混用受控和非受控模式",
101
+ "不要假设 check() 失败抛异常或返回 undefined——失败时返回 false(DEFECT-006)",
102
+ "不要既传 form 又传 getCheckForm 混用双通路(DEFECT-005)——选 form 即可",
103
+ "**不要在 select 子项里用 `{ label, name }`**——select 内部读 `value` 字段,用 name 会导致选中后 onChange 不传值;checkGroup/radioGroup 反过来要用 name 不能用 value(DEFECT-008 + src 实证)",
104
+ "**不要在 rules.validate 中把 maxlength 写成 maxLength(驼峰 L)或把 minLength 写成 minlength(小写 L)**——src 字段名严格匹配,写错会导致校验规则被忽略;不一致是 src 现状",
105
+ "不要假设 onChange 触发时携带校验状态——onChange 仅传 (name, value),校验状态需主动调 form.current.check?.()",
106
+ "不要假设初始 backData 注入触发 onChange——src 实证仅用户交互或 form.current.refreshForm 触发"
107
+ ],
108
+ "events": {
109
+ "onChange": {
110
+ "signature": "(name: string, value: any) => void",
111
+ "asyncSupported": false,
112
+ "examples": [
113
+ "任意 FormItem 字段值变化时触发,name 是 configList 该项的 name 字段值",
114
+ "input 类等价 onInput 实时触发,select/radioGroup 在选中瞬时,switch 在 toggle 瞬时",
115
+ "桥接逐字段实时校验:拿到 (name, value) 后调 formRef.current.check?.() 触发整表校验"
116
+ ],
117
+ "commonMistakes": [
118
+ "假设回调签名是 (e, value) 类似 antd → 实际只有 (name, value) 两个参数",
119
+ "在 onChange 里直接做副作用而不通过 setState(破坏受控模式)",
120
+ "假设初始 backData 注入会触发 onChange → 不会,仅用户交互或 refreshForm 触发",
121
+ "假设 onChange 携带校验状态 → 不携带,需主动调 check?.()"
122
+ ]
123
+ }
124
+ },
125
+ "typescriptPitfalls": [
126
+ {
127
+ "issue": "FormRefObject 必须显式声明类型,否则 ref.current 推断为 unknown",
128
+ "wrong": "const formRef = useRef(null); formRef.current.check(); // 报 unknown 类型错",
129
+ "right": "import { FormRefObject } from '@para-ui/core'; const formRef = useRef<FormRefObject>({} as FormRefObject);"
130
+ },
131
+ {
132
+ "issue": "FormItem 控件类型字段叫 InputType 不是 type(type 是布局覆盖)",
133
+ "wrong": "configList: [{ name: 'age', label: '年龄', type: 'number' }] // type 在这里是布局,不是控件",
134
+ "right": "configList: [{ name: 'age', label: '年龄', InputType: 'number' }]"
135
+ },
136
+ {
137
+ "issue": "rules.validate 字段名大小写不一致(src 现状)",
138
+ "wrong": "rules: { validate: { maxLength: 10, minlength: 2 } } // 写错被忽略",
139
+ "right": "rules: { validate: { maxlength: 10, minLength: 2 } } // 注意:maxlength 小写 L,minLength 驼峰 L"
140
+ },
141
+ {
142
+ "issue": "list 子项的 key 名称按 InputType 选用",
143
+ "wrong": "InputType: 'select', list: [{ label: 'A', name: 'a' }] // select 读 value,name 被忽略",
144
+ "right": "InputType: 'select' → list: [{ label: 'A', value: 'a' }] // radioGroup/checkGroup 反过来用 name"
145
+ },
146
+ {
147
+ "issue": "check() 返回类型是 false | object,不是 boolean 也不抛异常",
148
+ "wrong": "const ok = formRef.current.check?.(); if (!ok) throw new Error('fail'); // ok 是 false | object",
149
+ "right": "const values = formRef.current.check?.(); if (!values) return; submit(values); // false 表失败,object 表成功并含字段值"
150
+ },
151
+ {
152
+ "issue": "configList 不接受 undefined (TS2345),空状态用 '' 或 []",
153
+ "wrong": "<Form configList={someUndefined} /> // 触发 TS2345: Argument of type 'undefined' is not assignable to '\"\" | FormItemProps[]'",
154
+ "right": "<Form configList={someValue || []} /> // 或 configList=''"
155
+ }
156
+ ],
157
+ "mapping": {
158
+ "realComponent": "Form",
159
+ "adapter": null
160
+ }
161
+ }
@@ -0,0 +1,171 @@
1
+ {
2
+ "name": "FormItem",
3
+ "category": "Data Entry",
4
+ "description": "表单项,通常作 FieldForm 子组件使用,形成\"校验/收集值/提交\"链路。可独立用但脱离 FieldForm 时不会自动校验。需 FormItem 自渲染控件请用 InputType prop。",
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
+ "default",
24
+ "error",
25
+ "validating"
26
+ ],
27
+ "idealProps": {
28
+ "name": {
29
+ "type": "string",
30
+ "description": "字段名(**仅 string,不支持 array 路径写法**)。需在 Form/FieldForm 上下文中保持唯一;不要传 `['user','address','city']`——会触发 TS2322。\n\n**字符串点路径协议**:`name` 可以写成 `'user.address.city'` 形式(TS 合法,不报错),但 FormItem 和 Form 均**不解析点路径**——表单聚合值是 `{ 'user.address.city': value }`(扁平 key,含字面量点),而**不是** `{ user: { address: { city: value } } }`(深度嵌套对象)。点路径字段可以正常传值、校验、回填,仅聚合 key 保持原字符串。这与 antd / rc-field-form 的 `name=['a','b','c']` 深度路径解析行为**不同**——本组件不做路径解析,只做 key 直传。若业务提交需要深度嵌套对象,在提交前自行将扁平结果转换(如 `{ 'user.address.city': 'Beijing' }` → `{ user: { address: { city: 'Beijing' } } }`),或改用 `FieldForm.Item`(支持 `name={['user','address','city']}` 数组路径)。"
31
+ },
32
+ "label": {
33
+ "type": "string | (props: FormItemProps) => ReactNode",
34
+ "description": "标签文案;可传字符串或函数式渲染。**不支持 null**——传 label={null} 会触发 TS2322。要『无 label』请使用 hideLabel。"
35
+ },
36
+ "hideLabel": {
37
+ "type": "boolean",
38
+ "default": false,
39
+ "description": "隐藏 label 区块(连同 label 占位一起去掉)。这是『无 label 字段』的正确写法。"
40
+ },
41
+ "rules": {
42
+ "type": "ruleType",
43
+ "description": "校验规则。**这是单个对象不是数组**(与 antd 的 rules: Rule[] 不同)。结构为 `{ validate: { required, maxlength, minLength, pattern, min, max, disOnlySpace, [自定义key]: fn }, message?: { required: '...', pattern: '...' } }`。 message 与 validate 中的 key 一一对应。校验函数签名 `(item, val, intl) => true | string`:返回 true 表示通过、返回字符串表示报错文案。**⚠️ 重要:脱离 FieldForm 独立使用时,rules 不会自动触发校验**——rules 仅渲染必填红星等视觉提示,required/pattern 等不会在 children 失焦/变更时执行;完整校验链路必须配合 FieldForm 上下文。"
44
+ },
45
+ "InputType": {
46
+ "type": "'default' | 'select' | 'switch' | 'textarea' | 'number' | 'file' | 'radioGroup' | 'checkGroup' | 'comboSelect' | ReactNode | FC",
47
+ "description": "FormItem 自动渲染输入控件的类型;不传 children 时按此类型渲染对应 paraui 组件。传 children 时 InputType 不生效(外部受控)。"
48
+ },
49
+ "inputProps": {
50
+ "type": "Record<string, any>",
51
+ "description": "InputType 渲染的内部控件透传 props(如 placeholder、options 等)。"
52
+ },
53
+ "type": {
54
+ "type": "'horizontal' | 'vertical'",
55
+ "values": [
56
+ "horizontal",
57
+ "vertical"
58
+ ],
59
+ "default": "'horizontal'",
60
+ "description": "label 与表单项的横纵布局。"
61
+ },
62
+ "labelWidth": {
63
+ "type": "number",
64
+ "description": "label 区块宽度(仅 type='vertical' 时生效)。"
65
+ },
66
+ "tips": {
67
+ "type": "string",
68
+ "description": "label 旁的 tooltip 提示文案。"
69
+ },
70
+ "hideError": {
71
+ "type": "boolean",
72
+ "default": false,
73
+ "description": "隐藏校验错误提示(不影响校验逻辑本身)。"
74
+ },
75
+ "defaultValue": {
76
+ "type": "any",
77
+ "description": "默认值。会被 FieldForm 的回填数据 backData 覆盖。"
78
+ },
79
+ "disabled": {
80
+ "type": "boolean",
81
+ "description": "InputType 渲染的控件是否禁用(仅自动渲染场景生效)。"
82
+ },
83
+ "change": {
84
+ "type": "(value: any) => void",
85
+ "description": "值变化回调(仅 InputType 自动渲染场景由内部 ItemType 触发;外部 children 受控时不会自动触发——需自己监听)。"
86
+ },
87
+ "children": {
88
+ "type": "ReactNode",
89
+ "description": "自定义渲染输入控件——FormItem **不会自动注入 value/onChange**,使用方需自行受控。传了 children 时 InputType 自动渲染分支会被跳过。"
90
+ },
91
+ "errorMessage": {
92
+ "type": "string",
93
+ "description": "**脱离 FieldForm 独立使用时的受控错误文案(父组件接管 pattern)**。独立使用时 FormItem 不会自动触发 rules 校验——rules 仅渲染必填红星。错误文案必须由父组件主动驱动:① 父组件自行执行校验逻辑(如在 onBlur 中判断);② 把校验结果写入 `errorMessage` prop(非空字符串 → 显示错误外壳;`''`/`null`/`undefined` → 清除错误状态)。不要同时传 `error` 或 `helperText`——独立使用场景统一用 `errorMessage`。"
94
+ },
95
+ "hide": {
96
+ "type": "boolean",
97
+ "description": "是否隐藏该表单项(src/FormItem/index.tsx:109 interface 实证)。hide=true 时 FormItem 不渲染(不占位),且 form.current.check() 和 form.current.getValidValues() 会跳过该字段。**与 CSS display:none 不同**——hide=true 时字段值不参与校验也不出现在提交结果中"
98
+ },
99
+ "className": {
100
+ "type": "string",
101
+ "description": "表单项容器自定义类名(src/FormItem/index.tsx:170 interface 实证)"
102
+ },
103
+ "itemType": {
104
+ "type": "'default' | 'select' | 'switch' | 'textarea' | 'number' | 'file' | 'radioGroup' | 'checkGroup' | 'comboSelect' | ReactNode | FC",
105
+ "description": "InputType 的别名(src/FormItem/index.tsx:74 interface 实证:itemType 与 InputType 同义,src 内部两者都检查)。**推荐用 InputType**——itemType 是历史命名,两者功能完全相同"
106
+ }
107
+ },
108
+ "do": [
109
+ "把 FormItem 作为 FieldForm 的子组件使用——形成完整的校验 + 提交链路",
110
+ "字段名仅传 string;嵌套字段在 FieldForm 层面用 schema 表达",
111
+ "校验规则用 paraui 自有 schema:`{ validate: { required: true, minLength: 8 }, message: { required: '请输入', minLength: '至少 8 位' } }`,不要传 `[{ required, message }]` 数组形式(会触发 TS2559)",
112
+ "无 label 字段使用 `hideLabel` 而不是 `label={null}`",
113
+ "需要自定义控件时把控件放在 children;需要自动渲染时用 InputType + inputProps",
114
+ "脱离 FieldForm 独立使用时:由父组件管理 children 的 value/onChange + 在父组件主动调用业务校验函数,把校验结果写入 FormItem 的 `errorMessage` prop 受控显示"
115
+ ],
116
+ "dont": [
117
+ "不要嵌套 FormItem",
118
+ "不要传 `name={['user', 'address', 'city']}`——name 仅 string",
119
+ "不要传 `label={null}`——会触发 TS2322;要无 label 用 `hideLabel`",
120
+ "不要按 antd 风格写 `rules={[{ required: true, message: '...' }]}`——会触发 TS2559;本组件 rules 是单对象 ruleType",
121
+ "不要假设 FormItem 自动给 children cloneElement 注入 value/onChange——本组件不做注入",
122
+ "不要期望 FormItem 在脱离 FieldForm 时自动触发 rules.validate.required 等校验——独立模式下 rules 仅作类型描述,业务校验需父组件主动驱动"
123
+ ],
124
+ "events": {
125
+ "change": {
126
+ "signature": "(value: any) => void",
127
+ "asyncSupported": false,
128
+ "examples": [
129
+ "change={(val) => setValue(val)} — 仅 InputType 自动渲染场景由内部 ItemType 触发;外部 children 受控时不会自动触发",
130
+ "InputType='select' 时 change 在用户选中选项时触发,value 为选中项的 value 字段值",
131
+ "InputType='switch' 时 change 在用户 toggle 时触发,value 为布尔值 true/false"
132
+ ],
133
+ "commonMistakes": [
134
+ "传了 children 还期望 change 自动触发——children 受控时 ItemType 不渲染,change 永不触发,需在 children 中自己监听",
135
+ "假设 change 签名与 onChange 相同是 (e) => void 原生事件——实际签名是 (value: any) => void,直接是值而非 event",
136
+ "脱离 FieldForm 独立使用时期望 change 携带字段名——change 只传 value,字段名需父组件通过 name 自行关联"
137
+ ]
138
+ }
139
+ },
140
+ "typescriptPitfalls": [
141
+ {
142
+ "issue": "FormItem.name 只接受 string,不能传数组路径",
143
+ "wrong": "const fieldName: string[] = ['user', 'address']; <FormItem name={fieldName} /> // TS2322 string[] 不能赋给 string",
144
+ "right": "<FormItem name='user.address' /> // 点路径字符串是合法的 string,但不会被解析为嵌套对象,聚合 key 保持原字符串形态"
145
+ },
146
+ {
147
+ "issue": "rules 是单对象不是数组——antd 风格写法 rules={[{required}]} 触发 TS2559",
148
+ "wrong": "<FormItem name='email' rules={[{ required: true, message: '必填' }]} /> // TS2559: Type '...[]' has no properties in common with ruleType",
149
+ "right": "<FormItem name='email' rules={{ validate: { required: true }, message: { required: '必填' } }} />"
150
+ },
151
+ {
152
+ "issue": "label 不支持传 null,要无 label 应用 hideLabel",
153
+ "wrong": "<FormItem name='code' label={null} /> // TS2322: Type 'null' is not assignable to 'string | (props: FormItemProps) => ReactNode'",
154
+ "right": "<FormItem name='code' hideLabel /> // 正确隐藏 label 区块"
155
+ },
156
+ {
157
+ "issue": "InputType 和 itemType 同时存在时,src 优先取 InputType(itemType 是别名)",
158
+ "wrong": "// 同时传两个不同值,期望 itemType 生效\n<FormItem name='x' itemType='select' InputType='default' /> // InputType 优先,select 不生效",
159
+ "right": "// 统一用 InputType,itemType 是历史别名\n<FormItem name='x' InputType='select' />"
160
+ },
161
+ {
162
+ "issue": "select 子项的 list 字段用 value,radioGroup/checkGroup 用 name——混用导致选中后 change 不传值",
163
+ "wrong": "InputType='select' list={[{label: 'A', name: 'a'}]} // select 读 value 字段,name 被忽略",
164
+ "right": "InputType='select' list={[{label: 'A', value: 'a'}]} // 而 radioGroup/checkGroup 用 name 字段"
165
+ }
166
+ ],
167
+ "mapping": {
168
+ "realComponent": "FormItem",
169
+ "adapter": null
170
+ }
171
+ }
@@ -0,0 +1,197 @@
1
+ {
2
+ "name": "FunctionModal",
3
+ "category": "Feedback",
4
+ "description": "函数式弹窗(命令式 Modal)。**通过 React Hook + Promise 工作,不是命令式静态方法**。典型场景:确认对话框、信息提示、错误警告、表单二次确认。**关键:必须先用 FunctionModalProvider 包裹应用根节点,然后在子组件用 useModal() Hook 拿到调用函数,调用返回 Promise<boolean>**",
5
+ "semantic": {
6
+ "intent": [
7
+ "命令式确认弹窗",
8
+ "Promise 驱动的对话流",
9
+ "全局唯一挂载点的临时 Modal"
10
+ ],
11
+ "useCases": [
12
+ "确认删除 / 重要操作前的二次确认",
13
+ "成功 / 失败 / 警告等系统通知",
14
+ "异步操作前的用户确认(checkFunction 拦截)",
15
+ "需要自动关闭 / 超时关闭的提示弹窗(getClose)"
16
+ ],
17
+ "riskLevel": "normal"
18
+ },
19
+ "protocolSummary": "**Hook + Provider + Promise 三件套**。不是 `FunctionModal({...})` 命令式调用!正确流程:\n1. 应用根节点用 `<FunctionModalProvider>{App}</FunctionModalProvider>` 包裹(挂载点,无之则 useModal 拿到 reject Promise)\n2. 子组件 `const modal = useModal();` 拿到调用函数\n3. `modal({ title, content, ... })` 触发,返回 `Promise<boolean>`(确认=true,取消=false)\n4. 用 `.then(ok => ...)` 或 `await modal({...})` 拿用户选择\n5. **不要传 onOk / onCancel**——FDialog 内部已硬接管点击事件,外部回调会被忽略(常见误解 M1)",
20
+ "controlledChannels": {
21
+ "openApi": {
22
+ "entryPoint": "import FunctionModal, { FunctionModalProvider } from '@para-ui/core/FunctionModal'",
23
+ "defaultExport": "FunctionModal 的 default export 实际就是 useModal —— 写 `import { useModal } from '@para-ui/core/FunctionModal'` 或 `import useModal from '@para-ui/core/FunctionModal'` 等效",
24
+ "callPattern": "const modal = useModal(); await modal({ title, content }); // 不是 FunctionModal({...})!",
25
+ "returnValue": "Promise<boolean> —— 用户点确定 resolve(true),点取消 / 关闭按钮 resolve(false)(除非 disCatchOnCancel=true 强制 true)"
26
+ },
27
+ "providerSetup": {
28
+ "where": "应用根节点(App.tsx / index.tsx),通常和路由 Provider 同层",
29
+ "code": "<FunctionModalProvider><App /></FunctionModalProvider>",
30
+ "ifMissing": "useModal() 返回的函数实际是 Promise.reject —— 调用任何 modal({...}) 都立即 reject,且无 UI 弹出"
31
+ },
32
+ "closeAllApi": {
33
+ "import": "import { useClose } from '@para-ui/core/FunctionModal'",
34
+ "signature": "const closeAll = useClose(); closeAll(); // 关闭页面上所有 FunctionModal 实例",
35
+ "useCase": "路由切换 / 全局登出时清空所有遗留弹窗"
36
+ }
37
+ },
38
+ "variants": {
39
+ "default": {
40
+ "meaning": "默认样式(无 variant 切换)"
41
+ }
42
+ },
43
+ "states": [
44
+ "open",
45
+ "closed"
46
+ ],
47
+ "idealProps": {
48
+ "title": {
49
+ "type": "string",
50
+ "description": "弹窗标题(注意 type 是 string,不是 ReactNode—— FDialog 内部把它当 string 传给底层 Modal)"
51
+ },
52
+ "content": {
53
+ "type": "ReactElement",
54
+ "description": "弹窗主体内容(可以是任意 JSX),与 context 字段二选一(context 是早期遗留命名,优先用 content)"
55
+ },
56
+ "context": {
57
+ "type": "ReactElement",
58
+ "description": "等价于 content(早期命名遗留),如果同时传 content 和 context,content 优先"
59
+ },
60
+ "size": {
61
+ "type": "enum",
62
+ "values": [
63
+ "sm",
64
+ "md",
65
+ "lg",
66
+ "auto",
67
+ "fullScreen"
68
+ ],
69
+ "default": "md",
70
+ "description": "弹窗尺寸,透传给底层 Modal 组件"
71
+ },
72
+ "checkFunction": {
73
+ "type": "() => boolean | Promise<boolean>",
74
+ "description": "**用户点确定按钮时先执行此函数,返回 true 才真正关闭弹窗 + resolve(true);返回 false 不关闭(可用于表单校验失败拦截)**。支持异步:return await api.validate()",
75
+ "useCase": "异步校验、二次拦截、表单提交前的服务端检查"
76
+ },
77
+ "getClose": {
78
+ "type": "(close: Function) => void",
79
+ "description": "**回调拿到这个弹窗实例的 close 方法**。用法:`getClose: (close) => { setTimeout(() => close(), 3000); }` 实现定时自动关闭。close 调用等价于用户点取消(resolve(false),除非 disCatchOnCancel)",
80
+ "useCase": "成功提示自动消失 / 外部主动关闭单个实例(不影响其他弹窗)"
81
+ },
82
+ "disCatchOnCancel": {
83
+ "type": "boolean",
84
+ "default": false,
85
+ "description": "**默认 false**:取消 / 关闭按钮触发 resolve(false)。设为 true:取消也 resolve(true)(异常关闭仍按确认处理)",
86
+ "useCase": "非常用,默认就够"
87
+ },
88
+ "ModalProps": {
89
+ "type": "ModalProps",
90
+ "description": "透传给底层 Modal 组件的完整 props,用于调整 mask / okText / cancelText / okButtonProps 等。**注意**:Modal 的 onClose / onOk / onCancel 已被 FDialog 硬接管,在 ModalProps 里写也无效"
91
+ }
92
+ },
93
+ "commonMisconceptions": {
94
+ "M1": {
95
+ "wrong": "把 FunctionModal 当 antd 的 Modal.confirm() 命令式静态方法用: `FunctionModal({ title, content, onOk })` 直接调用",
96
+ "result": "**TS 报错 TS2554 'Expected 0 arguments, but got 1'**——FunctionModal 的 default export 是 useModal Hook(无参函数),不接受参数。R20-R23 ai-test 100% fail 都是这个原因",
97
+ "fix": "改用 Hook 模式: `const modal = useModal(); modal({title, content})`。完整流程见 protocolSummary + completeExample"
98
+ },
99
+ "M2": {
100
+ "wrong": "在 modalOptions 里传 onOk / onCancel: `modal({ title, content, onOk: handleOk, onCancel: handleCancel })`",
101
+ "result": "**外部传的 onOk / onCancel 被 FDialog 内部硬覆盖**(`onCancel={() => onClose(listIndex)}` 强制接管),回调不触发。R20-R23 报告里 4 个 high 困惑都是这个",
102
+ "fix": "用 Promise 返回值: `modal({title, content}).then(ok => ok ? handleOk() : handleCancel())` 或 `const ok = await modal({...}); if (ok) handleOk(); else handleCancel();`"
103
+ },
104
+ "M3": {
105
+ "wrong": "忘记在应用根节点挂 `<FunctionModalProvider>`,直接在某个子组件用 useModal()",
106
+ "result": "**useModal() 拿到的是 Promise.reject 函数**——任何 modal({...}) 调用都立即 reject,且无 UI 弹出,且无报错(Promise reject 默认静默)",
107
+ "fix": "在 App.tsx 或 index.tsx 顶层加 `<FunctionModalProvider>{children}</FunctionModalProvider>` 包裹"
108
+ },
109
+ "M4": {
110
+ "wrong": "想要弹窗自动关闭就给 modalOptions 加 duration / autoClose 字段: `modal({ title, content, duration: 3000 })`",
111
+ "result": "**modalOptions 没有 duration / autoClose 字段**——TS 报错或字段被忽略",
112
+ "fix": "用 getClose 拿到 close handle 后自己定时: `modal({ title, content, getClose: (close) => setTimeout(close, 3000) })`(见 completeExample 的自动关闭用例)"
113
+ },
114
+ "M5": {
115
+ "wrong": "把 title 传 ReactNode: `modal({ title: <span>富文本</span>, content: ... })`",
116
+ "result": "title 的类型签名是 string,传 ReactNode 会渲染异常或 TS 报错",
117
+ "fix": "title 只用纯字符串。富文本标题放到 content 顶部用大字号样式区分"
118
+ }
119
+ },
120
+ "completeExample": "// 1. App 根节点挂 Provider (一次性)\n// App.tsx\nimport { FunctionModalProvider } from '@para-ui/core/FunctionModal';\nconst App: React.FC = () => (\n <FunctionModalProvider>\n <YourRoutesAndPages />\n </FunctionModalProvider>\n);\n\n// 2. 子组件用 useModal + Promise\nimport useModal from '@para-ui/core/FunctionModal';\nimport Button from '@para-ui/core/Button';\n\nconst DeleteButton: React.FC<{ onConfirm: () => void }> = ({ onConfirm }) => {\n const modal = useModal();\n const handleClick = async () => {\n const ok = await modal({\n title: '确认删除',\n content: <span>此操作不可恢复,确定要删除吗?</span>,\n size: 'sm'\n });\n if (ok) onConfirm();\n // 不需要 else 分支,取消时无操作\n };\n return <Button danger onClick={handleClick}>删除</Button>;\n};\n\n// 3. 进阶:自动关闭 + 异步校验\nconst AdvancedDemo: React.FC = () => {\n const modal = useModal();\n const showAutoClose = () => {\n modal({\n title: '操作成功',\n content: '3 秒后自动关闭',\n getClose: (close) => setTimeout(close, 3000)\n });\n };\n const showWithCheck = async () => {\n const ok = await modal({\n title: '提交订单',\n content: '提交后需调用支付接口',\n checkFunction: async () => {\n const result = await api.validatePayment();\n return result.canProceed; // false 时弹窗不关闭\n }\n });\n if (ok) console.log('支付成功');\n };\n return (\n <>\n <Button onClick={showAutoClose}>成功提示</Button>\n <Button onClick={showWithCheck}>带校验的确认</Button>\n </>\n );\n};",
121
+ "do": [
122
+ "**先在 App 根节点挂 `<FunctionModalProvider>` 一次**,然后在任何子组件用 useModal()",
123
+ "**用 Promise 返回值拿用户选择**:`const ok = await modal({...})` 或 `modal({...}).then(ok => ...)`",
124
+ "异步校验拦截关闭:用 `checkFunction: async () => boolean`",
125
+ "自动关闭:`getClose: (close) => setTimeout(close, ms)`",
126
+ "全局清空所有弹窗:`const closeAll = useClose(); closeAll();`(路由切换时调用)"
127
+ ],
128
+ "dont": [
129
+ "**不要**直接调用 `FunctionModal({title, ...})`——它是 Hook,不是命令式函数(M1)",
130
+ "**不要**传 onOk / onCancel——内部硬接管,不会触发(M2)",
131
+ "**不要**忘记挂 FunctionModalProvider——会导致 Promise 静默 reject(M3)",
132
+ "**不要**期望 modalOptions 有 duration / autoClose 字段——用 getClose 实现(M4)",
133
+ "**不要**给 title 传 ReactNode——title 类型是 string(M5)",
134
+ "复杂表单场景请用 Modal 直接控制 open/close,不要用 FunctionModal"
135
+ ],
136
+ "events": {
137
+ "useModal": {
138
+ "signature": "() => (options: modalOptions) => Promise<boolean>",
139
+ "asyncSupported": true,
140
+ "examples": [
141
+ "const modal = useModal(); const ok = await modal({ title: '确认删除', content: <span>操作不可撤销</span> }); if (ok) doDelete(); — 标准 await 用法",
142
+ "modal({ title: '提示', content: '操作完成', getClose: (close) => setTimeout(close, 3000) }) — 自动关闭不需要等待 Promise",
143
+ "const ok = await modal({ title: '提交', content: '...', checkFunction: async () => await api.validate() }); — checkFunction 拦截异步校验"
144
+ ],
145
+ "commonMistakes": [
146
+ "直接调用 FunctionModal({...}) 而不是先 useModal() 再调用——FunctionModal default export 是 Hook 本身,不是可调用函数",
147
+ "在 modalOptions 里传 onOk/onCancel 期望回调——FDialog 内部硬接管,回调不触发,应用 Promise 返回值",
148
+ "忘记在 App 根节点挂 <FunctionModalProvider>——useModal() 返回的函数是 Promise.reject,调用时立即 reject 且无 UI"
149
+ ]
150
+ },
151
+ "useClose": {
152
+ "signature": "() => () => void",
153
+ "asyncSupported": false,
154
+ "examples": [
155
+ "const closeAll = useClose(); closeAll(); — 关闭当前页面所有 FunctionModal 实例",
156
+ "路由切换时调用:useEffect(() => { return () => closeAll(); }, [pathname]); — 离开页面清空遗留弹窗",
157
+ "登出时全局清空:const closeAll = useClose(); onLogout(() => closeAll());"
158
+ ],
159
+ "commonMistakes": [
160
+ "期望 useClose 关闭单个弹窗——useClose 关闭所有实例,关闭单个需用 getClose 拿到单实例 close 函数",
161
+ "在 FunctionModalProvider 外部调用 useClose——useClose 内部引用 setState 模块变量,Provider 未挂载时 setState 为 undefined,调用报错",
162
+ "多次调用 useClose() 拿多个 closeAll 函数——结果等价,均是同一 setState 引用"
163
+ ]
164
+ }
165
+ },
166
+ "typescriptPitfalls": [
167
+ {
168
+ "issue": "FunctionModal default export 是 useModal Hook,不能当命令式函数直接调用",
169
+ "wrong": "import FunctionModal from '@para-ui/core/FunctionModal'; FunctionModal({ title: '确认', content: <p>内容</p> }); // TS2554: Expected 0 arguments, but got 1",
170
+ "right": "import useModal from '@para-ui/core/FunctionModal'; const modal = useModal(); await modal({ title: '确认', content: <p>内容</p> });"
171
+ },
172
+ {
173
+ "issue": "modalOptions.title 类型是 string,不是 ReactNode,传 JSX 会报 TS 错误",
174
+ "wrong": "modal({ title: <span>富文本<b>标题</b></span>, content: <p>内容</p> }); // title 类型签名是 string",
175
+ "right": "modal({ title: '标题', content: <><h3>富文本标题</h3><p>内容</p></> }); // 把富文本放到 content 顶部"
176
+ },
177
+ {
178
+ "issue": "checkFunction 返回 false 不关闭弹窗,但异步返回 void/undefined 等同于 falsy 也不关闭",
179
+ "wrong": "checkFunction={async () => { await doSomething(); }} // 没有 return,隐式返回 undefined → 弹窗不关闭",
180
+ "right": "checkFunction={async () => { await doSomething(); return true; }} // 明确 return true 才关闭"
181
+ },
182
+ {
183
+ "issue": "modalOptions 不包含 duration/autoClose 字段——自动关闭需用 getClose 回调",
184
+ "wrong": "modal({ title: '成功', content: '已保存', duration: 2000 }); // TS2353: duration does not exist in type modalOptions",
185
+ "right": "modal({ title: '成功', content: '已保存', getClose: (close) => setTimeout(close, 2000) }); // 用 getClose + setTimeout 实现"
186
+ },
187
+ {
188
+ "issue": "useModal 在 FunctionModalProvider 外部调用返回的函数立即 reject,无 UI 弹出",
189
+ "wrong": "// 忘记在 App 根包 Provider,子组件直接用 useModal\nconst modal = useModal(); modal({...}); // 静默 reject,Promise rejected 但没有 catch 不报错",
190
+ "right": "// App.tsx 包 Provider 后子组件才能正常用\n<FunctionModalProvider><App /></FunctionModalProvider>"
191
+ }
192
+ ],
193
+ "mapping": {
194
+ "realComponent": "FunctionModal",
195
+ "adapter": null
196
+ }
197
+ }