@_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,6 +1,5 @@
1
1
  require("../../../_virtual/_rolldown/runtime.js");
2
2
  const require_packages_core_paths = require("../paths.js");
3
- const require_packages_utils_path = require("../../utils/path.js");
4
3
  const require_packages_utils_loadFile = require("../../utils/loadFile.js");
5
4
  const require_packages_utils_runFileFn = require("../../utils/runFileFn.js");
6
5
  require("../../utils/index.js");
@@ -19,7 +18,7 @@ var extend_default = (app) => {
19
18
  console.log("\x1B[31m%s\x1B[0m", `[extend loader error] name:${fileName} is already in app`);
20
19
  return;
21
20
  }
22
- const exs = require_packages_utils_runFileFn.runFileFn(require(require_packages_utils_path.resolve(filePath)))(app);
21
+ const exs = require_packages_utils_runFileFn.runFileFn(filePath)(app);
23
22
  if (exs instanceof Promise) (async () => {
24
23
  app.extends[fileName] = await exs;
25
24
  })();
@@ -14,12 +14,11 @@ require("../../utils/index.js");
14
14
  */
15
15
  var middleware_default = (app) => {
16
16
  /**
17
- * xx/app/middleware/a/a.js -> app.middleware.a.a =
18
- * require('app/middleware/a/a.js')(app)
17
+ * xx/app/middleware/a/a.(js|ts) -> app.middleware.a.a
19
18
  */
20
19
  app.middlewares = require_packages_core_paths.getAppPaths(app).reduce((preData, currentPath) => {
21
20
  const middlewares = require_packages_utils_loadFile.loadFileFn(currentPath, "middleware", { loadFileCallback: (path) => {
22
- return require_packages_utils_runFileFn.runFileFn(require(path))(app);
21
+ return require_packages_utils_runFileFn.runFileFn(path)(app);
23
22
  } });
24
23
  return {
25
24
  ...preData,
@@ -1,11 +1,12 @@
1
1
  const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
2
2
  const require_packages_utils_loadFile = require("../../utils/loadFile.js");
3
+ const require_packages_utils_runFileFn = require("../../utils/runFileFn.js");
3
4
  let path = require("path");
4
5
  let lodash = require("lodash");
5
6
  lodash = require_runtime.__toESM(lodash, 1);
6
7
  //#region packages/core/loader/model.ts
7
8
  /**
8
- *
9
+ * 获取使用方的 跟路径下的 model文件夹
9
10
  * @param app
10
11
  */
11
12
  var modelLoader = (app) => {
@@ -17,10 +18,10 @@ var modelLoader = (app) => {
17
18
  /**
18
19
  * 1.遍历当前文件夹
19
20
  * 2.根据路径区分 model | project
20
- * 3.根据不同的 类型后去key
21
+ * 3.根据不同的 类型 获取key
21
22
  */
22
23
  loadFileCallback: (file) => {
23
- if (file.indexOf(`model${path.sep}index.js`) === -1) {
24
+ if (!isModelIndexFile(file)) {
24
25
  const filePathChunk = file.split(path.sep);
25
26
  if (filePathChunk[filePathChunk.length - 2] === "project") {
26
27
  const modelKey = filePathChunk[filePathChunk.length - 3];
@@ -76,7 +77,7 @@ var setProject = (config, modelKey, key, file) => {
76
77
  const projectItem = {
77
78
  key,
78
79
  modelKey,
79
- ...require(file)
80
+ ...require_packages_utils_runFileFn.runFileFn(file)
80
81
  };
81
82
  currentModel.project[key] = projectItem;
82
83
  };
@@ -92,16 +93,19 @@ var setModel = (config, key, filePath) => {
92
93
  if (!modelItem) {
93
94
  const newModel = {
94
95
  model: { key },
95
- project: { key }
96
+ project: {}
96
97
  };
97
98
  config.push(newModel);
98
99
  modelItem = newModel;
99
100
  }
100
101
  if (filePath) modelItem.model = {
101
- ...require(filePath),
102
+ ...require_packages_utils_runFileFn.runFileFn(filePath),
102
103
  key
103
104
  };
104
105
  return modelItem;
105
106
  };
107
+ function isModelIndexFile(file) {
108
+ return file.indexOf(`model${path.sep}index.js`) !== -1 || file.indexOf(`model${path.sep}index.ts`) !== -1;
109
+ }
106
110
  //#endregion
107
111
  module.exports = modelLoader;
@@ -2,6 +2,8 @@ require("../../../_virtual/_rolldown/runtime.js");
2
2
  const require_packages_core_paths = require("../paths.js");
3
3
  const require_packages_utils_path = require("../../utils/path.js");
4
4
  const require_packages_utils_loadFile = require("../../utils/loadFile.js");
5
+ const require_packages_utils_runFileFn = require("../../utils/runFileFn.js");
6
+ require("../../utils/index.js");
5
7
  //#region packages/core/loader/router-schema.ts
6
8
  /**
7
9
  *
@@ -9,7 +11,7 @@ const require_packages_utils_loadFile = require("../../utils/loadFile.js");
9
11
  *
10
12
  * @param app
11
13
  *
12
- * xx/app/router-schema/**.js
14
+ * xx/app/router-schema/**.(js|ts)
13
15
  *
14
16
  * 输出:
15
17
  * app.routerSchema = {
@@ -24,7 +26,7 @@ var router_schema_default = (app) => {
24
26
  require_packages_utils_loadFile.loadFileFn(currentPath, "router-schema", { preProcessingFileCallback(file) {
25
27
  routerSchema = {
26
28
  ...routerSchema,
27
- ...require(require_packages_utils_path.resolve(file))
29
+ ...require_packages_utils_runFileFn.runFileFn(require_packages_utils_path.resolve(file))
28
30
  };
29
31
  } });
30
32
  });
@@ -4,6 +4,7 @@ const require_packages_utils_path = require("../../utils/path.js");
4
4
  const require_packages_utils_loadFile = require("../../utils/loadFile.js");
5
5
  const require_packages_utils_runFileFn = require("../../utils/runFileFn.js");
6
6
  require("../../utils/index.js");
7
+ let fs = require("fs");
7
8
  let koa_router = require("koa-router");
8
9
  koa_router = require_runtime.__toESM(koa_router, 1);
9
10
  //#region packages/core/loader/router.ts
@@ -13,25 +14,33 @@ koa_router = require_runtime.__toESM(koa_router, 1);
13
14
  * 解析 xx/app/router/下的所有文件 加载到 koa-router上
14
15
  */
15
16
  var router_default = (app) => {
16
- const router = new koa_router.default();
17
17
  let routerGuard;
18
- try {
19
- const businessPath = require_packages_core_paths.getAppPath(app, "business");
20
- if (businessPath) routerGuard = require_packages_utils_runFileFn.runFileFn(require(require_packages_utils_path.resolve(businessPath, "router-guard.js")))(app);
21
- } catch (error) {
22
- console.info("-- [router-guard] -- not router-guard.js file");
18
+ const businessPath = require_packages_core_paths.getAppPath(app, "business");
19
+ if (businessPath) for (const fileName of ["router-guard.ts", "router-guard.js"]) {
20
+ const filePath = require_packages_utils_path.resolve(businessPath, fileName);
21
+ if ((0, fs.existsSync)(filePath)) {
22
+ routerGuard = require_packages_utils_runFileFn.runFileFn(filePath)(app);
23
+ break;
24
+ }
23
25
  }
26
+ if (!routerGuard) console.info("-- [router-guard] -- not router-guard.(ts|js) file");
27
+ const routers = [];
24
28
  require_packages_core_paths.getAppPaths(app).forEach((currentPath) => {
25
29
  require_packages_utils_loadFile.loadFileFn(currentPath, "router", { preProcessingFileCallback: (filePath) => {
30
+ const router = new koa_router.default();
31
+ router.level = 0;
32
+ routers.push(router);
26
33
  /**
27
34
  * module.export = (app,router) => {
28
35
  * router.get('/xxx/xxxx', app.controller)
29
36
  * }
30
37
  */
31
- require_packages_utils_runFileFn.runFileFn(require(require_packages_utils_path.resolve(filePath)))(app, router);
38
+ require_packages_utils_runFileFn.runFileFn(require_packages_utils_path.resolve(filePath))(app, router);
32
39
  } });
33
40
  });
34
- router.get("(.*)", async (ctx, _next) => {
41
+ const BaseRouters = new koa_router.default();
42
+ BaseRouters.level = 99;
43
+ BaseRouters.get("(.*)", async (ctx, _next) => {
35
44
  console.info("\x1B[31m%s\x1B[0m", `-- notFound path: ${ctx.path} --`);
36
45
  ctx.status = 302;
37
46
  const executionResults = routerGuard?.(ctx);
@@ -41,9 +50,13 @@ var router_default = (app) => {
41
50
  ctx.body = "notFound";
42
51
  }
43
52
  });
44
- app.use(router.routes());
45
- app.use(router.allowedMethods());
46
- app.currentUseRouter = router;
53
+ routers.push(BaseRouters);
54
+ routers.sort((r, nr) => (r.level ?? 0) < (nr.level ?? 0) ? -1 : 1);
55
+ routers.forEach((r) => {
56
+ app.use(r.routes());
57
+ app.use(r.allowedMethods());
58
+ });
59
+ app.currentUseRouter = routers;
47
60
  };
48
61
  //#endregion
49
62
  module.exports = router_default;
@@ -12,7 +12,7 @@ app/service
12
12
 
13
13
  |-- cuStom-moduLe
14
14
 
15
- |-- custom-midd Leware.js
15
+ |-- custom-midd Leware.(js|ts)
16
16
 
17
17
  => app.service.customModule. customMiddleware
18
18
  *
@@ -22,7 +22,7 @@ var service_default = (app) => {
22
22
  app.service = require_packages_core_paths.getAppPaths(app).reduce((preData, currentPath) => ({
23
23
  ...preData,
24
24
  ...require_packages_utils_loadFile.loadFileFn(currentPath, "service", { loadFileCallback: (file) => {
25
- return new (require_packages_utils_runFileFn.runFileFn(require(file))(app))();
25
+ return new (require_packages_utils_runFileFn.runFileFn(file)(app))();
26
26
  } })
27
27
  }), {});
28
28
  };
@@ -1,6 +1,51 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../../_virtual/_rolldown/runtime.js");
3
+ let path = require("path");
4
+ let fs = require("fs");
3
5
  //#region packages/utils/runFileFn.ts
4
- var runFileFn = (fn) => typeof fn === "function" ? fn : fn.default;
6
+ var registeredTypeScriptLoader = false;
7
+ function runFileFn(fileOrModule) {
8
+ return getDefaultExport(typeof fileOrModule === "string" ? requireFile(fileOrModule) : fileOrModule);
9
+ }
10
+ function getDefaultExport(fileModule) {
11
+ if (fileModule && typeof fileModule === "object" && "default" in fileModule && fileModule.default !== void 0) return fileModule.default;
12
+ return fileModule;
13
+ }
14
+ function requireFile(file) {
15
+ try {
16
+ return require(file);
17
+ } catch (error) {
18
+ if ((0, path.extname)(file) !== ".ts" || !shouldRetryWithTypeScript(error)) throw error;
19
+ registerTypeScriptLoader();
20
+ delete require.cache[require.resolve(file)];
21
+ return require(file);
22
+ }
23
+ }
24
+ function shouldRetryWithTypeScript(error) {
25
+ const err = error;
26
+ const message = err?.message ?? "";
27
+ return err?.code === "ERR_UNKNOWN_FILE_EXTENSION" || err?.code === "ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX" || err?.name === "SyntaxError" || message.indexOf("Cannot use import statement outside a module") !== -1 || message.indexOf("Unexpected token 'export'") !== -1;
28
+ }
29
+ function registerTypeScriptLoader() {
30
+ if (registeredTypeScriptLoader) return;
31
+ const typescript = loadTypeScriptCompiler();
32
+ require.extensions[".ts"] = (module, filename) => {
33
+ const { outputText } = typescript.transpileModule((0, fs.readFileSync)(filename, "utf8"), { compilerOptions: {
34
+ module: typescript.ModuleKind.CommonJS,
35
+ target: typescript.ScriptTarget.ES2020,
36
+ esModuleInterop: true,
37
+ allowSyntheticDefaultImports: true
38
+ } });
39
+ module._compile(outputText, filename);
40
+ };
41
+ registeredTypeScriptLoader = true;
42
+ }
43
+ function loadTypeScriptCompiler() {
44
+ try {
45
+ return require("typescript");
46
+ } catch (error) {
47
+ throw new Error(`Unable to load TypeScript file. Please install "typescript" or run with a TypeScript runtime. ${String(error)}`);
48
+ }
49
+ }
5
50
  //#endregion
6
51
  exports.runFileFn = runFileFn;
@@ -1,5 +1,5 @@
1
1
  //#region app/controller/base.ts
2
- var base_default = (app) => class BaseController {
2
+ var getBaseController = (app) => class BaseController {
3
3
  app;
4
4
  config;
5
5
  constructor() {
@@ -20,9 +20,9 @@ var base_default = (app) => class BaseController {
20
20
  ctx.body = {
21
21
  data,
22
22
  code,
23
- message
23
+ message: message ?? "ok"
24
24
  };
25
25
  }
26
26
  };
27
27
  //#endregion
28
- export { base_default as default };
28
+ export { getBaseController as default };
@@ -1,7 +1,7 @@
1
- import base_default from "./base.js";
1
+ import getBaseController from "./base.js";
2
2
  //#region app/controller/project.ts
3
3
  var getProjectController = (app) => {
4
- const BaseController = base_default(app);
4
+ const BaseController = getBaseController(app);
5
5
  return class ProjectController extends BaseController {
6
6
  getModelList = async (ctx) => {
7
7
  const dtoModelList = (await this.service.project.getModelList()).reduce((preList, item) => {
@@ -31,7 +31,7 @@ var getProjectController = (app) => {
31
31
  this.success(ctx, dtoModelList);
32
32
  };
33
33
  getProjectList = async (ctx) => {
34
- const { proj_key: projectKey } = ctx.query;
34
+ const { projk: projectKey } = ctx.query;
35
35
  const dtoProject = (await this.service.project.getList(projectKey))?.map((project) => {
36
36
  const { modelKey, key, name, desc, homePage } = project;
37
37
  return {
@@ -1,13 +1,22 @@
1
1
  //#region app/controller/view.ts
2
2
  var getViewController = (app) => class ViewController {
3
3
  async renderPage(ctx) {
4
- app.extends.renderView(`dist/${ctx.params.page}.entry.tpl`, ctx, {
5
- projKey: ctx.query.proj_key,
6
- name: app.options?.name,
7
- env: app.envs.get(),
8
- basePath: `/view/${ctx.params.page}`,
9
- options: JSON.stringify(app.options)
10
- });
4
+ app.extends.logger.log(" - render page: " + ctx.params.page);
5
+ try {
6
+ app.extends.renderView(`dist/${ctx.params.page}.entry.tpl`, ctx, {
7
+ projKey: ctx.query.projk,
8
+ name: app.options?.name,
9
+ env: app.envs.get(),
10
+ basePath: `${app.options.pageBasePage}${ctx.params.page}`,
11
+ options: JSON.stringify(app.options)
12
+ });
13
+ } catch (error) {
14
+ app.extends.generateErrorMessage("template not found", {
15
+ status: 404,
16
+ showError: true,
17
+ code: 0
18
+ });
19
+ }
11
20
  }
12
21
  };
13
22
  //#endregion
@@ -12,7 +12,16 @@ var validateFN = (key, data, schema) => {
12
12
  var api_params_verify_default = (app) => async (ctx, next) => {
13
13
  const { path, method } = ctx;
14
14
  if (path.indexOf("/api") < 0) return next();
15
- const routePath = app.currentUseRouter.match(path, "get").path[0]?.path;
15
+ const currentUseRouter = app.currentUseRouter;
16
+ let route;
17
+ for (const r of currentUseRouter) {
18
+ const data = r.match(path, "get");
19
+ if (data) {
20
+ route = data;
21
+ break;
22
+ }
23
+ }
24
+ const routePath = route?.path[0]?.path;
16
25
  if (routePath) {
17
26
  const params = app.extends.parsingParamsOnUrl(routePath, path);
18
27
  const { body, query, headers } = ctx.request;
@@ -1,4 +1,5 @@
1
1
  //#region app/middleware/error-handle.ts
2
+ var redirectInfo = {};
2
3
  var error_handle_default = (app) => async (ctx, next) => {
3
4
  try {
4
5
  await next();
@@ -8,9 +9,14 @@ var error_handle_default = (app) => async (ctx, next) => {
8
9
  app.extends.logger?.error("-- [excption] --", error);
9
10
  app.extends.logger?.error("-- [excption] info --", status, message, detail);
10
11
  if (message?.includes("template not found")) {
11
- ctx.status = 302;
12
- ctx.redirect(app.options?.homePage ?? "/");
13
- return;
12
+ const url = ctx.req.url;
13
+ if (redirectInfo[url] !== void 0) redirectInfo[url] += 1;
14
+ else redirectInfo[url] = 0;
15
+ if (redirectInfo[url] < app.config.notFoundRedirectCount) {
16
+ ctx.status = 302;
17
+ ctx.redirect(app.options?.homePage ?? "/");
18
+ return;
19
+ } else redirectInfo[url] = 0;
14
20
  }
15
21
  if (returnError) {
16
22
  ctx.status = status;
@@ -1,6 +1,6 @@
1
1
  //#region app/middleware/project-handler.ts
2
2
  var project_handler_default = () => async (ctx, next) => {
3
- const key = ctx.headers.proj_key;
3
+ const key = ctx.headers.projk;
4
4
  const { path } = ctx;
5
5
  if (path.indexOf("/api/proj/") !== -1) {
6
6
  if (!key || ["undefined", "null"].includes(key)) {
@@ -1,6 +1,8 @@
1
1
  //#region app/router/view.ts
2
2
  var view_default = (app, router) => {
3
- router.get(["/view/:page", "/view/:page(.*)"], app.controller.view.renderPage.bind(app.controller.view));
3
+ const { pageBasePage } = app.options;
4
+ router.level = 2;
5
+ router.get([`${pageBasePage}:page`, `${pageBasePage}:page/:r(.*)`], app.controller.view.renderPage.bind(app.controller.view));
4
6
  };
5
7
  //#endregion
6
8
  export { view_default as default };
@@ -7,7 +7,7 @@ var routerSchema = {
7
7
  } } },
8
8
  "/api/project/list": { get: { query: {
9
9
  type: "object",
10
- properties: { proj_key: { type: "string" } }
10
+ properties: { projk: { type: "string" } }
11
11
  } } },
12
12
  "/api/project/model_list": { get: {} }
13
13
  };
@@ -8,6 +8,11 @@ var getProjectService = (app) => {
8
8
  async getModelList() {
9
9
  return modelData;
10
10
  }
11
+ /**
12
+ *
13
+ * @param key 不传查所有
14
+ * @returns
15
+ */
11
16
  getList = (key) => {
12
17
  return modelData.reduce((preList, modeItem) => {
13
18
  const { project } = modeItem;
@@ -0,0 +1,4 @@
1
+ //#region bundler/defaultAlias.ts
2
+ var defaultAlias_default = {};
3
+ //#endregion
4
+ export { defaultAlias_default as default };
@@ -1,13 +1,14 @@
1
+ import { logGreen, logRed } from "../packages/common/log/index.js";
1
2
  import { VBuildFE, entries, watchFiles } from "./utils.js";
2
3
  //#region bundler/dev.ts
3
4
  var init = async () => {
4
5
  const input = entries();
5
- console.log(input);
6
+ logGreen(input);
6
7
  if (!Object.keys(input).length) {
7
- console.error("no entry found");
8
+ logRed("no entry found");
8
9
  process.exit(1);
9
10
  }
10
- await VBuildFE(input);
11
+ await VBuildFE(input, "dev");
11
12
  };
12
13
  async function dev() {
13
14
  await init();
@@ -1,3 +1,4 @@
1
+ import { logRed } from "../packages/common/log/index.js";
1
2
  import { dev } from "./dev.js";
2
3
  import { prod } from "./prod.js";
3
4
  //#region bundler/index.ts
@@ -9,7 +10,7 @@ var buildFE = (mode) => {
9
10
  case "prod":
10
11
  prod();
11
12
  break;
12
- default: console.log("Usage: npx tsx scripts/index.ts [dev|prod]");
13
+ default: logRed("Usage: npx tsx scripts/index.ts [dev|prod]");
13
14
  }
14
15
  };
15
16
  //#endregion
@@ -1,16 +1,17 @@
1
+ import { logGreen, logRed } from "../packages/common/log/index.js";
1
2
  import { VBuildFE, entries } from "./utils.js";
2
3
  //#region bundler/prod.ts
3
4
  async function prod() {
4
5
  const input = entries();
5
6
  if (!Object.keys(input).length) {
6
- console.error("no entry found");
7
+ logRed("no entry found");
7
8
  process.exit(1);
8
9
  }
9
10
  try {
10
11
  await VBuildFE(input);
11
- console.log("build done");
12
+ logGreen("build done");
12
13
  } catch (err) {
13
- console.error(String(err));
14
+ logRed(String(err));
14
15
  process.exit(1);
15
16
  }
16
17
  }
@@ -1,10 +1,11 @@
1
1
  import { resolve as resolve$1 } from "../packages/utils/path.js";
2
2
  import "../packages/utils/index.js";
3
+ import { colorize, logJoinColorized, logRed, logWhite, logYellow } from "../packages/common/log/index.js";
3
4
  import path from "path";
4
5
  import * as glob from "glob";
5
- import { build } from "vite";
6
6
  import { copyFileSync, existsSync, readFileSync, readdirSync, rmdirSync, unlinkSync, writeFileSync } from "fs";
7
7
  import tailwindcss from "@tailwindcss/vite";
8
+ import { build } from "vite";
8
9
  //#region bundler/utils.ts
9
10
  var base = process.cwd();
10
11
  var framePath = path.resolve(__dirname, "../../");
@@ -18,8 +19,8 @@ var runFEPath = path.resolve(runPath, "./frontend");
18
19
  * 生成入口
19
20
  */
20
21
  function entries() {
21
- console.log("frameFEPath: ", frameFEPath);
22
- console.log("runFEPath: ", runFEPath);
22
+ logWhite("frameFEPath: " + frameFEPath);
23
+ logWhite("runFEPath: " + runFEPath);
23
24
  /**
24
25
  * 所有包含 entry 的文件
25
26
  */
@@ -72,12 +73,11 @@ var watchFiles = async (callback) => {
72
73
  watcher.on("change", async (filePath) => {
73
74
  if (building) return;
74
75
  building = true;
75
- console.log(`changed: ${filePath}`);
76
+ logYellow(`changed: ${filePath}`);
76
77
  await callback?.();
77
- console.log("rebuild done");
78
78
  building = false;
79
79
  });
80
- console.log(`watching ${runFEPath}/...`);
80
+ logYellow(`watching ${runFEPath}/...`);
81
81
  };
82
82
  /**
83
83
  *
@@ -122,26 +122,55 @@ function flattenHtmlPlugin(suffix = ".html") {
122
122
  * ------------------
123
123
  */
124
124
  const endFiles = glob.sync("**/*" + suffix, { cwd: feDir });
125
- for (const f of endFiles) console.log("final file path -----> ", f);
125
+ for (const f of endFiles) logYellow("final file path -----> " + f);
126
126
  }
127
127
  };
128
128
  }
129
- var VBuildFE = async (input) => {
130
- await build({
131
- configFile: false,
132
- base: "dist",
133
- plugins: [
134
- (await import("@vitejs/plugin-react")).default(),
135
- flattenHtmlPlugin(".tpl"),
136
- tailwindcss()
137
- ],
138
- build: {
139
- outDir: outDir(),
140
- emptyOutDir: true,
141
- rollupOptions: { input }
142
- },
143
- resolve: { alias: { "@tc/ui-react": path.resolve(__dirname, "../../fe/packages/ui/react/") } }
144
- });
129
+ /**
130
+ * 处理别名目录兜底
131
+ * 如果 alias 指向的路径不存在,则使用 ./defaultAlias 兜底文件
132
+ */
133
+ function resolveAliasWithFallback(aliasList) {
134
+ const aliasExtensions = [
135
+ "",
136
+ ".ts",
137
+ ".tsx",
138
+ ".js",
139
+ ".jsx"
140
+ ];
141
+ return aliasList.reduce((o, [aliasName, aliasPath]) => {
142
+ const businessFilePath = aliasExtensions.map((ext) => path.resolve(runFEPath, aliasPath + ext)).find((filePath) => existsSync(filePath));
143
+ let filePath = path.resolve(__dirname, "./defaultAlias");
144
+ if (businessFilePath) filePath = businessFilePath;
145
+ o[aliasName] = filePath;
146
+ return o;
147
+ }, {});
148
+ }
149
+ var VBuildFE = async (input, OperatingEnv) => {
150
+ try {
151
+ await build({
152
+ configFile: false,
153
+ base: "/dist",
154
+ plugins: [
155
+ (await import("@vitejs/plugin-react")).default(),
156
+ flattenHtmlPlugin(".tpl"),
157
+ tailwindcss()
158
+ ],
159
+ build: {
160
+ outDir: outDir(),
161
+ emptyOutDir: true,
162
+ sourcemap: OperatingEnv === "dev" ? "inline" : "hidden",
163
+ rollupOptions: { input }
164
+ },
165
+ resolve: { alias: {
166
+ "@tc/ui-react": path.resolve(__dirname, "../../fe/packages/ui/react/"),
167
+ ...resolveAliasWithFallback([["$business/SchemaForm/data", "./extended/SchemaForm/data"]])
168
+ } }
169
+ });
170
+ logJoinColorized(colorize("builded", "green"), colorize(" -> ", "white"), colorize("time: ", "cyan"), colorize(/* @__PURE__ */ new Date(), "pink"));
171
+ } catch (error) {
172
+ logRed(error);
173
+ }
145
174
  };
146
175
  //#endregion
147
176
  export { VBuildFE, entries, outDir, watchFiles };
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import base_default from "./app/controller/base.js";
1
+ import getBaseController from "./app/controller/base.js";
2
2
  import bese_default from "./app/service/bese.js";
3
3
  import { resolve } from "./packages/utils/path.js";
4
4
  import "./packages/utils/index.js";
@@ -12,7 +12,7 @@ var serverStart = (options) => {
12
12
  });
13
13
  };
14
14
  var baseFn = {
15
- baseControllerFn: base_default,
15
+ baseControllerFn: getBaseController,
16
16
  baseServiceFn: bese_default
17
17
  };
18
18
  //#endregion
@@ -0,0 +1,2 @@
1
+ import { LRUCache } from "./cache/LRUCache.js";
2
+ export { LRUCache };
@@ -0,0 +1,37 @@
1
+ import { isNonNullable } from "../guards/index.js";
2
+ //#region packages/common/array/index.ts
3
+ function toArray(value) {
4
+ if (value === null || value === void 0) return [];
5
+ return Array.isArray(value) ? [...value] : [value];
6
+ }
7
+ var compact = (items) => {
8
+ return items.filter(isNonNullable);
9
+ };
10
+ var uniqueBy = (items, getKey) => {
11
+ const keys = /* @__PURE__ */ new Set();
12
+ const result = [];
13
+ for (const item of items) {
14
+ const key = getKey(item);
15
+ if (keys.has(key)) continue;
16
+ keys.add(key);
17
+ result.push(item);
18
+ }
19
+ return result;
20
+ };
21
+ var groupBy = (items, getKey) => {
22
+ const result = {};
23
+ for (const item of items) {
24
+ const key = getKey(item);
25
+ result[key] = result[key] ?? [];
26
+ result[key].push(item);
27
+ }
28
+ return result;
29
+ };
30
+ var chunk = (items, size) => {
31
+ if (!Number.isInteger(size) || size <= 0) throw new RangeError("chunk size must be a positive integer");
32
+ const result = [];
33
+ for (let index = 0; index < items.length; index += size) result.push(items.slice(index, index + size));
34
+ return result;
35
+ };
36
+ //#endregion
37
+ export { chunk, compact, groupBy, toArray, uniqueBy };