@_tc/template-core 0.0.1-bate.36 → 0.0.1-bate.38

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 (419) hide show
  1. package/cjs/app/controller/base.js +3 -3
  2. package/cjs/app/controller/project.js +1 -1
  3. package/cjs/app/controller/view.js +16 -7
  4. package/cjs/app/middleware/api-params-verify.js +10 -1
  5. package/cjs/app/middleware/error-handle.js +9 -3
  6. package/cjs/app/middleware/project-handler.js +1 -1
  7. package/cjs/app/router/view.js +3 -1
  8. package/cjs/app/router-schema/project.js +1 -1
  9. package/cjs/app/service/project.js +5 -0
  10. package/cjs/bundler/defaultAlias.js +5 -0
  11. package/cjs/bundler/dev.js +4 -3
  12. package/cjs/bundler/index.js +2 -1
  13. package/cjs/bundler/prod.js +4 -3
  14. package/cjs/bundler/utils.js +52 -23
  15. package/cjs/packages/common/LRUCache.js +4 -0
  16. package/cjs/packages/common/array/index.js +43 -0
  17. package/cjs/packages/common/cache/LRUCache.js +45 -0
  18. package/cjs/packages/common/cache/index.js +4 -0
  19. package/cjs/packages/common/guards/index.js +34 -0
  20. package/cjs/packages/common/i18n/default.js +95 -0
  21. package/cjs/packages/common/i18n/en-US.js +95 -0
  22. package/cjs/packages/common/i18n/index.js +178 -0
  23. package/cjs/packages/common/i18n/locales.js +17 -0
  24. package/cjs/packages/common/i18n/types.js +1 -0
  25. package/cjs/packages/common/index.js +65 -0
  26. package/cjs/packages/common/log/index.js +160 -0
  27. package/cjs/packages/common/number/index.js +14 -0
  28. package/cjs/packages/common/object/filterEmpty.js +32 -0
  29. package/cjs/packages/common/object/filtereEmpty.js +5 -0
  30. package/cjs/packages/common/object/index.js +26 -0
  31. package/cjs/packages/common/string/index.js +17 -0
  32. package/cjs/packages/common/types/index.js +1 -0
  33. package/cjs/packages/core/index.js +18 -13
  34. package/cjs/packages/core/loader/config.js +4 -2
  35. package/cjs/packages/core/loader/controller.js +2 -3
  36. package/cjs/packages/core/loader/extend.js +1 -2
  37. package/cjs/packages/core/loader/middleware.js +2 -3
  38. package/cjs/packages/core/loader/model.js +10 -6
  39. package/cjs/packages/core/loader/router-schema.js +4 -2
  40. package/cjs/packages/core/loader/router.js +24 -11
  41. package/cjs/packages/core/loader/service.js +2 -2
  42. package/cjs/packages/utils/runFileFn.js +46 -1
  43. package/esm/app/controller/base.js +3 -3
  44. package/esm/app/controller/project.js +3 -3
  45. package/esm/app/controller/view.js +16 -7
  46. package/esm/app/middleware/api-params-verify.js +10 -1
  47. package/esm/app/middleware/error-handle.js +9 -3
  48. package/esm/app/middleware/project-handler.js +1 -1
  49. package/esm/app/router/view.js +3 -1
  50. package/esm/app/router-schema/project.js +1 -1
  51. package/esm/app/service/project.js +5 -0
  52. package/esm/bundler/defaultAlias.js +4 -0
  53. package/esm/bundler/dev.js +4 -3
  54. package/esm/bundler/index.js +2 -1
  55. package/esm/bundler/prod.js +4 -3
  56. package/esm/bundler/utils.js +52 -23
  57. package/esm/index.js +2 -2
  58. package/esm/packages/common/LRUCache.js +2 -0
  59. package/esm/packages/common/array/index.js +37 -0
  60. package/esm/packages/common/cache/LRUCache.js +43 -0
  61. package/esm/packages/common/cache/index.js +2 -0
  62. package/esm/packages/common/guards/index.js +26 -0
  63. package/esm/packages/common/i18n/default.js +93 -0
  64. package/esm/packages/common/i18n/en-US.js +93 -0
  65. package/esm/packages/common/i18n/index.js +162 -0
  66. package/esm/packages/common/i18n/locales.js +11 -0
  67. package/esm/packages/common/i18n/types.js +0 -0
  68. package/esm/packages/common/index.js +13 -0
  69. package/esm/packages/common/log/index.js +146 -0
  70. package/esm/packages/common/number/index.js +11 -0
  71. package/esm/packages/common/object/filterEmpty.js +29 -0
  72. package/esm/packages/common/object/filtereEmpty.js +2 -0
  73. package/esm/packages/common/object/index.js +20 -0
  74. package/esm/packages/common/string/index.js +13 -0
  75. package/esm/packages/common/types/index.js +0 -0
  76. package/esm/packages/core/index.js +18 -14
  77. package/esm/packages/core/loader/config.js +4 -3
  78. package/esm/packages/core/loader/controller.js +2 -4
  79. package/esm/packages/core/loader/extend.js +1 -3
  80. package/esm/packages/core/loader/middleware.js +2 -4
  81. package/esm/packages/core/loader/model.js +10 -7
  82. package/esm/packages/core/loader/router-schema.js +4 -3
  83. package/esm/packages/core/loader/router.js +24 -12
  84. package/esm/packages/core/loader/service.js +2 -3
  85. package/esm/packages/utils/runFileFn.js +47 -1
  86. package/fe/frontend/dash/Dashboard.d.ts +7 -0
  87. package/fe/frontend/dash/Dashboard.js +73 -0
  88. package/fe/frontend/dash/dash.entry.d.ts +2 -0
  89. package/fe/frontend/dash/dash.entry.js +80 -0
  90. package/fe/frontend/index.d.ts +3 -0
  91. package/fe/frontend/index.js +1 -0
  92. package/fe/frontend/main.css +2 -184
  93. package/fe/frontend/main.d.ts +10 -3
  94. package/fe/frontend/main.js +15 -4
  95. package/fe/frontend/testPage/testPage.entry.js +1 -2
  96. package/fe/frontend/typing/window.d.ts +7 -0
  97. package/fe/frontend/typing/window.js +1 -0
  98. package/fe/frontend/widgets/api/baseInfo.d.ts +31 -0
  99. package/fe/frontend/widgets/api/baseInfo.js +15 -0
  100. package/fe/frontend/widgets/common/CRUD/CRUD.d.ts +70 -0
  101. package/fe/frontend/widgets/common/CRUD/CRUD.js +208 -0
  102. package/fe/frontend/widgets/common/CRUD/index.d.ts +2 -0
  103. package/fe/frontend/widgets/common/CRUD/index.js +1 -0
  104. package/fe/frontend/widgets/common/auth/index.d.ts +7 -0
  105. package/fe/frontend/widgets/common/auth/index.js +20 -0
  106. package/fe/frontend/widgets/common/generateMenuData.d.ts +4 -0
  107. package/fe/frontend/widgets/common/generateMenuData.js +14 -0
  108. package/fe/frontend/widgets/common/importComponent.d.ts +5 -0
  109. package/fe/frontend/widgets/common/importComponent.js +8 -0
  110. package/fe/frontend/widgets/common/language.d.ts +2 -0
  111. package/fe/frontend/widgets/common/language.js +9 -0
  112. package/fe/frontend/widgets/common/logFn/index.d.ts +4 -0
  113. package/fe/frontend/widgets/common/logFn/index.js +8 -0
  114. package/fe/frontend/widgets/common/menu.d.ts +34 -0
  115. package/fe/frontend/widgets/common/menu.js +101 -0
  116. package/fe/frontend/widgets/common/request.d.ts +36 -0
  117. package/fe/frontend/widgets/common/request.js +133 -0
  118. package/fe/frontend/widgets/components/BasePage/HeaderView.d.ts +9 -0
  119. package/fe/frontend/widgets/components/BasePage/HeaderView.js +16 -0
  120. package/fe/frontend/widgets/components/Router/index.d.ts +9 -0
  121. package/fe/frontend/widgets/components/Router/index.js +11 -0
  122. package/fe/frontend/widgets/components/Router/type.d.ts +2 -0
  123. package/fe/frontend/widgets/components/Router/type.js +1 -0
  124. package/fe/frontend/widgets/defaultPages/Iframe/index.d.ts +3 -0
  125. package/fe/frontend/widgets/defaultPages/Iframe/index.js +14 -0
  126. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/DetailPanel.d.ts +7 -0
  127. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/DetailPanel.js +94 -0
  128. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/PopFrom.d.ts +13 -0
  129. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/PopFrom.js +124 -0
  130. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/data.d.ts +3 -0
  131. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/data.js +6 -0
  132. package/fe/frontend/widgets/defaultPages/Schema/components/SchemaSearch/index.d.ts +3 -0
  133. package/fe/frontend/widgets/defaultPages/Schema/components/SchemaSearch/index.js +63 -0
  134. package/fe/frontend/widgets/defaultPages/Schema/components/SchemaTable/index.d.ts +11 -0
  135. package/fe/frontend/widgets/defaultPages/Schema/components/SchemaTable/index.js +188 -0
  136. package/fe/frontend/widgets/defaultPages/Schema/data/eventInfo.d.ts +8 -0
  137. package/fe/frontend/widgets/defaultPages/Schema/data/eventInfo.js +6 -0
  138. package/fe/frontend/widgets/defaultPages/Schema/data/index.d.ts +3 -0
  139. package/fe/frontend/widgets/defaultPages/Schema/data/index.js +1 -0
  140. package/fe/frontend/widgets/defaultPages/Schema/hooks/useComConfig.d.ts +10 -0
  141. package/fe/frontend/widgets/defaultPages/Schema/hooks/useComConfig.js +14 -0
  142. package/fe/frontend/widgets/defaultPages/Schema/index.d.ts +3 -0
  143. package/fe/frontend/widgets/defaultPages/Schema/index.js +74 -0
  144. package/fe/frontend/widgets/defaultPages/Schema/schemaType.d.ts +50 -0
  145. package/fe/frontend/widgets/defaultPages/Schema/schemaType.js +4 -0
  146. package/fe/frontend/widgets/defaultPages/Schema/stores/schemaEventBus.d.ts +42 -0
  147. package/fe/frontend/widgets/defaultPages/Schema/stores/schemaEventBus.js +70 -0
  148. package/fe/frontend/widgets/defaultPages/Schema/stores/schemaStore.d.ts +47 -0
  149. package/fe/frontend/widgets/defaultPages/Schema/stores/schemaStore.js +26 -0
  150. package/fe/frontend/widgets/defaultPages/Schema/utils/fetchErrorShow.d.ts +3 -0
  151. package/fe/frontend/widgets/defaultPages/Schema/utils/fetchErrorShow.js +8 -0
  152. package/fe/frontend/widgets/defaultPages/Schema/utils/permissions.d.ts +3 -0
  153. package/fe/frontend/widgets/defaultPages/Schema/utils/permissions.js +3 -0
  154. package/fe/frontend/widgets/defaultPages/Schema/utils/schemaConversion.d.ts +3 -0
  155. package/fe/frontend/widgets/defaultPages/Schema/utils/schemaConversion.js +115 -0
  156. package/fe/frontend/widgets/defaultPages/Schema/utils/validator.d.ts +7 -0
  157. package/fe/frontend/widgets/defaultPages/Schema/utils/validator.js +36 -0
  158. package/fe/frontend/widgets/defaultPages/SidebarSlotPage/SidebarSlotContainer.d.ts +10 -0
  159. package/fe/frontend/widgets/defaultPages/SidebarSlotPage/SidebarSlotContainer.js +38 -0
  160. package/fe/frontend/widgets/defaultPages/SidebarSlotPage/index.d.ts +3 -0
  161. package/fe/frontend/widgets/defaultPages/SidebarSlotPage/index.js +16 -0
  162. package/fe/frontend/widgets/defaultPages/SidebarSlotPageTmp.d.ts +3 -0
  163. package/fe/frontend/widgets/defaultPages/SidebarSlotPageTmp.js +17 -0
  164. package/fe/frontend/widgets/defaultPages/SlotPage/index.d.ts +3 -0
  165. package/fe/frontend/widgets/defaultPages/SlotPage/index.js +26 -0
  166. package/fe/frontend/widgets/defaultPages/Todo.d.ts +3 -0
  167. package/fe/frontend/widgets/defaultPages/Todo.js +5 -0
  168. package/fe/frontend/widgets/hooks/useCurrentMenuData.d.ts +19 -0
  169. package/fe/frontend/widgets/hooks/useCurrentMenuData.js +28 -0
  170. package/fe/frontend/widgets/hooks/useRouterParams.d.ts +5 -0
  171. package/fe/frontend/widgets/hooks/useRouterParams.js +11 -0
  172. package/fe/frontend/widgets/store/mode.d.ts +19 -0
  173. package/fe/frontend/widgets/store/mode.js +37 -0
  174. package/fe/model/types/data/button.d.ts +32 -0
  175. package/fe/model/types/data/button.js +16 -0
  176. package/fe/model/types/data/component.d.ts +61 -0
  177. package/fe/model/types/data/component.js +11 -0
  178. package/fe/model/types/data/fetchInfo.d.ts +20 -0
  179. package/fe/model/types/data/fetchInfo.js +1 -0
  180. package/fe/model/types/data/schema.d.ts +98 -0
  181. package/fe/model/types/data/schema.js +1 -0
  182. package/fe/model/types/data/search.d.ts +7 -0
  183. package/fe/model/types/data/search.js +1 -0
  184. package/fe/model/types/menuType.d.ts +73 -0
  185. package/fe/model/types/menuType.js +1 -0
  186. package/fe/model/types/model.d.ts +33 -0
  187. package/fe/model/types/model.js +1 -0
  188. package/fe/packages/common/array/index.d.ts +7 -0
  189. package/fe/packages/common/array/index.js +40 -0
  190. package/fe/packages/common/cache/LRUCache.d.ts +13 -0
  191. package/fe/packages/common/cache/LRUCache.js +47 -0
  192. package/fe/packages/common/cache/index.d.ts +2 -0
  193. package/fe/packages/common/cache/index.js +1 -0
  194. package/fe/packages/common/guards/index.d.ts +9 -0
  195. package/fe/packages/common/guards/index.js +24 -0
  196. package/fe/packages/common/i18n/default.d.ts +92 -0
  197. package/fe/packages/common/i18n/default.js +90 -0
  198. package/fe/packages/common/i18n/en-US.d.ts +92 -0
  199. package/fe/packages/common/i18n/en-US.js +90 -0
  200. package/fe/packages/common/i18n/index.d.ts +43 -0
  201. package/fe/packages/common/i18n/index.js +173 -0
  202. package/fe/packages/common/i18n/locales.d.ts +8 -0
  203. package/fe/packages/common/i18n/locales.js +10 -0
  204. package/fe/packages/common/i18n/types.d.ts +71 -0
  205. package/fe/packages/common/i18n/types.js +1 -0
  206. package/fe/packages/common/index.d.ts +10 -0
  207. package/fe/packages/common/index.js +9 -0
  208. package/fe/packages/common/log/index.d.ts +33 -0
  209. package/fe/packages/common/log/index.js +176 -0
  210. package/fe/packages/common/number/index.d.ts +3 -0
  211. package/fe/packages/common/number/index.js +10 -0
  212. package/fe/packages/common/object/filterEmpty.d.ts +3 -0
  213. package/fe/packages/common/object/filterEmpty.js +33 -0
  214. package/fe/packages/common/object/index.d.ts +5 -0
  215. package/fe/packages/common/object/index.js +25 -0
  216. package/fe/packages/common/string/index.d.ts +4 -0
  217. package/fe/packages/common/string/index.js +17 -0
  218. package/fe/packages/common/types/index.d.ts +4 -0
  219. package/fe/packages/common/types/index.js +1 -0
  220. package/fe/packages/ui/react/components/Button/Button.d.ts +29 -10
  221. package/fe/packages/ui/react/components/Button/Button.js +53 -23
  222. package/fe/packages/ui/react/components/Button/SumbitButton.d.ts +2 -2
  223. package/fe/packages/ui/react/components/Button/SumbitButton.js +3 -10
  224. package/fe/packages/ui/react/components/Button/index.d.ts +1 -1
  225. package/fe/packages/ui/react/components/Checkbox/Checkbox.d.ts +1 -1
  226. package/fe/packages/ui/react/components/Checkbox/Checkbox.js +5 -3
  227. package/fe/packages/ui/react/components/ConfirmDialog/ConfirmDialog.js +11 -0
  228. package/fe/packages/ui/react/components/ConfirmDialog/index.d.ts +2 -0
  229. package/fe/packages/ui/react/components/ConfirmDialog/index.js +1 -0
  230. package/fe/packages/ui/react/components/DataTable/ActionBtn.d.ts +3 -1
  231. package/fe/packages/ui/react/components/DataTable/ActionBtn.js +85 -4
  232. package/fe/packages/ui/react/components/DataTable/{data-table.d.ts → index.d.ts} +10 -4
  233. package/fe/packages/ui/react/components/DataTable/{data-table.js → index.js} +58 -44
  234. package/fe/packages/ui/react/components/Date/Calendar.js +4 -3
  235. package/fe/packages/ui/react/components/Date/Date.d.ts +5 -3
  236. package/fe/packages/ui/react/components/Date/Date.js +71 -48
  237. package/fe/packages/ui/react/components/Date/TimePicker.js +3 -1
  238. package/fe/packages/ui/react/components/Date/dropdownPositioning.d.ts +3 -0
  239. package/fe/packages/ui/react/components/Date/dropdownPositioning.js +12 -0
  240. package/fe/packages/ui/react/components/Date/locales.d.ts +1 -0
  241. package/fe/packages/ui/react/components/Date/locales.js +7 -38
  242. package/fe/packages/ui/react/components/Drawer/Drawer.d.ts +29 -0
  243. package/fe/packages/ui/react/components/Drawer/Drawer.js +100 -0
  244. package/fe/packages/ui/react/components/Drawer/index.d.ts +3 -0
  245. package/fe/packages/ui/react/components/Drawer/index.js +1 -0
  246. package/fe/packages/ui/react/components/Dropdown/Dropdown.d.ts +25 -0
  247. package/fe/packages/ui/react/components/Dropdown/Dropdown.js +28 -0
  248. package/fe/packages/ui/react/components/Dropdown/index.d.ts +2 -0
  249. package/fe/packages/ui/react/components/Dropdown/index.js +1 -0
  250. package/fe/packages/ui/react/components/Form/Form.js +1 -1
  251. package/fe/packages/ui/react/components/Form/FormItem.js +1 -1
  252. package/fe/packages/ui/react/components/Form/SchemaForm/data.d.ts +45 -0
  253. package/fe/packages/ui/react/components/Form/{SchemeForm → SchemaForm}/data.js +9 -1
  254. package/fe/packages/ui/react/components/Form/{SchemeForm → SchemaForm}/index.d.ts +15 -14
  255. package/fe/packages/ui/react/components/Form/SchemaForm/index.js +79 -0
  256. package/fe/packages/ui/react/components/Form/index.d.ts +1 -1
  257. package/fe/packages/ui/react/components/Form/index.js +1 -1
  258. package/fe/packages/ui/react/components/ImagePreview/ImagePreview.js +15 -12
  259. package/fe/packages/ui/react/components/ImagePreview/PreviewImage.js +5 -2
  260. package/fe/packages/ui/react/components/Input/Input.d.ts +5 -1
  261. package/fe/packages/ui/react/components/Input/Input.js +5 -4
  262. package/fe/packages/ui/react/components/InputNumber/InputNumber.d.ts +28 -0
  263. package/fe/packages/ui/react/components/InputNumber/InputNumber.js +144 -0
  264. package/fe/packages/ui/react/components/InputNumber/index.d.ts +2 -0
  265. package/fe/packages/ui/react/components/InputNumber/index.js +1 -0
  266. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.d.ts +30 -0
  267. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.js +63 -0
  268. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.d.ts +2 -0
  269. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.js +27 -0
  270. package/fe/packages/ui/react/components/Label/Label.js +2 -2
  271. package/fe/packages/ui/react/components/Menu/Menu.d.ts +18 -0
  272. package/fe/packages/ui/react/components/Menu/Menu.js +102 -0
  273. package/fe/packages/ui/react/components/Menu/MenuContext.d.ts +39 -0
  274. package/fe/packages/ui/react/components/Menu/MenuContext.js +97 -0
  275. package/fe/packages/ui/react/components/Menu/MenuItem.d.ts +3 -0
  276. package/fe/packages/ui/react/components/Menu/MenuItem.js +33 -0
  277. package/fe/packages/ui/react/components/Menu/SubMenu.d.ts +10 -0
  278. package/fe/packages/ui/react/components/Menu/SubMenu.js +169 -0
  279. package/fe/packages/ui/react/components/Menu/index.d.ts +9 -0
  280. package/fe/packages/ui/react/components/Menu/index.js +5 -0
  281. package/fe/packages/ui/react/components/Menu/menuTypes.d.ts +59 -0
  282. package/fe/packages/ui/react/components/Menu/menuTypes.js +1 -0
  283. package/fe/packages/ui/react/components/Menu/utils.d.ts +2 -0
  284. package/fe/packages/ui/react/components/Menu/utils.js +7 -0
  285. package/fe/packages/ui/react/components/Message/Message.js +4 -1
  286. package/fe/packages/ui/react/components/Modal/Modal.d.ts +3 -1
  287. package/fe/packages/ui/react/components/Modal/Modal.js +6 -43
  288. package/fe/packages/ui/react/components/Modal/ModalManager.js +4 -3
  289. package/fe/packages/ui/react/components/Overlay/Overlay.d.ts +23 -0
  290. package/fe/packages/ui/react/components/Overlay/Overlay.js +53 -0
  291. package/fe/packages/ui/react/components/Overlay/index.d.ts +3 -0
  292. package/fe/packages/ui/react/components/Overlay/index.js +1 -0
  293. package/fe/packages/ui/react/components/{Pagination.js → Pagination/Pagination.js} +4 -4
  294. package/fe/packages/ui/react/components/Pagination/index.d.ts +2 -0
  295. package/fe/packages/ui/react/components/Pagination/index.js +1 -0
  296. package/fe/packages/ui/react/components/Popup/Popup.d.ts +26 -0
  297. package/fe/packages/ui/react/components/Popup/Popup.js +81 -0
  298. package/fe/packages/ui/react/components/Popup/index.d.ts +2 -0
  299. package/fe/packages/ui/react/components/Popup/index.js +1 -0
  300. package/fe/packages/ui/react/components/Search/Search.d.ts +2 -2
  301. package/fe/packages/ui/react/components/Search/Search.js +3 -3
  302. package/fe/packages/ui/react/components/Select/Select.d.ts +5 -0
  303. package/fe/packages/ui/react/components/Select/Select.js +52 -109
  304. package/fe/packages/ui/react/components/Select/dropdownPositioning.d.ts +3 -0
  305. package/fe/packages/ui/react/components/Select/dropdownPositioning.js +13 -0
  306. package/fe/packages/ui/react/components/Skeleton/Skeleton.js +2 -2
  307. package/fe/packages/ui/react/components/Switch/Switch.js +3 -1
  308. package/fe/packages/ui/react/components/TableSearch/TableSearch.d.ts +5 -4
  309. package/fe/packages/ui/react/components/TableSearch/TableSearch.js +23 -21
  310. package/fe/packages/ui/react/components/TableSearch/lang.js +5 -14
  311. package/fe/packages/ui/react/components/{Textarea.d.ts → Textarea/Textarea.d.ts} +11 -3
  312. package/fe/packages/ui/react/components/Textarea/Textarea.js +37 -0
  313. package/fe/packages/ui/react/components/Textarea/index.d.ts +2 -0
  314. package/fe/packages/ui/react/components/Textarea/index.js +1 -0
  315. package/fe/packages/ui/react/components/{Tooltip.d.ts → Tooltip/Tooltip.d.ts} +2 -2
  316. package/fe/packages/ui/react/components/Tooltip/Tooltip.js +79 -0
  317. package/fe/packages/ui/react/components/Tooltip/index.d.ts +2 -0
  318. package/fe/packages/ui/react/components/Tooltip/index.js +1 -0
  319. package/fe/packages/ui/react/components/{TreeSelect.js → TreeSelect/TreeSelect.js} +9 -11
  320. package/fe/packages/ui/react/components/TreeSelect/index.d.ts +2 -0
  321. package/fe/packages/ui/react/components/TreeSelect/index.js +1 -0
  322. package/fe/packages/ui/react/components/Upload/ImageUpload.js +18 -6
  323. package/fe/packages/ui/react/components/Upload/Upload.js +2 -1
  324. package/fe/packages/ui/react/components/{breadcrumb.js → breadcrumb/breadcrumb.js} +15 -12
  325. package/fe/packages/ui/react/components/breadcrumb/index.d.ts +2 -0
  326. package/fe/packages/ui/react/components/breadcrumb/index.js +1 -0
  327. package/fe/packages/ui/react/components/hooks/useDropdownPositioning.d.ts +49 -0
  328. package/fe/packages/ui/react/components/hooks/useDropdownPositioning.js +137 -0
  329. package/fe/packages/ui/react/components/index.d.ts +7 -1
  330. package/fe/packages/ui/react/components/index.js +7 -1
  331. package/fe/packages/ui/react/components/table/index.d.ts +2 -0
  332. package/fe/packages/ui/react/components/table/index.js +1 -0
  333. package/fe/packages/ui/react/components/table/table.js +20 -0
  334. package/fe/packages/ui/react/components/testPage/MenuTestPage.d.ts +2 -0
  335. package/fe/packages/ui/react/components/testPage/MenuTestPage.js +104 -0
  336. package/fe/packages/ui/react/components/testPage/index.js +277 -81
  337. package/fe/packages/ui/react/hooks/useExecuteOnce.d.ts +30 -0
  338. package/fe/packages/ui/react/hooks/useExecuteOnce.js +57 -0
  339. package/fe/packages/ui/react/hooks/useInit.d.ts +1 -1
  340. package/fe/packages/ui/react/hooks/useInit.js +1 -1
  341. package/fe/packages/ui/react/hooks/useLanguage.d.ts +1 -6
  342. package/fe/packages/ui/react/hooks/useRefState.d.ts +30 -0
  343. package/fe/packages/ui/react/hooks/useRefState.js +29 -0
  344. package/fe/packages/ui/react/hooks/useWatch.d.ts +23 -0
  345. package/fe/packages/ui/react/hooks/useWatch.js +87 -0
  346. package/fe/packages/ui/react/hooks/useWatch.test.d.ts +2 -0
  347. package/fe/packages/ui/react/hooks/useWatch.test.js +22 -0
  348. package/fe/packages/ui/react/i18n/I18nProvider.d.ts +31 -0
  349. package/fe/packages/ui/react/i18n/I18nProvider.js +25 -0
  350. package/fe/packages/ui/react/i18n/index.d.ts +4 -0
  351. package/fe/packages/ui/react/i18n/index.js +3 -0
  352. package/fe/packages/ui/react/i18n/useI18n.d.ts +13 -0
  353. package/fe/packages/ui/react/i18n/useI18n.js +18 -0
  354. package/fe/packages/ui/react/index.css +238 -0
  355. package/fe/packages/ui/react/index.d.ts +2 -0
  356. package/fe/packages/ui/react/index.js +2 -0
  357. package/fe/packages/ui/react/lib/createStoreHook.d.ts +9 -0
  358. package/fe/packages/ui/react/lib/createStoreHook.js +6 -0
  359. package/fe/packages/ui/react/lib/export.d.ts +2 -2
  360. package/fe/packages/ui/react/stores/language.d.ts +3 -12
  361. package/fe/packages/ui/react/stores/language.js +2 -51
  362. package/fe/typings/type.d.ts +5 -0
  363. package/fe/typings/type.js +1 -0
  364. package/model/index.d.ts +2 -0
  365. package/model/types/data/button.d.ts +32 -0
  366. package/model/types/data/component.d.ts +61 -0
  367. package/model/types/data/fetchInfo.d.ts +20 -0
  368. package/model/types/data/schema.d.ts +98 -0
  369. package/model/types/data/search.d.ts +7 -0
  370. package/model/types/index.d.ts +2 -0
  371. package/model/types/menuType.d.ts +73 -0
  372. package/model/types/model.d.ts +33 -0
  373. package/model/types/test.d.ts +2 -0
  374. package/package.json +20 -6
  375. package/types/app/controller/base.d.ts +3 -3
  376. package/types/app/router/view.d.ts +2 -3
  377. package/types/app/service/project.d.ts +29 -4
  378. package/types/app/type.d.ts +1 -0
  379. package/types/app/typings.d.ts +12 -21
  380. package/types/bundler/defaultAlias.d.ts +3 -0
  381. package/types/bundler/utils.d.ts +1 -1
  382. package/types/config/config.default.d.ts +14 -0
  383. package/types/packages/common/LRUCache.d.ts +1 -0
  384. package/types/packages/common/array/index.d.ts +6 -0
  385. package/types/packages/common/cache/LRUCache.d.ts +12 -0
  386. package/types/packages/common/cache/index.d.ts +1 -0
  387. package/types/packages/common/guards/index.d.ts +8 -0
  388. package/types/packages/common/i18n/default.d.ts +86 -0
  389. package/types/packages/common/i18n/en-US.d.ts +86 -0
  390. package/types/packages/common/i18n/index.d.ts +18 -0
  391. package/types/packages/common/i18n/locales.d.ts +7 -0
  392. package/types/packages/common/i18n/types.d.ts +46 -0
  393. package/types/packages/common/index.d.ts +9 -0
  394. package/types/packages/common/log/index.d.ts +32 -0
  395. package/types/packages/common/number/index.d.ts +2 -0
  396. package/types/packages/common/object/filterEmpty.d.ts +2 -0
  397. package/types/packages/common/object/filtereEmpty.d.ts +1 -0
  398. package/types/packages/common/object/index.d.ts +4 -0
  399. package/types/packages/common/string/index.d.ts +3 -0
  400. package/types/packages/common/types/index.d.ts +3 -0
  401. package/types/packages/core/index.d.ts +1 -1
  402. package/types/packages/core/loader/router.d.ts +1 -1
  403. package/types/packages/core/types.d.ts +12 -3
  404. package/types/packages/utils/runFileFn.d.ts +5 -3
  405. package/fe/packages/ui/react/components/ConfirmDialog.js +0 -9
  406. package/fe/packages/ui/react/components/Dropdown.d.ts +0 -16
  407. package/fe/packages/ui/react/components/Dropdown.js +0 -54
  408. package/fe/packages/ui/react/components/Form/SchemeForm/data.d.ts +0 -51
  409. package/fe/packages/ui/react/components/Form/SchemeForm/index.js +0 -69
  410. package/fe/packages/ui/react/components/Textarea.js +0 -35
  411. package/fe/packages/ui/react/components/Tooltip.js +0 -118
  412. package/fe/packages/ui/react/components/table.js +0 -20
  413. package/fe/packages/ui/react/locales/index.d.ts +0 -8
  414. package/fe/packages/ui/react/locales/index.js +0 -6
  415. /package/fe/packages/ui/react/components/{ConfirmDialog.d.ts → ConfirmDialog/ConfirmDialog.d.ts} +0 -0
  416. /package/fe/packages/ui/react/components/{Pagination.d.ts → Pagination/Pagination.d.ts} +0 -0
  417. /package/fe/packages/ui/react/components/{TreeSelect.d.ts → TreeSelect/TreeSelect.d.ts} +0 -0
  418. /package/fe/packages/ui/react/components/{breadcrumb.d.ts → breadcrumb/breadcrumb.d.ts} +0 -0
  419. /package/fe/packages/ui/react/components/{table.d.ts → table/table.d.ts} +0 -0
