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

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 (418) 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 +53 -24
  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 +17 -12
  34. package/cjs/packages/core/loader/model.js +3 -3
  35. package/cjs/packages/core/loader/router.js +14 -5
  36. package/esm/app/controller/base.js +3 -3
  37. package/esm/app/controller/project.js +3 -3
  38. package/esm/app/controller/view.js +16 -7
  39. package/esm/app/middleware/api-params-verify.js +10 -1
  40. package/esm/app/middleware/error-handle.js +9 -3
  41. package/esm/app/middleware/project-handler.js +1 -1
  42. package/esm/app/router/view.js +3 -1
  43. package/esm/app/router-schema/project.js +1 -1
  44. package/esm/app/service/project.js +5 -0
  45. package/esm/bundler/defaultAlias.js +4 -0
  46. package/esm/bundler/dev.js +4 -3
  47. package/esm/bundler/index.js +2 -1
  48. package/esm/bundler/prod.js +4 -3
  49. package/esm/bundler/utils.js +53 -24
  50. package/esm/index.js +2 -2
  51. package/esm/packages/common/LRUCache.js +2 -0
  52. package/esm/packages/common/array/index.js +37 -0
  53. package/esm/packages/common/cache/LRUCache.js +43 -0
  54. package/esm/packages/common/cache/index.js +2 -0
  55. package/esm/packages/common/guards/index.js +26 -0
  56. package/esm/packages/common/i18n/default.js +93 -0
  57. package/esm/packages/common/i18n/en-US.js +93 -0
  58. package/esm/packages/common/i18n/index.js +162 -0
  59. package/esm/packages/common/i18n/locales.js +11 -0
  60. package/esm/packages/common/i18n/types.js +0 -0
  61. package/esm/packages/common/index.js +13 -0
  62. package/esm/packages/common/log/index.js +146 -0
  63. package/esm/packages/common/number/index.js +11 -0
  64. package/esm/packages/common/object/filterEmpty.js +29 -0
  65. package/esm/packages/common/object/filtereEmpty.js +2 -0
  66. package/esm/packages/common/object/index.js +20 -0
  67. package/esm/packages/common/string/index.js +13 -0
  68. package/esm/packages/common/types/index.js +0 -0
  69. package/esm/packages/core/index.js +17 -12
  70. package/esm/packages/core/loader/model.js +3 -3
  71. package/esm/packages/core/loader/router.js +14 -5
  72. package/fe/frontend/dash/Dashboard.d.ts +7 -0
  73. package/fe/frontend/dash/Dashboard.js +63 -0
  74. package/fe/frontend/dash/dash.entry.d.ts +2 -0
  75. package/fe/frontend/dash/dash.entry.js +62 -0
  76. package/fe/frontend/index.d.ts +3 -0
  77. package/fe/frontend/index.js +1 -0
  78. package/fe/frontend/main.css +2 -184
  79. package/fe/frontend/main.d.ts +10 -3
  80. package/fe/frontend/main.js +13 -4
  81. package/fe/frontend/testPage/testPage.entry.js +1 -2
  82. package/fe/frontend/typing/window.d.ts +7 -0
  83. package/fe/frontend/typing/window.js +1 -0
  84. package/fe/frontend/widgets/api/baseInfo.d.ts +31 -0
  85. package/fe/frontend/widgets/api/baseInfo.js +15 -0
  86. package/fe/frontend/widgets/common/CRUD/CRUD.d.ts +70 -0
  87. package/fe/frontend/widgets/common/CRUD/CRUD.js +207 -0
  88. package/fe/frontend/widgets/common/CRUD/index.d.ts +2 -0
  89. package/fe/frontend/widgets/common/CRUD/index.js +1 -0
  90. package/fe/frontend/widgets/common/auth/index.d.ts +7 -0
  91. package/fe/frontend/widgets/common/auth/index.js +20 -0
  92. package/fe/frontend/widgets/common/generateMenuData.d.ts +4 -0
  93. package/fe/frontend/widgets/common/generateMenuData.js +14 -0
  94. package/fe/frontend/widgets/common/importComponent.d.ts +5 -0
  95. package/fe/frontend/widgets/common/importComponent.js +7 -0
  96. package/fe/frontend/widgets/common/language.d.ts +2 -0
  97. package/fe/frontend/widgets/common/language.js +8 -0
  98. package/fe/frontend/widgets/common/logFn/index.d.ts +4 -0
  99. package/fe/frontend/widgets/common/logFn/index.js +8 -0
  100. package/fe/frontend/widgets/common/menu.d.ts +22 -0
  101. package/fe/frontend/widgets/common/menu.js +80 -0
  102. package/fe/frontend/widgets/common/request.d.ts +33 -0
  103. package/fe/frontend/widgets/common/request.js +127 -0
  104. package/fe/frontend/widgets/components/BasePage/HeaderView.d.ts +9 -0
  105. package/fe/frontend/widgets/components/BasePage/HeaderView.js +14 -0
  106. package/fe/frontend/widgets/components/Router/index.d.ts +9 -0
  107. package/fe/frontend/widgets/components/Router/index.js +11 -0
  108. package/fe/frontend/widgets/components/Router/type.d.ts +2 -0
  109. package/fe/frontend/widgets/components/Router/type.js +1 -0
  110. package/fe/frontend/widgets/defaultPages/Iframe/index.d.ts +3 -0
  111. package/fe/frontend/widgets/defaultPages/Iframe/index.js +14 -0
  112. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/DetailPanel.d.ts +7 -0
  113. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/DetailPanel.js +94 -0
  114. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/PopFrom.d.ts +13 -0
  115. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/PopFrom.js +109 -0
  116. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/data.d.ts +3 -0
  117. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/data.js +6 -0
  118. package/fe/frontend/widgets/defaultPages/Schema/components/SchemaSearch/index.d.ts +3 -0
  119. package/fe/frontend/widgets/defaultPages/Schema/components/SchemaSearch/index.js +58 -0
  120. package/fe/frontend/widgets/defaultPages/Schema/components/SchemaTable/index.d.ts +11 -0
  121. package/fe/frontend/widgets/defaultPages/Schema/components/SchemaTable/index.js +176 -0
  122. package/fe/frontend/widgets/defaultPages/Schema/data/eventInfo.d.ts +8 -0
  123. package/fe/frontend/widgets/defaultPages/Schema/data/eventInfo.js +6 -0
  124. package/fe/frontend/widgets/defaultPages/Schema/data/index.d.ts +3 -0
  125. package/fe/frontend/widgets/defaultPages/Schema/data/index.js +1 -0
  126. package/fe/frontend/widgets/defaultPages/Schema/hooks/useComConfig.d.ts +10 -0
  127. package/fe/frontend/widgets/defaultPages/Schema/hooks/useComConfig.js +14 -0
  128. package/fe/frontend/widgets/defaultPages/Schema/index.d.ts +3 -0
  129. package/fe/frontend/widgets/defaultPages/Schema/index.js +67 -0
  130. package/fe/frontend/widgets/defaultPages/Schema/schemaType.d.ts +41 -0
  131. package/fe/frontend/widgets/defaultPages/Schema/schemaType.js +4 -0
  132. package/fe/frontend/widgets/defaultPages/Schema/stores/schemaEventBus.d.ts +23 -0
  133. package/fe/frontend/widgets/defaultPages/Schema/stores/schemaEventBus.js +66 -0
  134. package/fe/frontend/widgets/defaultPages/Schema/stores/schemaStore.d.ts +33 -0
  135. package/fe/frontend/widgets/defaultPages/Schema/stores/schemaStore.js +24 -0
  136. package/fe/frontend/widgets/defaultPages/Schema/utils/fetchErrorShow.d.ts +3 -0
  137. package/fe/frontend/widgets/defaultPages/Schema/utils/fetchErrorShow.js +8 -0
  138. package/fe/frontend/widgets/defaultPages/Schema/utils/permissions.d.ts +3 -0
  139. package/fe/frontend/widgets/defaultPages/Schema/utils/permissions.js +3 -0
  140. package/fe/frontend/widgets/defaultPages/Schema/utils/schemaConversion.d.ts +3 -0
  141. package/fe/frontend/widgets/defaultPages/Schema/utils/schemaConversion.js +72 -0
  142. package/fe/frontend/widgets/defaultPages/Schema/utils/validator.d.ts +4 -0
  143. package/fe/frontend/widgets/defaultPages/Schema/utils/validator.js +31 -0
  144. package/fe/frontend/widgets/defaultPages/SidebarSlotPage/SidebarSlotContainer.d.ts +10 -0
  145. package/fe/frontend/widgets/defaultPages/SidebarSlotPage/SidebarSlotContainer.js +31 -0
  146. package/fe/frontend/widgets/defaultPages/SidebarSlotPage/index.d.ts +3 -0
  147. package/fe/frontend/widgets/defaultPages/SidebarSlotPage/index.js +15 -0
  148. package/fe/frontend/widgets/defaultPages/SidebarSlotPageTmp.d.ts +3 -0
  149. package/fe/frontend/widgets/defaultPages/SidebarSlotPageTmp.js +17 -0
  150. package/fe/frontend/widgets/defaultPages/SlotPage/index.d.ts +3 -0
  151. package/fe/frontend/widgets/defaultPages/SlotPage/index.js +24 -0
  152. package/fe/frontend/widgets/defaultPages/Todo.d.ts +3 -0
  153. package/fe/frontend/widgets/defaultPages/Todo.js +5 -0
  154. package/fe/frontend/widgets/hooks/useCurrentMenuData.d.ts +11 -0
  155. package/fe/frontend/widgets/hooks/useCurrentMenuData.js +20 -0
  156. package/fe/frontend/widgets/hooks/useRouterParams.d.ts +5 -0
  157. package/fe/frontend/widgets/hooks/useRouterParams.js +11 -0
  158. package/fe/frontend/widgets/store/mode.d.ts +16 -0
  159. package/fe/frontend/widgets/store/mode.js +36 -0
  160. package/fe/model/types/data/button.d.ts +23 -0
  161. package/fe/model/types/data/button.js +1 -0
  162. package/fe/model/types/data/component.d.ts +37 -0
  163. package/fe/model/types/data/component.js +1 -0
  164. package/fe/model/types/data/fetchInfo.d.ts +8 -0
  165. package/fe/model/types/data/fetchInfo.js +1 -0
  166. package/fe/model/types/data/schema.d.ts +47 -0
  167. package/fe/model/types/data/schema.js +1 -0
  168. package/fe/model/types/data/search.d.ts +7 -0
  169. package/fe/model/types/data/search.js +1 -0
  170. package/fe/model/types/menuType.d.ts +44 -0
  171. package/fe/model/types/menuType.js +1 -0
  172. package/fe/model/types/model.d.ts +20 -0
  173. package/fe/model/types/model.js +1 -0
  174. package/fe/packages/common/array/index.d.ts +7 -0
  175. package/fe/packages/common/array/index.js +40 -0
  176. package/fe/packages/common/cache/LRUCache.d.ts +13 -0
  177. package/fe/packages/common/cache/LRUCache.js +47 -0
  178. package/fe/packages/common/cache/index.d.ts +2 -0
  179. package/fe/packages/common/cache/index.js +1 -0
  180. package/fe/packages/common/guards/index.d.ts +9 -0
  181. package/fe/packages/common/guards/index.js +24 -0
  182. package/fe/packages/common/i18n/default.d.ts +87 -0
  183. package/fe/packages/common/i18n/default.js +85 -0
  184. package/fe/packages/common/i18n/en-US.d.ts +87 -0
  185. package/fe/packages/common/i18n/en-US.js +85 -0
  186. package/fe/packages/common/i18n/index.d.ts +19 -0
  187. package/fe/packages/common/i18n/index.js +142 -0
  188. package/fe/packages/common/i18n/locales.d.ts +8 -0
  189. package/fe/packages/common/i18n/locales.js +10 -0
  190. package/fe/packages/common/i18n/types.d.ts +47 -0
  191. package/fe/packages/common/i18n/types.js +1 -0
  192. package/fe/packages/common/index.d.ts +10 -0
  193. package/fe/packages/common/index.js +9 -0
  194. package/fe/packages/common/log/index.d.ts +33 -0
  195. package/fe/packages/common/log/index.js +176 -0
  196. package/fe/packages/common/number/index.d.ts +3 -0
  197. package/fe/packages/common/number/index.js +10 -0
  198. package/fe/packages/common/object/filterEmpty.d.ts +3 -0
  199. package/fe/packages/common/object/filterEmpty.js +33 -0
  200. package/fe/packages/common/object/index.d.ts +5 -0
  201. package/fe/packages/common/object/index.js +25 -0
  202. package/fe/packages/common/string/index.d.ts +4 -0
  203. package/fe/packages/common/string/index.js +17 -0
  204. package/fe/packages/common/types/index.d.ts +4 -0
  205. package/fe/packages/common/types/index.js +1 -0
  206. package/fe/packages/ui/react/components/Button/Button.d.ts +16 -30
  207. package/fe/packages/ui/react/components/Button/Button.js +53 -26
  208. package/fe/packages/ui/react/components/Button/SumbitButton.d.ts +2 -6
  209. package/fe/packages/ui/react/components/Button/SumbitButton.js +3 -14
  210. package/fe/packages/ui/react/components/Button/index.d.ts +1 -1
  211. package/fe/packages/ui/react/components/Checkbox/Checkbox.d.ts +1 -1
  212. package/fe/packages/ui/react/components/Checkbox/Checkbox.js +5 -3
  213. package/fe/packages/ui/react/components/{ConfirmDialog.d.ts → ConfirmDialog/ConfirmDialog.d.ts} +0 -8
  214. package/fe/packages/ui/react/components/ConfirmDialog/ConfirmDialog.js +11 -0
  215. package/fe/packages/ui/react/components/ConfirmDialog/index.d.ts +2 -0
  216. package/fe/packages/ui/react/components/ConfirmDialog/index.js +1 -0
  217. package/fe/packages/ui/react/components/DataTable/ActionBtn.d.ts +3 -1
  218. package/fe/packages/ui/react/components/DataTable/ActionBtn.js +85 -4
  219. package/fe/packages/ui/react/components/DataTable/{data-table.d.ts → index.d.ts} +10 -23
  220. package/fe/packages/ui/react/components/DataTable/{data-table.js → index.js} +57 -47
  221. package/fe/packages/ui/react/components/Date/Calendar.d.ts +0 -13
  222. package/fe/packages/ui/react/components/Date/Calendar.js +5 -13
  223. package/fe/packages/ui/react/components/Date/Date.d.ts +4 -13
  224. package/fe/packages/ui/react/components/Date/Date.js +70 -66
  225. package/fe/packages/ui/react/components/Date/LocaleContext.d.ts +0 -4
  226. package/fe/packages/ui/react/components/Date/LocaleContext.js +0 -4
  227. package/fe/packages/ui/react/components/Date/LocaleProvider.d.ts +0 -11
  228. package/fe/packages/ui/react/components/Date/LocaleProvider.js +0 -11
  229. package/fe/packages/ui/react/components/Date/TimePicker.js +3 -2
  230. package/fe/packages/ui/react/components/Date/dateLocaleStore.d.ts +0 -6
  231. package/fe/packages/ui/react/components/Date/dropdownPositioning.d.ts +3 -0
  232. package/fe/packages/ui/react/components/Date/dropdownPositioning.js +12 -0
  233. package/fe/packages/ui/react/components/Date/locales.d.ts +1 -19
  234. package/fe/packages/ui/react/components/Date/locales.js +7 -47
  235. package/fe/packages/ui/react/components/Drawer/Drawer.d.ts +23 -0
  236. package/fe/packages/ui/react/components/Drawer/Drawer.js +100 -0
  237. package/fe/packages/ui/react/components/Drawer/index.d.ts +3 -0
  238. package/fe/packages/ui/react/components/Drawer/index.js +1 -0
  239. package/fe/packages/ui/react/components/Dropdown/Dropdown.d.ts +24 -0
  240. package/fe/packages/ui/react/components/Dropdown/Dropdown.js +28 -0
  241. package/fe/packages/ui/react/components/Dropdown/index.d.ts +2 -0
  242. package/fe/packages/ui/react/components/Dropdown/index.js +1 -0
  243. package/fe/packages/ui/react/components/Form/Form.d.ts +0 -6
  244. package/fe/packages/ui/react/components/Form/Form.js +1 -1
  245. package/fe/packages/ui/react/components/Form/FormItem.d.ts +0 -21
  246. package/fe/packages/ui/react/components/Form/FormItem.js +2 -9
  247. package/fe/packages/ui/react/components/Form/SchemaForm/data.d.ts +45 -0
  248. package/fe/packages/ui/react/components/Form/{SchemeForm → SchemaForm}/data.js +8 -1
  249. package/fe/packages/ui/react/components/Form/SchemaForm/index.d.ts +60 -0
  250. package/fe/packages/ui/react/components/Form/SchemaForm/index.js +75 -0
  251. package/fe/packages/ui/react/components/Form/index.d.ts +1 -1
  252. package/fe/packages/ui/react/components/Form/index.js +1 -1
  253. package/fe/packages/ui/react/components/ImagePreview/ImagePreview.js +15 -20
  254. package/fe/packages/ui/react/components/ImagePreview/PreviewImage.d.ts +0 -3
  255. package/fe/packages/ui/react/components/ImagePreview/PreviewImage.js +5 -2
  256. package/fe/packages/ui/react/components/Input/Input.d.ts +3 -21
  257. package/fe/packages/ui/react/components/Input/Input.js +5 -7
  258. package/fe/packages/ui/react/components/InputNumber/InputNumber.d.ts +26 -0
  259. package/fe/packages/ui/react/components/InputNumber/InputNumber.js +144 -0
  260. package/fe/packages/ui/react/components/InputNumber/index.d.ts +2 -0
  261. package/fe/packages/ui/react/components/InputNumber/index.js +1 -0
  262. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.d.ts +30 -0
  263. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.js +63 -0
  264. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.d.ts +2 -0
  265. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.js +27 -0
  266. package/fe/packages/ui/react/components/Label/Label.d.ts +0 -29
  267. package/fe/packages/ui/react/components/Label/Label.js +2 -4
  268. package/fe/packages/ui/react/components/Menu/Menu.d.ts +18 -0
  269. package/fe/packages/ui/react/components/Menu/Menu.js +98 -0
  270. package/fe/packages/ui/react/components/Menu/MenuContext.d.ts +39 -0
  271. package/fe/packages/ui/react/components/Menu/MenuContext.js +97 -0
  272. package/fe/packages/ui/react/components/Menu/MenuItem.d.ts +3 -0
  273. package/fe/packages/ui/react/components/Menu/MenuItem.js +33 -0
  274. package/fe/packages/ui/react/components/Menu/SubMenu.d.ts +3 -0
  275. package/fe/packages/ui/react/components/Menu/SubMenu.js +124 -0
  276. package/fe/packages/ui/react/components/Menu/index.d.ts +9 -0
  277. package/fe/packages/ui/react/components/Menu/index.js +5 -0
  278. package/fe/packages/ui/react/components/Menu/menuTypes.d.ts +58 -0
  279. package/fe/packages/ui/react/components/Menu/menuTypes.js +1 -0
  280. package/fe/packages/ui/react/components/Menu/utils.d.ts +2 -0
  281. package/fe/packages/ui/react/components/Menu/utils.js +7 -0
  282. package/fe/packages/ui/react/components/Message/Message.d.ts +0 -7
  283. package/fe/packages/ui/react/components/Message/Message.js +4 -4
  284. package/fe/packages/ui/react/components/Message/MessageManager.js +0 -8
  285. package/fe/packages/ui/react/components/Modal/Modal.d.ts +3 -7
  286. package/fe/packages/ui/react/components/Modal/Modal.js +6 -44
  287. package/fe/packages/ui/react/components/Modal/ModalManager.d.ts +0 -12
  288. package/fe/packages/ui/react/components/Modal/ModalManager.js +5 -7
  289. package/fe/packages/ui/react/components/Overlay/Overlay.d.ts +20 -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.d.ts → Pagination/Pagination.d.ts} +0 -7
  294. package/fe/packages/ui/react/components/{Pagination.js → Pagination/Pagination.js} +5 -12
  295. package/fe/packages/ui/react/components/Pagination/index.d.ts +2 -0
  296. package/fe/packages/ui/react/components/Pagination/index.js +1 -0
  297. package/fe/packages/ui/react/components/Popup/Popup.d.ts +26 -0
  298. package/fe/packages/ui/react/components/Popup/Popup.js +69 -0
  299. package/fe/packages/ui/react/components/Popup/index.d.ts +2 -0
  300. package/fe/packages/ui/react/components/Popup/index.js +1 -0
  301. package/fe/packages/ui/react/components/Search/Search.d.ts +2 -5
  302. package/fe/packages/ui/react/components/Search/Search.js +3 -3
  303. package/fe/packages/ui/react/components/Select/Select.d.ts +2 -2
  304. package/fe/packages/ui/react/components/Select/Select.js +52 -113
  305. package/fe/packages/ui/react/components/Select/dropdownPositioning.d.ts +3 -0
  306. package/fe/packages/ui/react/components/Select/dropdownPositioning.js +13 -0
  307. package/fe/packages/ui/react/components/Skeleton/Skeleton.d.ts +0 -15
  308. package/fe/packages/ui/react/components/Skeleton/Skeleton.js +3 -3
  309. package/fe/packages/ui/react/components/Switch/Switch.js +3 -1
  310. package/fe/packages/ui/react/components/TableSearch/TableSearch.d.ts +5 -41
  311. package/fe/packages/ui/react/components/TableSearch/TableSearch.js +21 -22
  312. package/fe/packages/ui/react/components/TableSearch/lang.js +5 -14
  313. package/fe/packages/ui/react/components/Textarea/Textarea.d.ts +21 -0
  314. package/fe/packages/ui/react/components/Textarea/Textarea.js +36 -0
  315. package/fe/packages/ui/react/components/Textarea/index.d.ts +2 -0
  316. package/fe/packages/ui/react/components/Textarea/index.js +1 -0
  317. package/fe/packages/ui/react/components/Tooltip/Tooltip.d.ts +9 -0
  318. package/fe/packages/ui/react/components/Tooltip/Tooltip.js +71 -0
  319. package/fe/packages/ui/react/components/Tooltip/index.d.ts +2 -0
  320. package/fe/packages/ui/react/components/Tooltip/index.js +1 -0
  321. package/fe/packages/ui/react/components/{TreeSelect.d.ts → TreeSelect/TreeSelect.d.ts} +0 -6
  322. package/fe/packages/ui/react/components/{TreeSelect.js → TreeSelect/TreeSelect.js} +9 -17
  323. package/fe/packages/ui/react/components/TreeSelect/index.d.ts +2 -0
  324. package/fe/packages/ui/react/components/TreeSelect/index.js +1 -0
  325. package/fe/packages/ui/react/components/Upload/ImageUpload.js +18 -6
  326. package/fe/packages/ui/react/components/Upload/Upload.d.ts +0 -27
  327. package/fe/packages/ui/react/components/Upload/Upload.js +2 -1
  328. package/fe/packages/ui/react/components/{breadcrumb.js → breadcrumb/breadcrumb.js} +15 -21
  329. package/fe/packages/ui/react/components/breadcrumb/index.d.ts +2 -0
  330. package/fe/packages/ui/react/components/breadcrumb/index.js +1 -0
  331. package/fe/packages/ui/react/components/hooks/useDropdownPositioning.d.ts +43 -0
  332. package/fe/packages/ui/react/components/hooks/useDropdownPositioning.js +123 -0
  333. package/fe/packages/ui/react/components/hooks/useInputController.d.ts +0 -3
  334. package/fe/packages/ui/react/components/hooks/useInputController.js +0 -7
  335. package/fe/packages/ui/react/components/index.d.ts +7 -1
  336. package/fe/packages/ui/react/components/index.js +7 -1
  337. package/fe/packages/ui/react/components/table/index.d.ts +2 -0
  338. package/fe/packages/ui/react/components/table/index.js +1 -0
  339. package/fe/packages/ui/react/components/table/table.js +20 -0
  340. package/fe/packages/ui/react/components/testPage/MenuTestPage.d.ts +2 -0
  341. package/fe/packages/ui/react/components/testPage/MenuTestPage.js +101 -0
  342. package/fe/packages/ui/react/components/testPage/index.js +251 -81
  343. package/fe/packages/ui/react/hooks/useExecuteOnce.d.ts +12 -0
  344. package/fe/packages/ui/react/hooks/useExecuteOnce.js +36 -0
  345. package/fe/packages/ui/react/hooks/useInit.d.ts +1 -1
  346. package/fe/packages/ui/react/hooks/useInit.js +1 -1
  347. package/fe/packages/ui/react/hooks/useLanguage.d.ts +1 -6
  348. package/fe/packages/ui/react/hooks/useRefState.d.ts +18 -0
  349. package/fe/packages/ui/react/hooks/useRefState.js +28 -0
  350. package/fe/packages/ui/react/hooks/useWatch.d.ts +15 -0
  351. package/fe/packages/ui/react/hooks/useWatch.js +87 -0
  352. package/fe/packages/ui/react/hooks/useWatch.test.d.ts +2 -0
  353. package/fe/packages/ui/react/hooks/useWatch.test.js +22 -0
  354. package/fe/packages/ui/react/i18n/I18nProvider.d.ts +13 -0
  355. package/fe/packages/ui/react/i18n/I18nProvider.js +25 -0
  356. package/fe/packages/ui/react/i18n/index.d.ts +4 -0
  357. package/fe/packages/ui/react/i18n/index.js +3 -0
  358. package/fe/packages/ui/react/i18n/useI18n.d.ts +9 -0
  359. package/fe/packages/ui/react/i18n/useI18n.js +14 -0
  360. package/fe/packages/ui/react/index.css +238 -0
  361. package/fe/packages/ui/react/index.d.ts +2 -0
  362. package/fe/packages/ui/react/index.js +2 -2
  363. package/fe/packages/ui/react/lib/createStoreHook.d.ts +9 -0
  364. package/fe/packages/ui/react/lib/createStoreHook.js +6 -0
  365. package/fe/packages/ui/react/lib/export.d.ts +2 -46
  366. package/fe/packages/ui/react/lib/export.js +0 -40
  367. package/fe/packages/ui/react/lib/utils.d.ts +0 -24
  368. package/fe/packages/ui/react/lib/utils.js +0 -25
  369. package/fe/packages/ui/react/stores/breadcrumb.js +0 -2
  370. package/fe/packages/ui/react/stores/language.d.ts +3 -12
  371. package/fe/packages/ui/react/stores/language.js +2 -51
  372. package/fe/typings/type.d.ts +5 -0
  373. package/fe/typings/type.js +1 -0
  374. package/package.json +12 -1
  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/fe/packages/ui/react/components/ConfirmDialog.js +0 -9
  405. package/fe/packages/ui/react/components/Dropdown.d.ts +0 -16
  406. package/fe/packages/ui/react/components/Dropdown.js +0 -54
  407. package/fe/packages/ui/react/components/Form/SchemeForm/data.d.ts +0 -51
  408. package/fe/packages/ui/react/components/Form/SchemeForm/index.d.ts +0 -152
  409. package/fe/packages/ui/react/components/Form/SchemeForm/index.js +0 -69
  410. package/fe/packages/ui/react/components/Textarea.d.ts +0 -59
  411. package/fe/packages/ui/react/components/Textarea.js +0 -35
  412. package/fe/packages/ui/react/components/Tooltip.d.ts +0 -25
  413. package/fe/packages/ui/react/components/Tooltip.js +0 -118
  414. package/fe/packages/ui/react/components/table.js +0 -20
  415. package/fe/packages/ui/react/locales/index.d.ts +0 -8
  416. package/fe/packages/ui/react/locales/index.js +0 -6
  417. /package/fe/packages/ui/react/components/{breadcrumb.d.ts → breadcrumb/breadcrumb.d.ts} +0 -0
  418. /package/fe/packages/ui/react/components/{table.d.ts → table/table.d.ts} +0 -0