@@ -1,7 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { cn } from '../lib/utils';
3
- import { Check, ChevronDown, ChevronRight } from 'lucide-react';
2
+ import { cn } from '../../lib/utils';
3
+ import { ChevronDown, ChevronRight } from 'lucide-react';
4
4
  import { useCallback, useMemo, useState } from 'react';
5
+ import { Button } from '../Button';
6
+ import { Checkbox } from '../Checkbox';
5
7
  export function TreeSelect({ data, value = [], onChange, labelField = 'name', checkable = true, className, }) {
6
8
  const [expandedKeys, setExpandedKeys] = useState(new Set());
7
9
  const { nodeMap, parentMap } = useMemo(() => {
@@ -135,17 +137,13 @@ export function TreeSelect({ data, value = [], onChange, labelField = 'name', ch
135
137
  const isExpanded = expandedKeys.has(node.id);
136
138
  const isChecked = isNodeChecked(node.id);
137
139
  const isIndeterminate = isNodeIndeterminate(node);
138
- return (_jsxs("div", { children: [_jsxs("div", { className: cn('flex items-center gap-2 py-2 px-2 hover:bg-muted/50 rounded-md cursor-pointer transition-colors', 'group'), style: { paddingLeft: `${level * 20 + 8}px` }, children: [hasChildren ? (_jsx("button", { type: "button", onClick: (e) => {
140
+ return (_jsxs("div", { children: [_jsxs("div", { className: cn('flex items-center gap-2 py-2 px-2 hover:bg-muted/50 rounded-md cursor-pointer transition-colors', 'group'), style: { paddingLeft: `${level * 20 + 8}px` }, children: [hasChildren ? (_jsx(Button, { variant: "text", type: "button", onClick: (e) => {
139
141
  e.stopPropagation();
140
142
  toggleExpand(node.id);
141
- }, className: "flex-shrink-0 p-0.5 hover:bg-muted rounded", children: isExpanded ? _jsx(ChevronDown, { className: "h-4 w-4" }) : _jsx(ChevronRight, { className: "h-4 w-4" }) })) : (_jsx("span", { className: "w-5" })), checkable && (_jsx("button", { type: "button", onClick: (e) => {
143
+ }, className: "flex-shrink-0 p-0.5 hover:bg-muted rounded", children: isExpanded ? _jsx(ChevronDown, { className: "h-4 w-4" }) : _jsx(ChevronRight, { className: "h-4 w-4" }) })) : (_jsx("span", { className: "w-5" })), checkable && (_jsx(Checkbox, { className: "flex-shrink-0", checked: isChecked, indeterminate: isIndeterminate, "aria-label": `Select ${node.name}`, onChange: (_, e) => {
142
144
  e.stopPropagation();
143
145
  toggleCheck(node);
144
- }, className: cn('flex-shrink-0 w-4 h-4 rounded border-2 flex items-center justify-center transition-colors', isChecked
145
- ? 'bg-black border-black'
146
- : isIndeterminate
147
- ? 'bg-gray-400 border-gray-400'
148
- : 'border-border hover:border-foreground'), children: (isChecked || isIndeterminate) && _jsx(Check, { className: "h-3 w-3 text-white", strokeWidth: 3 }) })), _jsx("span", { className: "flex-1 text-sm select-none", onClick: () => {
146
+ } })), _jsx("span", { className: "flex-1 text-sm select-none", onClick: () => {
149
147
  if (hasChildren) {
150
148
  toggleExpand(node.id);
151
149
  }
@@ -156,7 +154,7 @@ export function TreeSelect({ data, value = [], onChange, labelField = 'name', ch
156
154
  }
157
155
  // 如果没有数据
158
156
  if (!data || data.length === 0) {
159
- return _jsx("div", { className: cn('p-8 text-center text-sm text-muted-foreground', className), children: "No data" });
157
+ return _jsx("div", { className: cn('tc-ui-tree-select p-8 text-center text-sm text-muted-foreground', className), children: "No data" });
160
158
  }
161
- return (_jsx("div", { className: cn('border border-border rounded-lg p-2 max-h-[400px] overflow-y-auto', className), children: data.map((node) => renderTreeNode(node)) }));
159
+ return (_jsx("div", { className: cn('tc-ui-tree-select border border-border rounded-lg p-2 max-h-[400px] overflow-y-auto', className), children: data.map((node) => renderTreeNode(node)) }));
162
160
  }
@@ -0,0 +1,2 @@
1
+ export * from './TreeSelect';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ export * from './TreeSelect';
@@ -1,10 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useI18n } from '../../i18n';
2
3
  import { Camera, X } from 'lucide-react';
3
4
  import { useEffect, useMemo, useRef, useState } from 'react';
5
+ import { Button } from '../Button';
4
6
  import { FileUpload } from './Upload';
5
7
  export function ImageUpload({ accept = '.jpg,.png', maxCount = 1, value, onChange, beforeChange }) {
8
+ const t = useI18n();
6
9
  const inputRef = useRef(null);
7
10
  const [internalUrls, setInternalUrls] = useState([]);
11
+ const internalUrlsRef = useRef([]);
8
12
  const urls = value ?? internalUrls;
9
13
  const setUrls = onChange ?? setInternalUrls;
10
14
  const mAccept = useMemo(() => {
@@ -49,15 +53,23 @@ export function ImageUpload({ accept = '.jpg,.png', maxCount = 1, value, onChang
49
53
  URL.revokeObjectURL(urlToRemove);
50
54
  setUrls(urls.filter((_, i) => i !== index));
51
55
  };
56
+ useEffect(() => {
57
+ if (onChange) {
58
+ internalUrlsRef.current = [];
59
+ return;
60
+ }
61
+ const removedUrls = internalUrlsRef.current.filter((url) => !internalUrls.includes(url));
62
+ removedUrls.forEach((url) => URL.revokeObjectURL(url));
63
+ internalUrlsRef.current = internalUrls;
64
+ }, [onChange, internalUrls]);
52
65
  useEffect(() => {
53
66
  return () => {
54
- if (!onChange) {
55
- internalUrls.forEach((url) => URL.revokeObjectURL(url));
56
- }
67
+ internalUrlsRef.current.forEach((url) => URL.revokeObjectURL(url));
68
+ internalUrlsRef.current = [];
57
69
  };
58
- }, [onChange, internalUrls]);
59
- return (_jsxs("div", { className: "flex flex-wrap gap-3", children: [urls.map((url, index) => (_jsxs("div", { className: "relative w-24 h-24 rounded-lg overflow-hidden border border-gray-200 group cursor-pointer", children: [_jsx("img", { src: url, alt: "", className: "w-full h-full object-cover" }), _jsx("div", { className: "absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors flex items-center justify-center", children: _jsx("button", { type: "button", onClick: (e) => {
70
+ }, []);
71
+ return (_jsxs("div", { className: "tc-ui-image-upload flex flex-wrap gap-3", children: [urls.map((url, index) => (_jsxs("div", { className: "relative w-24 h-24 rounded-lg overflow-hidden border border-gray-200 group cursor-pointer", children: [_jsx("img", { src: url, alt: "", className: "w-full h-full object-cover" }), _jsx("div", { className: "absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors flex items-center justify-center", children: _jsx(Button, { variant: "text", type: "button", onClick: (e) => {
60
72
  e.stopPropagation();
61
73
  handleRemove(index);
62
- }, className: "opacity-0 group-hover:opacity-100 transition-opacity p-1.5 rounded-full bg-red-500 hover:bg-red-600 text-white", "aria-label": "\u5220\u9664\u56FE\u7247", title: "\u5220\u9664\u56FE\u7247", children: _jsx(X, { size: 16 }) }) })] }, index))), urls.length < maxCount && (_jsx(FileUpload, { inputRef: inputRef, accept: mAccept, multiple: maxCount > 1, onChange: handleFileChange, labelClassName: "w-24 h-24 p-0 border-0 cursor-pointer", selectLabel: _jsxs("div", { className: "w-full h-full rounded-[8px] bg-[#F5F5F5] border border-gray-200 flex flex-col items-center justify-center gap-1 hover:bg-gray-50 transition-colors", children: [_jsx(Camera, { className: "text-gray-500", size: 24 }), _jsx("span", { className: "text-xs text-gray-500", children: "\u4E0A\u4F20" })] }) }))] }));
74
+ }, className: "opacity-0 group-hover:opacity-100 transition-opacity p-1.5 rounded-full bg-red-500 hover:bg-red-600 text-white", "aria-label": t('components.upload.deleteImage'), title: t('components.upload.deleteImage'), children: _jsx(X, { size: 16 }) }) })] }, index))), urls.length < maxCount && (_jsx(FileUpload, { inputRef: inputRef, accept: mAccept, multiple: maxCount > 1, onChange: handleFileChange, labelClassName: "w-24 h-24 p-0 border-0 cursor-pointer", selectLabel: _jsxs("div", { className: "w-full h-full rounded-[8px] bg-[#F5F5F5] border border-gray-200 flex flex-col items-center justify-center gap-1 hover:bg-gray-50 transition-colors", children: [_jsx(Camera, { className: "text-gray-500", size: 24 }), _jsx("span", { className: "text-xs text-gray-500", children: t('components.upload.upload') })] }) }))] }));
63
75
  }
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button } from '../Button';
3
+ import { Input } from '../Input';
3
4
  export function FileUpload({ inputRef, accept = '*', multiple, onChange, selectLabel, labelClassName, showClear, onClear, clearLabel, }) {
4
- return (_jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("label", { className: labelClassName ?? 'flex items-center gap-2 px-4 py-2 border rounded-lg cursor-pointer bg-white', children: [_jsx("input", { ref: inputRef, type: "file", accept: accept, multiple: multiple, className: "hidden", onChange: onChange }), selectLabel] }), showClear && onClear && (_jsx(Button, { size: "sm", variant: "link", onClick: onClear, children: clearLabel }))] }));
5
+ return (_jsxs("div", { className: "tc-ui-file-upload flex items-center gap-3", children: [_jsxs("label", { className: labelClassName ?? 'flex items-center gap-2 px-4 py-2 border rounded-lg cursor-pointer bg-background', children: [_jsx(Input, { ref: inputRef, type: "file", accept: accept, multiple: multiple, className: "hidden", onChange: (_, e) => onChange?.(e) }), selectLabel] }), showClear && onClear && (_jsx(Button, { size: "sm", variant: "link", onClick: onClear, children: clearLabel }))] }));
5
6
  }
@@ -1,33 +1,36 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useBreadcrumb } from '../hooks/useBreadcrumb';
3
- import { useLanguage } from '../hooks/useLanguage';
4
- import { cn } from '../lib/utils';
2
+ import { useI18n } from '../../i18n';
3
+ import { useBreadcrumb } from '../../hooks/useBreadcrumb';
4
+ import { useLanguage } from '../../hooks/useLanguage';
5
+ import { cn } from '../../lib/utils';
5
6
  // import useUserStore from '@tc/ui-react/stores/user'
6
7
  import { ChevronRight, MoreHorizontal } from 'lucide-react';
7
8
  import { forwardRef } from 'react';
8
9
  import { useNavigate } from 'react-router-dom';
9
- const Breadcrumb = forwardRef(({ ...props }, ref) => _jsx("nav", { ref: ref, "aria-label": "breadcrumb", ...props }));
10
+ import { Button } from '../Button';
11
+ const Breadcrumb = forwardRef(({ className, ...props }, ref) => _jsx("nav", { ref: ref, "aria-label": "breadcrumb", className: cn('tc-ui-breadcrumb', className), ...props }));
10
12
  Breadcrumb.displayName = 'Breadcrumb';
11
- const BreadcrumbList = forwardRef(({ className, ...props }, ref) => (_jsx("ol", { ref: ref, className: cn('flex items-center gap-3 flex-wrap', className), ...props })));
13
+ const BreadcrumbList = forwardRef(({ className, ...props }, ref) => (_jsx("ol", { ref: ref, className: cn('tc-ui-breadcrumb-list flex items-center gap-3 flex-wrap', className), ...props })));
12
14
  BreadcrumbList.displayName = 'BreadcrumbList';
13
- const BreadcrumbItem = forwardRef(({ className, ...props }, ref) => _jsx("li", { ref: ref, className: cn('inline-flex items-center', className), ...props }));
15
+ const BreadcrumbItem = forwardRef(({ className, ...props }, ref) => _jsx("li", { ref: ref, className: cn('tc-ui-breadcrumb-item inline-flex items-center', className), ...props }));
14
16
  BreadcrumbItem.displayName = 'BreadcrumbItem';
15
17
  const BreadcrumbLink = forwardRef(({ className, ...props }, ref) => {
16
- return _jsx("a", { ref: ref, className: cn('transition-colors hover:text-foreground', className), ...props });
18
+ return _jsx("a", { ref: ref, className: cn('tc-ui-breadcrumb-link transition-colors hover:text-foreground', className), ...props });
17
19
  });
18
20
  BreadcrumbLink.displayName = 'BreadcrumbLink';
19
21
  const BreadcrumbPage = forwardRef(({ className, active, onClose, closable = true, children, ...props }, ref) => {
20
- return (_jsxs("span", { ref: ref, role: "link", "aria-disabled": "true", "aria-current": "page", className: cn('inline-flex items-center gap-2 px-4 py-2 rounded-lg border transition-all duration-200 text-sm', active
22
+ const t = useI18n();
23
+ return (_jsxs("span", { ref: ref, role: "link", "aria-disabled": "true", "aria-current": "page", className: cn('tc-ui-breadcrumb-page inline-flex items-center gap-2 px-4 py-2 rounded-lg border transition-all duration-200 text-sm', active
21
24
  ? 'bg-breadcrumb-active-bg text-breadcrumb-active-text border-breadcrumb-active-bg shadow-sm'
22
- : 'bg-white text-breadcrumb-text border-breadcrumb-border hover:border-gray-400', className), ...props, children: [_jsx("span", { className: "font-normal", children: children }), onClose && closable && (_jsx("button", { onClick: (e) => {
25
+ : 'bg-background text-breadcrumb-text border-breadcrumb-border hover:border-gray-400', className), ...props, children: [_jsx("span", { className: "font-normal", children: children }), onClose && closable && (_jsx(Button, { variant: "text", type: "button", onClick: (e) => {
23
26
  e.stopPropagation();
24
27
  onClose();
25
- }, className: "inline-flex items-center justify-center hover:opacity-70 transition-opacity", "aria-label": "\u5173\u95ED", children: _jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsxs("g", { clipPath: "url(#clip0_228_519)", children: [_jsx("circle", { cx: "8", cy: "8", r: "6.66667", stroke: "currentColor", strokeWidth: "1" }), _jsx("path", { d: "M9.66669 6.33302L6.33337 9.66634M6.33336 6.33301L9.66668 9.66633", stroke: "currentColor", strokeWidth: "1", strokeLinecap: "round" })] }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_228_519", children: _jsx("rect", { width: "16", height: "16", fill: "white" }) }) })] }) }))] }));
28
+ }, className: "inline-flex items-center justify-center hover:opacity-70 transition-opacity", "aria-label": t('components.breadcrumb.close'), children: _jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsxs("g", { clipPath: "url(#clip0_228_519)", children: [_jsx("circle", { cx: "8", cy: "8", r: "6.66667", stroke: "currentColor", strokeWidth: "1" }), _jsx("path", { d: "M9.66669 6.33302L6.33337 9.66634M6.33336 6.33301L9.66668 9.66633", stroke: "currentColor", strokeWidth: "1", strokeLinecap: "round" })] }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_228_519", children: _jsx("rect", { width: "16", height: "16", fill: "white" }) }) })] }) }))] }));
26
29
  });
27
30
  BreadcrumbPage.displayName = 'BreadcrumbPage';
28
- const BreadcrumbSeparator = ({ children, className, ...props }) => (_jsx("li", { role: "presentation", "aria-hidden": "true", className: cn('[&>svg]:size-3.5', className), ...props, children: children ?? _jsx(ChevronRight, {}) }));
31
+ const BreadcrumbSeparator = ({ children, className, ...props }) => (_jsx("li", { role: "presentation", "aria-hidden": "true", className: cn('tc-ui-breadcrumb-separator [&>svg]:size-3.5', className), ...props, children: children ?? _jsx(ChevronRight, {}) }));
29
32
  BreadcrumbSeparator.displayName = 'BreadcrumbSeparator';
30
- const BreadcrumbEllipsis = ({ className, ...props }) => (_jsxs("span", { role: "presentation", "aria-hidden": "true", "aria-label": "More", className: cn('flex h-9 w-9 items-center justify-center', className), ...props, children: [_jsx(MoreHorizontal, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "More" })] }));
33
+ const BreadcrumbEllipsis = ({ className, ...props }) => (_jsxs("span", { role: "presentation", "aria-hidden": "true", "aria-label": "More", className: cn('tc-ui-breadcrumb-ellipsis flex h-9 w-9 items-center justify-center', className), ...props, children: [_jsx(MoreHorizontal, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "More" })] }));
31
34
  BreadcrumbEllipsis.displayName = 'BreadcrumbEllipsis';
32
35
  export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, };
33
36
  export function SimpleBreadcrumb({ className }) {
@@ -0,0 +1,2 @@
1
+ export * from './breadcrumb';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ export * from './breadcrumb';
@@ -0,0 +1,49 @@
1
+ import type { RefObject } from "react";
2
+ export type DropdownPlacement = "bottom-end" | "bottom-start" | "left-start" | "top-end" | "top-start" | "right-start" | "right-end";
3
+ export type DropdownPosition = {
4
+ top: number;
5
+ left?: number;
6
+ right?: number;
7
+ width?: number;
8
+ };
9
+ export type DropdownPositioningContext = {
10
+ anchorRect: DOMRect;
11
+ contentRect?: DOMRect;
12
+ containerRect?: DOMRect;
13
+ viewportWidth: number;
14
+ viewportHeight: number;
15
+ placement: DropdownPlacement;
16
+ offset: number;
17
+ matchAnchorWidth: boolean;
18
+ };
19
+ export type DropdownPositioningStrategy = (context: DropdownPositioningContext) => DropdownPosition;
20
+ export type UseDropdownPositioningOptions = {
21
+ open: boolean;
22
+ anchorRef: RefObject<HTMLElement | null>;
23
+ contentRef: RefObject<HTMLElement | null>;
24
+ placement?: DropdownPlacement;
25
+ offset?: number;
26
+ matchAnchorWidth?: boolean;
27
+ strategy?: DropdownPositioningStrategy;
28
+ estimateSize?: () => {
29
+ width?: number;
30
+ height?: number;
31
+ };
32
+ watchDeps?: readonly unknown[];
33
+ containerRef?: RefObject<HTMLElement | null>;
34
+ positionMode?: "fixed" | "absolute";
35
+ };
36
+ export type UseDropdownPositioningResult = {
37
+ position: DropdownPosition;
38
+ ready: boolean;
39
+ updatePosition: () => void;
40
+ };
41
+ /**
42
+ * 计算弹窗该放在哪。
43
+ *
44
+ * right/left:跟触发元素顶部对齐,往右或往左弹。
45
+ * bottom/top:放在触发元素下方或上方,再按 start/end 对齐。
46
+ */
47
+ export declare const getDefaultDropdownPosition: DropdownPositioningStrategy;
48
+ export declare function useDropdownPositioning({ open, anchorRef, contentRef, placement, offset, matchAnchorWidth, strategy, estimateSize, watchDeps, containerRef, positionMode, }: UseDropdownPositioningOptions): UseDropdownPositioningResult;
49
+ //# sourceMappingURL=useDropdownPositioning.d.ts.map
@@ -0,0 +1,137 @@
1
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
+ const HIDDEN_POSITION = {
3
+ top: -100,
4
+ left: -100,
5
+ };
6
+ const EMPTY_DEPS = [];
7
+ /**
8
+ * 计算弹窗该放在哪。
9
+ *
10
+ * right/left:跟触发元素顶部对齐,往右或往左弹。
11
+ * bottom/top:放在触发元素下方或上方,再按 start/end 对齐。
12
+ */
13
+ export const getDefaultDropdownPosition = ({ anchorRect, contentRect, containerRect, viewportWidth, placement, offset, matchAnchorWidth, }) => {
14
+ const isRight = placement.startsWith("right");
15
+ const isLeft = placement.startsWith("left");
16
+ const isTop = placement.startsWith("top");
17
+ const containerTop = containerRect?.top ?? 0;
18
+ const containerLeft = containerRect?.left ?? 0;
19
+ const containerRight = containerRect?.right ?? viewportWidth;
20
+ const nextPosition = {
21
+ top: (isRight || isLeft
22
+ ? anchorRect.top
23
+ : isTop
24
+ ? anchorRect.top - (contentRect?.height ?? 0) - offset
25
+ : anchorRect.bottom + offset) - containerTop,
26
+ width: matchAnchorWidth ? anchorRect.width : undefined,
27
+ };
28
+ if (isRight) {
29
+ nextPosition.left = anchorRect.right + offset - containerLeft;
30
+ }
31
+ else if (isLeft) {
32
+ // 往左弹时,要知道弹窗宽度,才能算出左边应该从哪里开始。
33
+ nextPosition.left = anchorRect.left - (contentRect?.width ?? 0) - offset - containerLeft;
34
+ }
35
+ else if (placement.endsWith("start")) {
36
+ nextPosition.left = anchorRect.left - containerLeft;
37
+ }
38
+ else {
39
+ nextPosition.right = containerRight - anchorRect.right;
40
+ }
41
+ return nextPosition;
42
+ };
43
+ export function useDropdownPositioning({ open, anchorRef, contentRef, placement = "bottom-end", offset = 8, matchAnchorWidth = false, strategy = getDefaultDropdownPosition, estimateSize, watchDeps = EMPTY_DEPS, containerRef, positionMode = "fixed", }) {
44
+ const [position, setPosition] = useState(HIDDEN_POSITION);
45
+ const [ready, setReady] = useState(false);
46
+ const getContentRect = useCallback(() => {
47
+ // 优先用真实 DOM 尺寸。刚打开时可能还量不到,就允许外部给一个预估尺寸。
48
+ const measuredRect = contentRef.current?.getBoundingClientRect();
49
+ if (measuredRect && measuredRect.height > 0) {
50
+ return measuredRect;
51
+ }
52
+ const estimatedSize = estimateSize?.();
53
+ if (!estimatedSize)
54
+ return measuredRect;
55
+ return new DOMRect(0, 0, estimatedSize.width ?? 0, estimatedSize.height ?? 0);
56
+ }, [contentRef, estimateSize]);
57
+ const updatePosition = useCallback(() => {
58
+ if (!anchorRef.current)
59
+ return;
60
+ // 每次定位前重新读取位置,这样滚动或窗口变化后不会用旧坐标。
61
+ const anchorRect = anchorRef.current.getBoundingClientRect();
62
+ const contentRect = getContentRect();
63
+ const containerRect = positionMode === "absolute"
64
+ ? containerRef?.current?.getBoundingClientRect()
65
+ : undefined;
66
+ const newData = strategy({
67
+ anchorRect,
68
+ contentRect: contentRect ?? undefined,
69
+ containerRect,
70
+ viewportWidth: window.innerWidth,
71
+ viewportHeight: window.innerHeight,
72
+ placement,
73
+ offset,
74
+ matchAnchorWidth,
75
+ });
76
+ setPosition((returnData.current.position = newData));
77
+ setReady((returnData.current.ready = Boolean(contentRef.current &&
78
+ contentRef.current.getBoundingClientRect().height > 0)));
79
+ }, [
80
+ anchorRef,
81
+ contentRef,
82
+ containerRef,
83
+ getContentRect,
84
+ matchAnchorWidth,
85
+ offset,
86
+ placement,
87
+ positionMode,
88
+ strategy,
89
+ ]);
90
+ useEffect(() => {
91
+ if (!open) {
92
+ // 关闭时先挪到屏幕外,避免 keepMounted 的弹窗在旧位置闪一下。
93
+ setPosition((returnData.current.position = HIDDEN_POSITION));
94
+ setReady((returnData.current.ready = false));
95
+ return;
96
+ }
97
+ // 打开后等两帧再量尺寸:先让 DOM 挂上去,再让浏览器完成布局。
98
+ const rafId = requestAnimationFrame(() => requestAnimationFrame(updatePosition));
99
+ return () => cancelAnimationFrame(rafId);
100
+ }, [open, updatePosition]);
101
+ useEffect(() => {
102
+ if (!open)
103
+ return;
104
+ // 页面滚动、外层容器滚动、窗口缩放时,都重新算一次位置。
105
+ const handleUpdate = () => updatePosition();
106
+ window.addEventListener("scroll", handleUpdate, true);
107
+ window.addEventListener("resize", handleUpdate);
108
+ return () => {
109
+ window.removeEventListener("scroll", handleUpdate, true);
110
+ window.removeEventListener("resize", handleUpdate);
111
+ };
112
+ }, [open, updatePosition]);
113
+ const deps = useMemo(() => watchDeps, [watchDeps]);
114
+ useEffect(() => {
115
+ if (!open)
116
+ return;
117
+ // 外部内容变化时,可以通过 watchDeps 主动触发重新定位。
118
+ updatePosition();
119
+ }, [deps, open, updatePosition]);
120
+ useEffect(() => {
121
+ if (!open || !contentRef.current)
122
+ return;
123
+ // 弹窗打开后内容高度/宽度可能变,尺寸变了就重新定位。
124
+ let rafId = 0;
125
+ const observer = new ResizeObserver(() => {
126
+ rafId = requestAnimationFrame(() => requestAnimationFrame(updatePosition));
127
+ });
128
+ observer.observe(contentRef.current);
129
+ return () => {
130
+ observer.disconnect();
131
+ cancelAnimationFrame(rafId);
132
+ };
133
+ }, [contentRef, open, updatePosition]);
134
+ const returnData = useRef({ position, ready, updatePosition });
135
+ returnData.current.updatePosition = updatePosition;
136
+ return returnData.current;
137
+ }
@@ -2,14 +2,20 @@ export * from './breadcrumb';
2
2
  export * from './Button';
3
3
  export * from './Checkbox';
4
4
  export * from './ConfirmDialog';
5
- export * from './DataTable/data-table';
5
+ export * from './DataTable';
6
+ export * from './Drawer';
6
7
  export * from './Dropdown';
8
+ export * from './Popup';
7
9
  export * from './Form';
10
+ export * from './hooks/useDropdownPositioning';
8
11
  export * from './ImagePreview';
9
12
  export * from './Input';
13
+ export * from './InputNumber';
10
14
  export * from './Label';
15
+ export * from './Menu';
11
16
  export * from './Message';
12
17
  export * from './Modal';
18
+ export * from './Overlay';
13
19
  export * from './Pagination';
14
20
  export * from './Search';
15
21
  export * from './Select';
@@ -2,14 +2,20 @@ export * from './breadcrumb';
2
2
  export * from './Button';
3
3
  export * from './Checkbox';
4
4
  export * from './ConfirmDialog';
5
- export * from './DataTable/data-table';
5
+ export * from './DataTable';
6
+ export * from './Drawer';
6
7
  export * from './Dropdown';
8
+ export * from './Popup';
7
9
  export * from './Form';
10
+ export * from './hooks/useDropdownPositioning';
8
11
  export * from './ImagePreview';
9
12
  export * from './Input';
13
+ export * from './InputNumber';
10
14
  export * from './Label';
15
+ export * from './Menu';
11
16
  export * from './Message';
12
17
  export * from './Modal';
18
+ export * from './Overlay';
13
19
  export * from './Pagination';
14
20
  export * from './Search';
15
21
  export * from './Select';
@@ -0,0 +1,2 @@
1
+ export * from './table';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ export * from './table';
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from '../../lib/utils';
3
+ import * as React from 'react';
4
+ const Table = React.forwardRef(({ className, containerClassName, ...props }, ref) => (_jsx("div", { className: cn('tc-ui-table relative w-full overflow-auto rounded-[20px]', containerClassName), children: _jsx("table", { ref: ref, className: cn('w-full caption-bottom text-sm', className), ...props }) })));
5
+ Table.displayName = 'Table';
6
+ const TableHeader = React.forwardRef(({ className, ...props }, ref) => _jsx("thead", { ref: ref, className: cn('tc-ui-table-header bg-table-header', className), ...props }));
7
+ TableHeader.displayName = 'TableHeader';
8
+ const TableBody = React.forwardRef(({ className, ...props }, ref) => (_jsx("tbody", { ref: ref, className: cn('tc-ui-table-body [&_tr:last-child]:border-0', className), ...props })));
9
+ TableBody.displayName = 'TableBody';
10
+ const TableFooter = React.forwardRef(({ className, ...props }, ref) => (_jsx("tfoot", { ref: ref, className: cn('tc-ui-table-footer border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', className), ...props })));
11
+ TableFooter.displayName = 'TableFooter';
12
+ const TableRow = React.forwardRef(({ className, ...props }, ref) => (_jsx("tr", { ref: ref, className: cn('tc-ui-table-row border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted', className), ...props })));
13
+ TableRow.displayName = 'TableRow';
14
+ const TableHead = React.forwardRef(({ className, isAction, ...props }, ref) => (_jsx("th", { ref: ref, className: cn('tc-ui-table-head h-12 px-4 text-left align-middle text-xs font-normal', 'text-table-head-text', isAction && 'bg-table-action text-table-action-text w-[85px] text-center', className), ...props })));
15
+ TableHead.displayName = 'TableHead';
16
+ const TableCell = React.forwardRef(({ className, isAction, ...props }, ref) => (_jsx("td", { ref: ref, className: cn('tc-ui-table-cell p-4 align-middle text-sm font-normal', 'text-table-cell-text', isAction && 'bg-table-action text-table-action-text w-[85px] text-center', className), ...props })));
17
+ TableCell.displayName = 'TableCell';
18
+ const TableCaption = React.forwardRef(({ className, ...props }, ref) => (_jsx("caption", { ref: ref, className: cn('tc-ui-table-caption mt-4 text-sm text-muted-foreground', className), ...props })));
19
+ TableCaption.displayName = 'TableCaption';
20
+ export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
@@ -0,0 +1,2 @@
1
+ export default function MenuTestPage(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=MenuTestPage.d.ts.map
@@ -0,0 +1,104 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { LayoutDashboard, Package, Settings, Users, FileText, BarChart3, ShoppingCart, Bell, HelpCircle, } from 'lucide-react';
4
+ import { Menu } from '../Menu';
5
+ // ─── 示例数据 ────────────────────────────────────────────────────────────────
6
+ const menuItems = [
7
+ {
8
+ key: 'dashboard',
9
+ label: 'Dashboard',
10
+ icon: _jsx(LayoutDashboard, { className: "h-4 w-4" }),
11
+ },
12
+ {
13
+ key: 'products',
14
+ label: 'Products',
15
+ icon: _jsx(Package, { className: "h-4 w-4" }),
16
+ children: [
17
+ { key: 'products-list', label: 'All Products' },
18
+ { key: 'products-create', label: 'Create New' },
19
+ {
20
+ key: 'products-categories',
21
+ label: 'Categories',
22
+ children: [
23
+ { key: 'cat-electronics', label: 'Electronics' },
24
+ { key: 'cat-clothing', label: 'Clothing' },
25
+ ],
26
+ },
27
+ ],
28
+ },
29
+ {
30
+ key: 'settings',
31
+ label: 'Settings',
32
+ icon: _jsx(Settings, { className: "h-4 w-4" }),
33
+ children: [
34
+ { key: 'settings-profile', label: 'Profile' },
35
+ { key: 'settings-billing', label: 'Billing', danger: true },
36
+ ],
37
+ },
38
+ ];
39
+ const topItems = [
40
+ { key: 'home', label: 'Home' },
41
+ {
42
+ key: 'services',
43
+ label: 'Services',
44
+ children: [
45
+ { key: 'consulting', label: 'Consulting' },
46
+ { key: 'development', label: 'Development' },
47
+ ],
48
+ },
49
+ { key: 'about', label: 'About' },
50
+ ];
51
+ const iconMenuItems = [
52
+ { key: 'dashboard', label: 'Dashboard', icon: _jsx(LayoutDashboard, { className: "h-4 w-4" }) },
53
+ {
54
+ key: 'users',
55
+ label: 'Users',
56
+ icon: _jsx(Users, { className: "h-4 w-4" }),
57
+ children: [
58
+ { key: 'users-list', label: 'All Users', icon: _jsx(Users, { className: "h-4 w-4" }) },
59
+ { key: 'users-roles', label: 'Roles', icon: _jsx(FileText, { className: "h-4 w-4" }) },
60
+ ],
61
+ },
62
+ {
63
+ key: 'analytics',
64
+ label: 'Analytics',
65
+ icon: _jsx(BarChart3, { className: "h-4 w-4" }),
66
+ children: [
67
+ { key: 'analytics-overview', label: 'Overview' },
68
+ { key: 'analytics-reports', label: 'Reports' },
69
+ ],
70
+ },
71
+ { key: 'orders', label: 'Orders', icon: _jsx(ShoppingCart, { className: "h-4 w-4" }) },
72
+ { key: 'notifications', label: 'Notifications', icon: _jsx(Bell, { className: "h-4 w-4" }) },
73
+ { key: 'help', label: 'Help', icon: _jsx(HelpCircle, { className: "h-4 w-4" }) },
74
+ ];
75
+ // ─── 区块包装 ────────────────────────────────────────────────────────────────
76
+ function Section({ title, description, children }) {
77
+ return (_jsxs("section", { className: "space-y-3", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-lg font-semibold", children: title }), description && _jsx("p", { className: "text-sm text-muted-foreground", children: description })] }), children] }));
78
+ }
79
+ // ─── 页面 ────────────────────────────────────────────────────────────────────
80
+ export default function MenuTestPage() {
81
+ const [selectedKey, setSelectedKey] = useState('dashboard');
82
+ const [collapsed, setCollapsed] = useState(false);
83
+ const [collapsedKey, setCollapsedKey] = useState('dashboard');
84
+ const [accordionKey, setAccordionKey] = useState('dashboard');
85
+ const [topKey, setTopKey] = useState('home');
86
+ return (_jsxs("div", { className: "p-8 max-w-6xl mx-auto space-y-10", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-3xl font-bold mb-2", children: "Menu \u7EC4\u4EF6\u4F7F\u7528\u793A\u4F8B" }), _jsx("p", { className: "text-muted-foreground", children: "\u652F\u6301 top / left \u5E03\u5C40\u3001\u591A\u5C42\u5D4C\u5957\u3001\u56FE\u6807\u3001\u6298\u53E0\u7B49\u573A\u666F" })] }), _jsxs(Section, { title: "1. \u57FA\u7840 Left \u6A21\u5F0F (data config)", description: "\u6700\u5E38\u7528\u7684\u4FA7\u8FB9\u83DC\u5355\uFF0C\u652F\u6301\u591A\u7EA7\u5C55\u5F00 (expandMode=multiple)", children: [_jsx("div", { className: "w-56 border rounded-lg overflow-hidden", children: _jsx(Menu, { mode: "left", expandMode: "multiple", selectedKey: selectedKey, onSelect: setSelectedKey, items: menuItems }) }), _jsxs("p", { className: "text-sm text-muted-foreground", children: ["\u5F53\u524D\u9009\u4E2D: ", selectedKey] })] }), _jsx(Section, { title: "2. \u624B\u98CE\u7434\u5C55\u5F00 (accordion)", description: "\u540C\u4E00\u5C42\u7EA7\u540C\u65F6\u53EA\u80FD\u5C55\u5F00\u4E00\u4E2A\u5B50\u83DC\u5355", children: _jsx("div", { className: "w-56 border rounded-lg overflow-hidden", children: _jsx(Menu, { mode: "left", expandMode: "accordion", selectedKey: accordionKey, onSelect: setAccordionKey, items: menuItems }) }) }), _jsx(Section, { title: "3. \u6298\u53E0\u6A21\u5F0F (collapsed)", description: "\u6536\u8D77\u540E\u4EC5\u5C55\u793A\u56FE\u6807\uFF0Chover \u5F39\u51FA\u5B50\u83DC\u5355", children: _jsx("div", { className: "border rounded-lg overflow-hidden inline-flex", children: _jsx(Menu, { mode: "left", selectedKey: collapsedKey, onSelect: setCollapsedKey, collapsed: collapsed, onCollapse: setCollapsed, items: iconMenuItems }) }) }), _jsx(Section, { title: "4. JSX \u7EC4\u5408\u5F0F", description: "\u4E0D\u4F7F\u7528 data config\uFF0C\u76F4\u63A5\u7EC4\u5408 Menu.Item / Menu.SubMenu", children: _jsx("div", { className: "w-56 border rounded-lg overflow-hidden", children: _jsxs(Menu, { mode: "left", defaultSelectedKey: "overview", children: [_jsx(Menu.Item, { eventKey: "overview", icon: _jsx(LayoutDashboard, { className: "h-4 w-4" }), children: "Overview" }), _jsxs(Menu.SubMenu, { eventKey: "manage", label: "Manage", icon: _jsx(Package, { className: "h-4 w-4" }), children: [_jsx(Menu.Item, { eventKey: "manage-list", children: "List" }), _jsx(Menu.Item, { eventKey: "manage-edit", children: "Edit" })] }), _jsxs(Menu.SubMenu, { eventKey: "settings", label: "Settings", icon: _jsx(Settings, { className: "h-4 w-4" }), children: [_jsx(Menu.Item, { eventKey: "jsx-profile", children: "Profile" }), _jsx(Menu.Item, { eventKey: "jsx-billing", danger: true, children: "Billing" })] }), _jsx(Menu.Item, { eventKey: "help", icon: _jsx(HelpCircle, { className: "h-4 w-4" }), children: "Help" })] }) }) }), _jsx(Section, { title: "5. \u5B50\u83DC\u5355\u5F39\u51FA\u6A21\u5F0F (popup)", description: "\u5C55\u5F00\u72B6\u6001\u4E0B\u4E5F\u80FD\u8BA9\u5B50\u83DC\u5355\u4EE5\u5F39\u51FA\u65B9\u5F0F\u5C55\u793A", children: _jsx("div", { className: "w-56 border rounded-lg overflow-hidden", children: _jsx(Menu, { mode: "left", expandMode: "multiple", selectedKey: selectedKey, onSelect: setSelectedKey, items: [
87
+ { key: 'd1', label: 'Dashboard', icon: _jsx(LayoutDashboard, { className: "h-4 w-4" }) },
88
+ {
89
+ key: 'p1',
90
+ label: 'Products',
91
+ icon: _jsx(Package, { className: "h-4 w-4" }),
92
+ popup: true,
93
+ children: [
94
+ { key: 'p1-list', label: 'All Products' },
95
+ { key: 'p1-create', label: 'Create New' },
96
+ ],
97
+ },
98
+ { key: 'd3', label: 'Help', icon: _jsx(HelpCircle, { className: "h-4 w-4" }) },
99
+ ] }) }) }), _jsxs(Section, { title: "6. Top \u6A21\u5F0F", description: "\u4E00\u7EA7\u83DC\u5355\u6C34\u5E73\u6392\u5217\uFF0C\u5B50\u83DC\u5355\u4E0B\u62C9\u5F39\u51FA", children: [_jsx("div", { className: "border rounded-lg w-full", children: _jsx(Menu, { mode: "top", selectedKey: topKey, onSelect: setTopKey, items: topItems, className: "border-b" }) }), _jsxs("p", { className: "text-sm text-muted-foreground", children: ["\u5F53\u524D\u9009\u4E2D: ", topKey] })] }), _jsx(Section, { title: "7. Click \u89E6\u53D1", description: "\u70B9\u51FB\u5C55\u5F00\u5B50\u83DC\u5355\uFF0C\u800C\u975E hover", children: _jsx("div", { className: "w-56 border rounded-lg overflow-hidden", children: _jsx(Menu, { mode: "left", expandTrigger: "click", expandMode: "multiple", selectedKey: selectedKey, onSelect: setSelectedKey, items: menuItems }) }) }), _jsx(Section, { title: "8. \u72B6\u6001\u5C55\u793A", description: "disabled / danger \u6837\u5F0F\u6F14\u793A", children: _jsx("div", { className: "w-56 border rounded-lg overflow-hidden", children: _jsxs(Menu, { mode: "left", defaultSelectedKey: "normal", children: [_jsx(Menu.Item, { eventKey: "normal", icon: _jsx(FileText, { className: "h-4 w-4" }), children: "\u6B63\u5E38\u83DC\u5355\u9879" }), _jsx(Menu.Item, { eventKey: "disabled-item", disabled: true, icon: _jsx(FileText, { className: "h-4 w-4" }), children: "\u7981\u7528\u83DC\u5355\u9879" }), _jsx(Menu.Item, { eventKey: "danger-item", danger: true, icon: _jsx(FileText, { className: "h-4 w-4" }), children: "\u5371\u9669\u83DC\u5355\u9879" }), _jsxs(Menu.SubMenu, { eventKey: "sub-disabled", label: "\u542B\u7981\u7528\u5B50\u9879", icon: _jsx(Settings, { className: "h-4 w-4" }), children: [_jsx(Menu.Item, { eventKey: "sub-normal", children: "\u6B63\u5E38\u5B50\u9879" }), _jsx(Menu.Item, { eventKey: "sub-danger", danger: true, children: "\u5371\u9669\u5B50\u9879" }), _jsx(Menu.Item, { eventKey: "sub-disabled-item", disabled: true, children: "\u7981\u7528\u5B50\u9879" })] })] }) }) }), _jsx(Section, { title: "9. \u65E0 icon \u6298\u53E0", description: "\u6536\u8D77\u65F6\u65E0 icon \u7684\u83DC\u5355\u9879\u7559\u767D\u5360\u4F4D", children: _jsx("div", { className: "border rounded-lg overflow-hidden inline-flex", children: _jsx(Menu, { mode: "left", defaultCollapsed: true, expandMode: "multiple", items: [
100
+ { key: 'a', label: 'Home', icon: _jsx(LayoutDashboard, { className: "h-4 w-4" }) },
101
+ { key: 'b', label: 'Reports' },
102
+ { key: 'c', label: 'Settings', icon: _jsx(Settings, { className: "h-4 w-4" }) },
103
+ ] }) }) })] }));
104
+ }