@@ -1,42 +1,69 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn } from '../../lib/utils';
3
3
  import { forwardRef } from 'react';
4
- const Button = forwardRef(({ className, variant = 'default', size = 'md', disabled, loading, leftIcon, rightIcon, noUnderline, children, ...props }, ref) => {
4
+ const Button = forwardRef((props, ref) => {
5
+ const { className, size = 'md', state, disabled: disabledProp, loading: loadingProp, leftIcon, rightIcon, noUnderline, children, } = props;
6
+ const variant = props.variant ?? 'default';
7
+ const danger = state === 'danger';
8
+ const ghost = state === 'ghost';
9
+ const loading = loadingProp;
10
+ const disabled = disabledProp;
5
11
  const isDisabled = disabled || loading;
6
- // 基础样式
7
- const baseStyles = 'inline-flex items-center justify-center rounded-lg font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2';
8
- // 变体样式
9
- const variantStyles = {
10
- default: 'bg-white border border-border text-foreground hover:bg-muted/50 focus-visible:ring-border',
11
- primary: 'bg-theme text-theme-foreground border border-theme hover:bg-theme/90 focus-visible:ring-theme',
12
- text: 'bg-transparent border-0 text-foreground hover:bg-muted/30 focus-visible:ring-border',
13
- // 链接样式按钮:无背景、无边框、与正文相同颜色,仅在悬停时下划线(可通过 noUnderline 控制)
14
- link: 'bg-transparent border-0 text-foreground focus-visible:ring-border',
12
+ const baseStyles = 'inline-flex items-center justify-center rounded-lg font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 cursor-pointer';
13
+ const getVariantStyles = () => {
14
+ if (variant === 'text' || variant === 'link') {
15
+ return danger
16
+ ? 'bg-transparent border-0 text-destructive focus-visible:ring-destructive'
17
+ : 'bg-transparent border-0 text-foreground focus-visible:ring-border';
18
+ }
19
+ const ghostStyles = ghost && 'bg-transparent hover:bg-transparent';
20
+ if (danger) {
21
+ if (variant === 'primary') {
22
+ return cn(ghost
23
+ ? 'border border-destructive text-destructive focus-visible:ring-destructive'
24
+ : 'bg-destructive text-destructive-foreground border border-destructive hover:bg-destructive/90 focus-visible:ring-destructive', ghostStyles);
25
+ }
26
+ return cn(ghost ? 'text-destructive' : 'bg-background text-destructive hover:bg-destructive/10', variant === 'dashed' ? 'border border-dashed' : 'border', 'border-destructive focus-visible:ring-destructive', ghostStyles);
27
+ }
28
+ const variantStyles = {
29
+ default: 'bg-background border border-border text-foreground hover:bg-muted/50 focus-visible:ring-border',
30
+ primary: 'bg-theme text-theme-foreground border border-theme hover:bg-theme/90 focus-visible:ring-theme',
31
+ dashed: 'bg-background border border-dashed border-border text-foreground hover:bg-muted/50 focus-visible:ring-border',
32
+ text: 'bg-transparent border-0 text-foreground focus-visible:ring-border',
33
+ };
34
+ return cn(variantStyles[variant], ghostStyles);
15
35
  };
16
- // 禁用状态样式(根据不同 variant)
17
- const disabledStyles = {
18
- default: 'disabled:bg-white/60 disabled:border-border/60 disabled:text-foreground/60 disabled:hover:bg-white/60',
19
- primary: 'disabled:bg-theme/60 disabled:border-theme/0 disabled:text-theme-foreground/60 disabled:hover:bg-theme/60',
20
- text: 'disabled:text-foreground/40 disabled:hover:bg-transparent',
21
- link: 'disabled:text-foreground/40',
22
- };
23
- // 尺寸样式
36
+ const disabledStyles = 'disabled:bg-background/60 disabled:border-border/60 disabled:text-foreground/40 disabled:hover:bg-background/60 aria-disabled:text-foreground/40 aria-disabled:hover:bg-transparent';
24
37
  const sizeStyles = {
25
38
  sm: 'h-8 px-3 text-sm',
26
39
  md: 'h-10 px-4 text-sm',
27
40
  lg: 'h-12 px-6 text-base',
28
41
  };
29
- // 展示内容
42
+ const spinnerSize = {
43
+ sm: 'h-3 w-3',
44
+ md: 'h-4 w-4',
45
+ lg: 'h-5 w-5',
46
+ };
47
+ const loadingIcon = loading ? (_jsx("span", { className: cn('flex items-center', children && 'mr-2'), children: _jsxs("svg", { className: cn('animate-spin', spinnerSize[size]), xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }) }, "loading")) : null;
30
48
  const contents = [
31
- leftIcon && (_jsx("span", { className: cn('flex items-center', 'mr-2'), children: leftIcon }, "left")),
49
+ loadingIcon,
50
+ !loading && leftIcon && (_jsx("span", { className: cn('flex items-center', 'mr-2'), children: leftIcon }, "left")),
32
51
  children,
33
52
  rightIcon ? (_jsx("span", { className: cn('flex items-center', 'ml-2'), children: rightIcon }, "right")) : undefined,
34
53
  ].filter(Boolean);
35
- return (_jsx("button", { ref: ref, className: cn(baseStyles, variantStyles[variant], disabledStyles[variant],
36
- // link 模式不固定高度/内边距,更接近普通文字
37
- variant === 'link' ? 'h-auto px-0 py-0 text-sm font-normal' : sizeStyles[size], variant === 'link' ? '' : 'before:content-normal',
38
- // link 模式下,根据 noUnderline 控制下划线
39
- variant === 'link' && !noUnderline && 'hover:underline', variant === 'link' && !noUnderline && 'disabled:hover:no-underline', isDisabled && 'cursor-not-allowed', className), disabled: isDisabled, ...props, children: contents }));
54
+ const buttonClassName = cn('tc-ui-button', baseStyles, getVariantStyles(), disabledStyles, ['text', 'link'].includes(variant) ? 'h-auto px-0 py-0 text-sm font-normal' : sizeStyles[size], ['text', 'link'].includes(variant) ? '' : 'before:content-normal', variant === 'link' && !noUnderline && 'hover:underline', variant === 'link' && !noUnderline && 'aria-disabled:hover:no-underline', disabled && !loading && 'cursor-not-allowed', loading && 'cursor-wait', className);
55
+ if (props.variant === 'link') {
56
+ const { className: _className, variant: _variant, size: _size, state: _state, disabled: _disabled, loading: _loading, leftIcon: _leftIcon, rightIcon: _rightIcon, noUnderline: _noUnderline, children: _children, onClick, tabIndex, ...anchorProps } = props;
57
+ return (_jsx("a", { ref: ref, className: buttonClassName, "aria-disabled": isDisabled || undefined, tabIndex: isDisabled ? -1 : tabIndex, onClick: (event) => {
58
+ if (isDisabled) {
59
+ event.preventDefault();
60
+ return;
61
+ }
62
+ onClick?.(event);
63
+ }, ...anchorProps, children: contents }));
64
+ }
65
+ const { className: _className, variant: _variant, size: _size, state: _state, disabled: _disabled, loading: _loading, leftIcon: _leftIcon, rightIcon: _rightIcon, noUnderline: _noUnderline, children: _children, ...buttonProps } = props;
66
+ return (_jsx("button", { ref: ref, className: buttonClassName, disabled: isDisabled, ...buttonProps, children: contents }));
40
67
  });
41
68
  Button.displayName = 'Button';
42
69
  export { Button };
@@ -1,12 +1,8 @@
1
1
  import type { MOmit } from '../../types';
2
- import { type ButtonProps } from './Button';
3
- export type SumbitButtonProps = MOmit<ButtonProps, 'onClick'> & {
2
+ import { type ButtonElementProps } from './Button';
3
+ export type SumbitButtonProps = MOmit<ButtonElementProps, 'onClick'> & {
4
4
  onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => Promise<void | boolean> | void;
5
5
  };
6
- /**
7
- *
8
- * 会自动添加loading 其余同button一致
9
- */
10
6
  declare const SumbitButton: (props: SumbitButtonProps) => import("react/jsx-runtime").JSX.Element;
11
7
  declare const AsynchronousButton: (props: SumbitButtonProps) => import("react/jsx-runtime").JSX.Element;
12
8
  export { AsynchronousButton, SumbitButton };
@@ -1,22 +1,11 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cn } from '../../lib/utils';
3
3
  import { useState } from 'react';
4
4
  import { Button } from './Button';
5
- /**
6
- *
7
- * 会自动添加loading 其余同button一致
8
- */
9
5
  const SumbitButton = (props) => {
10
- const { onClick, leftIcon, size = 'md', ...bprops } = props;
6
+ const { onClick, className, loading: loadingProp, ...bprops } = props;
11
7
  const [loading, uLoading] = useState(false);
12
- // Loading spinner icon - 根据按钮尺寸调整大小
13
- const spinnerSize = {
14
- sm: 'h-3 w-3',
15
- md: 'h-4 w-4',
16
- lg: 'h-5 w-5',
17
- };
18
- const loadingIcon = loading ? (_jsx("span", { className: cn('flex items-center', 'mr-2'), children: _jsxs("svg", { className: cn('animate-spin', spinnerSize[size]), xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }) })) : null;
19
- return (_jsx(Button, { loading: loading, leftIcon: loading ? loadingIcon : leftIcon, onClick: async (e) => {
8
+ return (_jsx(Button, { className: cn('tc-ui-submit-button', className), loading: loading || loadingProp, onClick: async (e) => {
20
9
  if (loading)
21
10
  return;
22
11
  uLoading(true);
@@ -1,4 +1,4 @@
1
1
  export { Button } from './Button';
2
- export type { ButtonProps, ButtonSize, ButtonVariant } from './Button';
2
+ export type { ButtonElementProps, ButtonLinkProps, ButtonProps, ButtonSize, ButtonState, ButtonVariant } from './Button';
3
3
  export * from './SumbitButton';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -6,7 +6,7 @@ export type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'onChang
6
6
  onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;
7
7
  value?: boolean;
8
8
  };
9
- declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "value"> & {
9
+ declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "onChange"> & {
10
10
  checked?: boolean;
11
11
  defaultChecked?: boolean;
12
12
  indeterminate?: boolean;
@@ -1,7 +1,8 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn } from '../../lib/utils';
3
+ import { Check, Minus } from 'lucide-react';
3
4
  import { forwardRef, useLayoutEffect, useRef, useState } from 'react';
4
- const Checkbox = forwardRef(({ className, checked: _controlledChecked, value, defaultChecked, indeterminate, onChange, ...props }, ref) => {
5
+ const Checkbox = forwardRef(({ className, checked: _controlledChecked, value, defaultChecked, indeterminate, onChange, disabled, ...props }, ref) => {
5
6
  const internalRef = useRef(null);
6
7
  const controlledChecked = value ?? _controlledChecked;
7
8
  const setRefs = (element) => {
@@ -24,6 +25,7 @@ const Checkbox = forwardRef(({ className, checked: _controlledChecked, value, de
24
25
  const isControlled = controlledChecked !== undefined;
25
26
  const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);
26
27
  const checked = isControlled ? controlledChecked : internalChecked;
28
+ const showChecked = checked && !indeterminate;
27
29
  const handleChange = (e) => {
28
30
  const newChecked = e.target.checked;
29
31
  if (!isControlled) {
@@ -31,7 +33,7 @@ const Checkbox = forwardRef(({ className, checked: _controlledChecked, value, de
31
33
  }
32
34
  onChange?.(newChecked, e);
33
35
  };
34
- return (_jsx("input", { type: "checkbox", ref: setRefs, checked: checked, onChange: handleChange, className: cn('w-4 h-4 rounded border-gray-300 accent-theme', className), ...props }));
36
+ return (_jsxs("span", { className: cn('tc-ui-checkbox relative inline-flex h-4 w-4 shrink-0', className), children: [_jsx("input", { type: "checkbox", ref: setRefs, checked: checked, disabled: disabled, onChange: handleChange, className: cn('peer absolute inset-0 z-10 m-0 h-full w-full appearance-none rounded opacity-0', disabled ? 'cursor-not-allowed' : 'cursor-pointer'), ...props }), _jsxs("span", { "aria-hidden": "true", className: cn('pointer-events-none flex h-full w-full items-center justify-center rounded border transition-colors peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-background', (showChecked || indeterminate) && 'border-theme bg-theme text-theme-foreground', !showChecked && !indeterminate && 'border-border bg-background text-theme', disabled && 'opacity-60'), children: [showChecked && _jsx(Check, { className: "h-3 w-3", strokeWidth: 3 }), indeterminate && _jsx(Minus, { className: "h-3 w-3", strokeWidth: 3 })] })] }));
35
37
  });
36
38
  Checkbox.displayName = 'Checkbox';
37
39
  export { Checkbox };
@@ -1,19 +1,11 @@
1
1
  export interface ConfirmDialogProps {
2
- /** 是否显示 */
3
2
  open: boolean;
4
- /** 标题 */
5
3
  title?: string;
6
- /** 内容 */
7
4
  content: string;
8
- /** 确认按钮文本 */
9
5
  okText?: string;
10
- /** 取消按钮文本 */
11
6
  cancelText?: string;
12
- /** 确认按钮加载状态 */
13
7
  loading?: boolean;
14
- /** 确认回调 */
15
8
  onOk: () => void | Promise<void>;
16
- /** 取消回调 */
17
9
  onCancel: () => void;
18
10
  }
19
11
  export declare function ConfirmDialog({ open, title, content, okText, cancelText, loading, onOk, onCancel, }: ConfirmDialogProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useI18n } from '../../i18n';
3
+ import { Button } from '../Button';
4
+ import { Modal } from '../Modal';
5
+ export function ConfirmDialog({ open, title, content, okText, cancelText, loading = false, onOk, onCancel, }) {
6
+ const t = useI18n();
7
+ const handleOk = async () => {
8
+ await onOk();
9
+ };
10
+ return (_jsx(Modal, { open: open, onClose: onCancel, title: title ?? t('components.confirmDialog.title'), width: 450, className: "tc-ui-confirm-dialog", footer: _jsxs("div", { className: "flex justify-end gap-3", children: [_jsx(Button, { onClick: onCancel, className: "min-w-[100px] bg-background border-[hsl(var(--theme-primary))] text-[hsl(var(--theme-primary))] hover:bg-[hsl(var(--theme-primary))]/5", children: cancelText ?? t('components.confirmDialog.cancelText') }), _jsx(Button, { variant: "primary", loading: loading, onClick: handleOk, className: "min-w-[100px] bg-[hsl(var(--theme-primary))] hover:bg-[hsl(var(--theme-primary))]/90 border-[hsl(var(--theme-primary))] text-[hsl(var(--theme-primary-foreground))]", children: okText ?? t('components.confirmDialog.okText') })] }), children: _jsx("div", { className: "py-4 text-base text-foreground", children: content }) }));
11
+ }
@@ -0,0 +1,2 @@
1
+ export * from './ConfirmDialog';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ export * from './ConfirmDialog';
@@ -1,6 +1,8 @@
1
1
  import { type DropdownItem } from '../Dropdown';
2
+ export type ActionOverflow = 'auto' | 'dropdown' | 'inline';
2
3
  export interface ActionBtnProps {
3
4
  actions: DropdownItem[];
5
+ overflow?: ActionOverflow;
4
6
  }
5
- export declare const ActionBtn: ({ actions }: ActionBtnProps) => "-" | import("react/jsx-runtime").JSX.Element;
7
+ export declare const ActionBtn: ({ actions, overflow }: ActionBtnProps) => import("react/jsx-runtime").JSX.Element | "-";
6
8
  //# sourceMappingURL=ActionBtn.d.ts.map
@@ -1,13 +1,94 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from '../../lib/utils';
2
3
  import { MoreHorizontal } from 'lucide-react';
4
+ import { useCallback, useLayoutEffect, useRef, useState } from 'react';
5
+ import { Button } from '../Button';
3
6
  import { Dropdown } from '../Dropdown';
4
- export const ActionBtn = ({ actions }) => {
7
+ const isInlineAction = (action) => !('render' in action);
8
+ const renderActionLabel = (action) => (_jsxs(_Fragment, { children: [action.icon && _jsx("span", { className: "flex-shrink-0", children: action.icon }), _jsx("span", { className: "truncate", children: action.label })] }));
9
+ const canShowInlineActions = (actions) => actions.every(isInlineAction);
10
+ const InlineActions = ({ actions }) => (_jsx("div", { className: "tc-ui-action-btn-list inline-flex max-w-full items-center justify-center gap-1 whitespace-nowrap", children: actions.map((action) => isInlineAction(action) ? (_jsx(Button, { type: "button", onClick: action.onClick, className: cn('tc-ui-action-btn inline-flex h-8 max-w-full items-center justify-center gap-1 rounded px-2 text-sm transition-colors', action.danger ? 'text-red-600 hover:bg-red-50' : 'text-table-action-text hover:bg-background/60'), children: renderActionLabel(action) }, action.key)) : null) }));
11
+ const DropdownActions = ({ actions }) => (_jsx(Dropdown, { items: actions, children: _jsx(Button, { type: "button", state: "ghost", variant: "text", "aria-label": "More actions", className: "inline-flex h-8 w-8 items-center justify-center rounded transition-colors hover:bg-background/60", children: _jsx(MoreHorizontal, { className: "h-5 w-5 text-gray-600" }) }) }));
12
+ const AutoActionBtn = ({ actions }) => {
13
+ const containerRef = useRef(null);
14
+ const measureRef = useRef(null);
15
+ const [canShowInline, setCanShowInline] = useState(false);
16
+ const updateOverflow = useCallback(() => {
17
+ const container = containerRef.current;
18
+ const measure = measureRef.current;
19
+ if (!container || !measure) {
20
+ setCanShowInline(false);
21
+ return;
22
+ }
23
+ const containerWidth = container.clientWidth;
24
+ const actionsWidth = measure.scrollWidth;
25
+ setCanShowInline(containerWidth > 0 && actionsWidth <= containerWidth);
26
+ }, []);
27
+ useLayoutEffect(() => {
28
+ if (!canShowInlineActions(actions))
29
+ return;
30
+ if (actions.length <= 1)
31
+ return;
32
+ updateOverflow();
33
+ let rafId = 0;
34
+ const scheduleUpdate = () => {
35
+ cancelAnimationFrame(rafId);
36
+ rafId = requestAnimationFrame(updateOverflow);
37
+ };
38
+ if (typeof ResizeObserver === 'undefined') {
39
+ window.addEventListener('resize', scheduleUpdate);
40
+ return () => {
41
+ cancelAnimationFrame(rafId);
42
+ window.removeEventListener('resize', scheduleUpdate);
43
+ };
44
+ }
45
+ const observer = new ResizeObserver(scheduleUpdate);
46
+ if (containerRef.current) {
47
+ observer.observe(containerRef.current);
48
+ }
49
+ if (measureRef.current) {
50
+ observer.observe(measureRef.current);
51
+ }
52
+ window.addEventListener('resize', scheduleUpdate);
53
+ return () => {
54
+ cancelAnimationFrame(rafId);
55
+ observer.disconnect();
56
+ window.removeEventListener('resize', scheduleUpdate);
57
+ };
58
+ }, [actions, updateOverflow]);
5
59
  if (actions.length === 0) {
6
60
  return '-';
7
61
  }
62
+ if (actions.length === 1) {
63
+ if (!canShowInlineActions(actions)) {
64
+ return _jsx(DropdownActions, { actions: actions });
65
+ }
66
+ return _jsx(InlineActions, { actions: actions });
67
+ }
68
+ if (!canShowInlineActions(actions)) {
69
+ return _jsx(DropdownActions, { actions: actions });
70
+ }
71
+ return (_jsxs("div", { ref: containerRef, className: "relative w-full min-w-0", children: [_jsx("div", { ref: measureRef, "aria-hidden": "true", className: "pointer-events-none invisible absolute left-0 top-0 w-max max-w-none", children: _jsx(InlineActions, { actions: actions }) }), canShowInline ? _jsx(InlineActions, { actions: actions }) : _jsx(DropdownActions, { actions: actions })] }));
72
+ };
73
+ export const ActionBtn = ({ actions, overflow }) => {
74
+ if (overflow === 'dropdown') {
75
+ return actions.length === 0 ? '-' : _jsx(DropdownActions, { actions: actions });
76
+ }
77
+ if (overflow === 'auto') {
78
+ return _jsx(AutoActionBtn, { actions: actions });
79
+ }
80
+ if (actions.length === 0) {
81
+ return '-';
82
+ }
83
+ if (overflow === 'inline') {
84
+ return canShowInlineActions(actions) ? _jsx(InlineActions, { actions: actions }) : _jsx(DropdownActions, { actions: actions });
85
+ }
8
86
  if (actions.length === 1) {
9
87
  const action = actions[0];
10
- return (_jsx("button", { onClick: action.onClick, className: "inline-flex items-center justify-center w-8 h-8 rounded transition-colors", children: action.label }));
88
+ if (!isInlineAction(action)) {
89
+ return _jsx(DropdownActions, { actions: actions });
90
+ }
91
+ return (_jsx(Button, { type: "button", onClick: action.onClick, className: "tc-ui-action-btn inline-flex items-center justify-center w-8 h-8 rounded transition-colors", children: action.label }));
11
92
  }
12
- return (_jsx(Dropdown, { items: actions, children: _jsx("button", { className: "inline-flex items-center justify-center w-8 h-8 rounded transition-colors", children: _jsx(MoreHorizontal, { className: "h-5 w-5 text-gray-600" }) }) }));
93
+ return _jsx(DropdownActions, { actions: actions });
13
94
  };
@@ -1,44 +1,31 @@
1
1
  import { type ReactNode } from 'react';
2
+ import type { DropdownItem } from '../Dropdown';
2
3
  import { type PaginationProps } from '../Pagination';
3
4
  import type { ColumnDef } from '../types/baseType';
4
- export type { ColumnDef } from '../types/baseType';
5
+ import { type ActionOverflow } from './ActionBtn';
6
+ type DataTableActionColumnOptions<T> = {
7
+ actions?: DropdownItem[] | ((value: unknown, record: T, index: number) => DropdownItem[]);
8
+ actionOverflow?: ActionOverflow;
9
+ };
10
+ type TableColumnDef<T = Record<string, unknown>> = ColumnDef<T> & DataTableActionColumnOptions<T>;
5
11
  type RowSelection<T> = {
6
- /**
7
- * 受控用法:完全由外部维护选中 keys
8
- */
9
12
  selectedRowKeys?: Array<string | number>;
10
- /**
11
- * 非受控用法:仅作为初始值,后续由内部维护
12
- */
13
13
  defaultSelectedRowKeys?: Array<string | number>;
14
- /**
15
- * 选中项变化回调(受控/非受控都会触发)
16
- */
17
14
  onChange?: (selectedRowKeys: Array<string | number>, selectedRows: T[], isAll: boolean) => void;
18
- /**
19
- * 全选 受控
20
- */
21
15
  isAll?: boolean;
22
- /**
23
- * theader checkbox
24
- */
25
16
  beforeCheckboxNode?: ReactNode;
26
17
  };
27
18
  interface DataTableProps<T = Record<string, unknown>> {
28
- columns: ColumnDef<T>[];
19
+ columns: TableColumnDef<T>[];
29
20
  data: T[];
30
21
  rowKey?: keyof T | ((record: T, index: number) => string | number);
31
22
  rowSelection?: RowSelection<T>;
32
23
  pagination?: PaginationProps;
33
24
  loading?: boolean;
34
- /**
35
- * 统一配置 column width 默认100px
36
- * 会被columns[number].width覆盖
37
- */
38
25
  defaultColumnWidth?: number;
39
26
  }
40
27
  export declare function DataTable<T = Record<string, unknown>>({ columns, data: pData, loading, rowKey, rowSelection, defaultColumnWidth, pagination: pPagination, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
41
28
  export { ActionBtn } from './ActionBtn';
42
29
  export type { ActionBtnProps } from './ActionBtn';
43
- export type { DataTableProps, RowSelection };
44
- //# sourceMappingURL=data-table.d.ts.map
30
+ export type { DataTableProps, RowSelection, TableColumnDef };
31
+ //# sourceMappingURL=index.d.ts.map
@@ -1,34 +1,45 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import noResult from '@tc/ui-react/assets/table/no-result.svg';
3
+ import { useI18n } from '../../i18n';
3
4
  import { useMemo, useState } from 'react';
5
+ import { Checkbox } from '../Checkbox';
4
6
  import { Pagination } from '../Pagination';
5
7
  import { Skeleton } from '../Skeleton';
6
8
  import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../table';
7
- export function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSelection, defaultColumnWidth = 100, pagination: pPagination, }) {
8
- const getRowKey = (record, index) => {
9
- if (typeof rowKey === 'function') {
10
- return rowKey(record, index);
11
- }
12
- const key = record[rowKey];
13
- return typeof key === 'string' || typeof key === 'number' ? key : index;
14
- };
9
+ import { ActionBtn } from './ActionBtn';
10
+ const defaultRowKey = 'id';
11
+ const getRowKey = (record, index, rowKey = defaultRowKey) => {
12
+ if (typeof rowKey === 'function') {
13
+ return rowKey(record, index);
14
+ }
15
+ const key = record[rowKey];
16
+ return typeof key === 'string' || typeof key === 'number' ? key : index;
17
+ };
18
+ const renderCellContent = (column, value, record, rowIndex, hasAction) => {
19
+ if (hasAction && column.actions) {
20
+ const actions = typeof column.actions === 'function' ? column.actions(value, record, rowIndex) : column.actions;
21
+ return (_jsx("div", { className: "flex w-full min-w-0 justify-center", children: _jsx(ActionBtn, { actions: actions, overflow: column.actionOverflow ?? 'auto' }) }));
22
+ }
23
+ return column.render ? column.render(value, record, rowIndex) : value;
24
+ };
25
+ export function DataTable({ columns, data: pData, loading, rowKey = defaultRowKey, rowSelection, defaultColumnWidth = 100, pagination: pPagination, }) {
26
+ const t = useI18n();
15
27
  const getCellValue = (record, column) => record[(column.dataIndex || column.key)];
16
28
  const isControlled = rowSelection && Array.isArray(rowSelection.selectedRowKeys);
17
29
  const [innerSelectedRowKeys, setInnerSelectedRowKeys] = useState(rowSelection?.defaultSelectedRowKeys ?? []);
18
30
  const selectedRowKeys = (isControlled ? rowSelection?.selectedRowKeys : innerSelectedRowKeys) ?? [];
19
31
  const selectedKeySet = new Set(selectedRowKeys);
20
32
  const [currentPage, setCurrentPage] = useState(1);
21
- const { showPagination, pagination, data } = useMemo(() => {
33
+ const { showPagination, pagination, data, pageStartIndex } = useMemo(() => {
22
34
  let pagination;
23
35
  let data = pData;
24
36
  let showPagination;
25
- // 使用外部
37
+ let pageStartIndex = 0;
26
38
  if (pPagination) {
27
39
  pagination = pPagination;
28
40
  showPagination = pagination.total > 0;
29
41
  }
30
42
  else {
31
- // 使用内部
32
43
  pagination = {
33
44
  onChange(v) {
34
45
  setCurrentPage(v);
@@ -38,16 +49,17 @@ export function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSel
38
49
  total: pData.length,
39
50
  };
40
51
  showPagination = pData.length > pagination.pageSize;
41
- data = pData.slice((pagination.current - 1) * pagination.pageSize, pagination.current * pagination.pageSize);
52
+ pageStartIndex = (pagination.current - 1) * pagination.pageSize;
53
+ data = pData.slice(pageStartIndex, pagination.current * pagination.pageSize);
42
54
  }
43
55
  return {
44
56
  showPagination,
45
57
  pagination,
46
58
  data,
59
+ pageStartIndex,
47
60
  };
48
61
  }, [currentPage, pData, pPagination]);
49
- // TODO getRowKey 依赖剥离
50
- const pageRowKeys = pData.map((record, index) => getRowKey(record, index));
62
+ const pageRowKeys = data.map((record, index) => getRowKey(record, pageStartIndex + index, rowKey));
51
63
  const handleRowSelectChange = (key) => {
52
64
  if (!rowSelection)
53
65
  return;
@@ -55,7 +67,7 @@ export function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSel
55
67
  ? selectedRowKeys.filter((k) => k !== key)
56
68
  : [...selectedRowKeys, key];
57
69
  const nextSelectedKeySet = new Set(nextSelectedKeys);
58
- const selectedRows = pData.filter((record, index) => nextSelectedKeySet.has(getRowKey(record, index)));
70
+ const selectedRows = pData.filter((record, index) => nextSelectedKeySet.has(getRowKey(record, index, rowKey)));
59
71
  if (!isControlled) {
60
72
  setInnerSelectedRowKeys(nextSelectedKeys);
61
73
  }
@@ -70,10 +82,8 @@ export function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSel
70
82
  const pageKeySet = new Set(pageRowKeys);
71
83
  nextSelectedKeys = Array.from(new Set([
72
84
  ...selectedRowKeys,
73
- //
74
85
  ...pageRowKeys.filter((key) => !selectedKeySet.has(key)),
75
86
  ]))
76
- //
77
87
  .filter((key) => pageKeySet.has(key) || selectedKeySet.has(key));
78
88
  }
79
89
  else {
@@ -81,27 +91,23 @@ export function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSel
81
91
  nextSelectedKeys = selectedRowKeys.filter((key) => !pageKeySet.has(key));
82
92
  }
83
93
  const nextSelectedKeySet = new Set(nextSelectedKeys);
84
- const selectedRows = pData.filter((record, index) => nextSelectedKeySet.has(getRowKey(record, index)));
94
+ const selectedRows = pData.filter((record, index) => nextSelectedKeySet.has(getRowKey(record, index, rowKey)));
85
95
  if (!isControlled) {
86
96
  setInnerSelectedRowKeys(nextSelectedKeys);
87
97
  }
88
98
  rowSelection.onChange?.(nextSelectedKeys, selectedRows, checked);
89
99
  };
90
100
  const allChecked = rowSelection
91
- ? rowSelection.isAll ?? (pageRowKeys.length > 0 && pageRowKeys.every((key) => selectedKeySet.has(key)))
101
+ ? (rowSelection.isAll ?? (pageRowKeys.length > 0 && pageRowKeys.every((key) => selectedKeySet.has(key))))
92
102
  : false;
93
103
  const partiallyChecked = rowSelection ? pageRowKeys.some((key) => selectedKeySet.has(key)) && !allChecked : false;
94
- return (_jsxs("div", { className: "bg-white rounded-[20px] overflow-hidden relative", children: [_jsxs(Table, { containerClassName: "rounded-b-none overflow-x-auto", children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [rowSelection && (_jsxs(TableHead, { className: "bg-table-header", style: {
104
+ return (_jsxs("div", { className: "tc-ui-data-table bg-background rounded-[20px] overflow-hidden relative", children: [_jsxs(Table, { containerClassName: "rounded-b-none overflow-x-auto", children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [rowSelection && (_jsxs(TableHead, { className: "bg-table-header", style: {
95
105
  width: '48px',
96
106
  minWidth: '48px',
97
107
  position: 'sticky',
98
108
  left: 0,
99
109
  zIndex: 10,
100
- }, children: [rowSelection.beforeCheckboxNode, _jsx("input", { type: "checkbox", className: "w-4 h-4 rounded border-gray-300 accent-theme", checked: allChecked, "aria-label": "Select all rows", ref: (el) => {
101
- if (el) {
102
- el.indeterminate = partiallyChecked;
103
- }
104
- }, onChange: handleSelectAllChange })] })), columns.map((column) => {
110
+ }, children: [rowSelection.beforeCheckboxNode, _jsx(Checkbox, { checked: allChecked, "aria-label": "Select all rows", indeterminate: partiallyChecked, onChange: (_, event) => handleSelectAllChange(event) })] })), columns.map((column) => {
105
111
  const hasAction = column.isAction ?? column.key === 'action';
106
112
  return (_jsx(TableHead, { isAction: hasAction, style: {
107
113
  ...(hasAction
@@ -115,27 +121,31 @@ export function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSel
115
121
  ? { width: column.width, minWidth: column.width }
116
122
  : { minWidth: defaultColumnWidth }),
117
123
  }, children: column.title }, column.key));
118
- })] }) }), _jsx(TableBody, { children: data.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: columns.length + (rowSelection ? 1 : 0), className: "text-muted-foreground", children: _jsxs("div", { className: "flex flex-col items-center w-full gap-2.5", children: [_jsx("img", { src: noResult, alt: "\u6682\u65E0\u6570\u636E", className: " w-24 h-24" }), "No Data"] }) }) })) : (data.map((record, rowIndex) => (_jsxs(TableRow, { children: [rowSelection && (_jsx(TableCell, { className: "bg-white", style: {
119
- width: '48px',
120
- minWidth: '48px',
121
- position: 'sticky',
122
- left: 0,
123
- zIndex: 1,
124
- }, children: _jsx("input", { type: "checkbox", className: "w-4 h-4 rounded border-gray-300 accent-theme", checked: selectedKeySet.has(getRowKey(record, rowIndex)), "aria-label": "Select row", onChange: () => handleRowSelectChange(getRowKey(record, rowIndex)) }) })), columns.map((column) => {
125
- const value = getCellValue(record, column);
126
- const hasAction = column.isAction ?? column.key === 'action';
127
- return (_jsx(TableCell, { isAction: hasAction, style: {
128
- ...(hasAction
129
- ? {
130
- position: 'sticky',
131
- right: 0,
132
- zIndex: 1,
133
- }
134
- : undefined),
135
- ...(column.width
136
- ? { width: column.width, minWidth: column.width }
137
- : { minWidth: defaultColumnWidth }),
138
- }, children: column.render ? column.render(value, record, rowIndex) : value }, column.key));
139
- })] }, getRowKey(record, rowIndex))))) })] }), loading && (_jsx("div", { className: "absolute inset-0 rounded-[20px] bg-white/70 text-sm text-gray-600 z-[100]", children: _jsx(Skeleton, { mode: "tableloading", rows: 8 }) })), showPagination && (_jsx("div", { className: "px-6 pb-6 mt-6", children: _jsx(Pagination, { ...pagination }) }))] }));
124
+ })] }) }), _jsx(TableBody, { children: data.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: columns.length + (rowSelection ? 1 : 0), className: "text-muted-foreground", children: _jsxs("div", { className: "flex flex-col items-center w-full gap-2.5", children: [_jsx("img", { src: noResult, alt: t('components.dataTable.noData'), className: " w-24 h-24" }), t('components.dataTable.noData')] }) }) })) : (data.map((record, rowIndex) => {
125
+ const absoluteRowIndex = pageStartIndex + rowIndex;
126
+ const recordKey = getRowKey(record, absoluteRowIndex, rowKey);
127
+ return (_jsxs(TableRow, { children: [rowSelection && (_jsx(TableCell, { className: "bg-background", style: {
128
+ width: '48px',
129
+ minWidth: '48px',
130
+ position: 'sticky',
131
+ left: 0,
132
+ zIndex: 1,
133
+ }, children: _jsx(Checkbox, { checked: selectedKeySet.has(recordKey), "aria-label": "Select row", onChange: () => handleRowSelectChange(recordKey) }) })), columns.map((column) => {
134
+ const value = getCellValue(record, column);
135
+ const hasAction = column.isAction ?? column.key === 'action';
136
+ return (_jsx(TableCell, { isAction: hasAction, style: {
137
+ ...(hasAction
138
+ ? {
139
+ position: 'sticky',
140
+ right: 0,
141
+ zIndex: 1,
142
+ }
143
+ : undefined),
144
+ ...(column.width
145
+ ? { width: column.width, minWidth: column.width }
146
+ : { minWidth: defaultColumnWidth }),
147
+ }, children: renderCellContent(column, value, record, rowIndex, hasAction) }, column.key));
148
+ })] }, recordKey));
149
+ })) })] }), loading && (_jsx("div", { className: "absolute inset-0 rounded-[20px] bg-background/70 text-sm text-gray-600 z-[100]", children: _jsx(Skeleton, { mode: "tableloading", rows: 8 }) })), showPagination && (_jsx("div", { className: "px-6 pb-6 mt-6", children: _jsx(Pagination, { ...pagination }) }))] }));
140
150
  }
141
151
  export { ActionBtn } from './ActionBtn';
@@ -5,13 +5,7 @@ export type DateRange = {
5
5
  to?: Date | undefined;
6
6
  };
7
7
  export type QuickRangePreset = {
8
- /**
9
- * 展示文案
10
- */
11
8
  label: string;
12
- /**
13
- * 返回一个范围对象
14
- */
15
9
  getRange: () => DateRange;
16
10
  };
17
11
  export interface CalendarProps {
@@ -21,14 +15,7 @@ export interface CalendarProps {
21
15
  disabledDate?: (date: Date) => boolean;
22
16
  showTime?: boolean;
23
17
  className?: string;
24
- /**
25
- * 自定义文案配置,会覆盖默认文案
26
- */
27
18
  locale?: Partial<DateLocaleConfig>;
28
- /**
29
- * 范围模式下的快捷选择配置
30
- * 不传则使用默认预设
31
- */
32
19
  quickRanges?: QuickRangePreset[];
33
20
  }
34
21
  export declare function Calendar({ mode, value, onChange, disabledDate, showTime, className, locale: customLocale, quickRanges, }: CalendarProps): import("react/jsx-runtime").JSX.Element;