@_tc/template-core 0.0.1 → 0.0.2

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 (748) hide show
  1. package/README.md +1108 -0
  2. package/cjs/_virtual/_rolldown/runtime.js +1 -0
  3. package/cjs/app/controller/base.js +1 -0
  4. package/cjs/app/controller/project.js +1 -0
  5. package/cjs/app/controller/view.js +1 -0
  6. package/cjs/app/data/signKey.js +1 -0
  7. package/cjs/app/extend/$fetch.js +1 -0
  8. package/cjs/app/extend/db.js +1 -0
  9. package/cjs/app/extend/generateErrorMessage.js +1 -0
  10. package/cjs/app/extend/logger.js +1 -0
  11. package/cjs/app/extend/parsingParamsOnUrl.js +1 -0
  12. package/cjs/app/extend/render-view.js +1 -0
  13. package/cjs/app/middleware/api-params-verify.js +1 -0
  14. package/cjs/app/middleware/api-sign-verify.js +1 -0
  15. package/cjs/app/middleware/error-handle.js +1 -0
  16. package/cjs/app/middleware/project-handler.js +1 -0
  17. package/cjs/app/middleware.js +1 -0
  18. package/cjs/app/router/project.js +1 -0
  19. package/cjs/app/router/view.js +1 -0
  20. package/cjs/app/router-schema/project.js +1 -0
  21. package/cjs/app/service/base.js +1 -0
  22. package/cjs/app/service/project.js +1 -0
  23. package/cjs/app/type.js +1 -0
  24. package/cjs/app/typings.js +1 -0
  25. package/cjs/app/view/entry.tpl +30 -0
  26. package/cjs/bundler/defaultAlias.js +1 -0
  27. package/cjs/bundler/dev.js +1 -0
  28. package/cjs/bundler/index.js +1 -0
  29. package/cjs/bundler/prod.js +1 -0
  30. package/cjs/bundler/state.js +1 -0
  31. package/cjs/bundler/utils.js +1 -0
  32. package/cjs/index.js +1 -0
  33. package/cjs/packages/common/LRUCache.js +1 -0
  34. package/cjs/packages/common/array/index.js +1 -0
  35. package/cjs/packages/common/cache/LRUCache.js +1 -0
  36. package/cjs/packages/common/cache/index.js +1 -0
  37. package/cjs/packages/common/guards/index.js +1 -0
  38. package/cjs/packages/common/http/index.js +1 -0
  39. package/cjs/packages/common/i18n/default.js +1 -0
  40. package/cjs/packages/common/i18n/en-US.js +1 -0
  41. package/cjs/packages/common/i18n/index.js +1 -0
  42. package/cjs/packages/common/i18n/locales.js +1 -0
  43. package/cjs/packages/common/i18n/types.js +1 -0
  44. package/cjs/packages/common/index.js +1 -0
  45. package/cjs/packages/common/log/index.js +2 -0
  46. package/cjs/packages/common/number/index.js +1 -0
  47. package/cjs/packages/common/object/filterEmpty.js +1 -0
  48. package/cjs/packages/common/object/filtereEmpty.js +1 -0
  49. package/cjs/packages/common/object/index.js +1 -0
  50. package/cjs/packages/common/string/index.js +1 -0
  51. package/cjs/packages/common/types/index.js +1 -0
  52. package/cjs/packages/core/env.js +1 -0
  53. package/cjs/packages/core/index.js +1 -0
  54. package/cjs/packages/core/loader/config.js +1 -0
  55. package/cjs/packages/core/loader/controller.js +1 -0
  56. package/cjs/packages/core/loader/extend.js +1 -0
  57. package/cjs/packages/core/loader/middleware.js +1 -0
  58. package/cjs/packages/core/loader/model.js +1 -0
  59. package/cjs/packages/core/loader/router-schema.js +1 -0
  60. package/cjs/packages/core/loader/router.js +1 -0
  61. package/cjs/packages/core/loader/service.js +1 -0
  62. package/cjs/packages/core/paths.js +1 -0
  63. package/cjs/packages/core/types.js +1 -0
  64. package/cjs/packages/utils/getAllFilesInFolder.js +1 -0
  65. package/cjs/packages/utils/getAllFnReturnValue.js +1 -0
  66. package/cjs/packages/utils/index.js +1 -0
  67. package/cjs/packages/utils/loadFile.js +1 -0
  68. package/cjs/packages/utils/path.js +1 -0
  69. package/cjs/packages/utils/runFileFn.js +1 -0
  70. package/esm/_virtual/_rolldown/runtime.js +20 -0
  71. package/esm/app/controller/base.js +26 -0
  72. package/esm/app/controller/project.js +52 -0
  73. package/esm/app/controller/view.js +23 -0
  74. package/esm/app/data/signKey.js +8 -0
  75. package/esm/app/extend/$fetch.js +15 -0
  76. package/esm/app/extend/db.js +6 -0
  77. package/esm/app/extend/generateErrorMessage.js +7 -0
  78. package/esm/app/extend/logger.js +26 -0
  79. package/esm/app/extend/parsingParamsOnUrl.js +14 -0
  80. package/esm/app/extend/render-view.js +19 -0
  81. package/esm/app/middleware/api-params-verify.js +56 -0
  82. package/esm/app/middleware/api-sign-verify.js +18 -0
  83. package/esm/app/middleware/error-handle.js +24 -0
  84. package/esm/app/middleware/project-handler.js +15 -0
  85. package/esm/app/middleware.js +18 -0
  86. package/esm/app/router/project.js +7 -0
  87. package/esm/app/router/view.js +7 -0
  88. package/esm/app/router-schema/project.js +15 -0
  89. package/esm/app/service/base.js +14 -0
  90. package/esm/app/service/project.js +23 -0
  91. package/esm/app/type.js +0 -0
  92. package/esm/app/typings.js +0 -0
  93. package/esm/app/view/entry.tpl +30 -0
  94. package/esm/bundler/defaultAlias.js +4 -0
  95. package/esm/bundler/dev.js +12 -0
  96. package/esm/bundler/index.js +18 -0
  97. package/esm/bundler/prod.js +14 -0
  98. package/esm/bundler/state.js +10 -0
  99. package/esm/bundler/utils.js +194 -0
  100. package/esm/index.js +16 -0
  101. package/esm/packages/common/LRUCache.js +2 -0
  102. package/esm/packages/common/array/index.js +27 -0
  103. package/esm/packages/common/cache/LRUCache.js +39 -0
  104. package/esm/packages/common/cache/index.js +2 -0
  105. package/esm/packages/common/guards/index.js +8 -0
  106. package/esm/packages/common/http/index.js +256 -0
  107. package/esm/packages/common/i18n/default.js +88 -0
  108. package/esm/packages/common/i18n/en-US.js +88 -0
  109. package/esm/packages/common/i18n/index.js +91 -0
  110. package/esm/packages/common/i18n/locales.js +9 -0
  111. package/esm/packages/common/i18n/types.js +0 -0
  112. package/esm/packages/common/index.js +14 -0
  113. package/esm/packages/common/log/index.js +93 -0
  114. package/esm/packages/common/number/index.js +10 -0
  115. package/esm/packages/common/object/filterEmpty.js +23 -0
  116. package/esm/packages/common/object/filtereEmpty.js +2 -0
  117. package/esm/packages/common/object/index.js +17 -0
  118. package/esm/packages/common/string/index.js +4 -0
  119. package/esm/packages/common/types/index.js +0 -0
  120. package/esm/packages/core/env.js +24 -0
  121. package/esm/packages/core/index.js +52 -0
  122. package/esm/packages/core/loader/config.js +27 -0
  123. package/esm/packages/core/loader/controller.js +13 -0
  124. package/esm/packages/core/loader/extend.js +23 -0
  125. package/esm/packages/core/loader/middleware.js +16 -0
  126. package/esm/packages/core/loader/model.js +68 -0
  127. package/esm/packages/core/loader/router-schema.js +19 -0
  128. package/esm/packages/core/loader/router.js +36 -0
  129. package/esm/packages/core/loader/service.js +13 -0
  130. package/esm/packages/core/paths.js +9 -0
  131. package/esm/packages/core/types.js +0 -0
  132. package/esm/packages/utils/getAllFilesInFolder.js +9 -0
  133. package/esm/packages/utils/getAllFnReturnValue.js +0 -0
  134. package/esm/packages/utils/index.js +5 -0
  135. package/esm/packages/utils/loadFile.js +34 -0
  136. package/esm/packages/utils/path.js +16 -0
  137. package/esm/packages/utils/runFileFn.js +45 -0
  138. package/fe/frontend/apps/dash/Dashboard.d.ts +6 -0
  139. package/fe/frontend/apps/dash/Dashboard.js +75 -0
  140. package/fe/frontend/apps/dash/dash.entry.d.ts +2 -0
  141. package/fe/frontend/apps/dash/dash.entry.js +80 -0
  142. package/fe/frontend/apps/dash/types.d.ts +17 -0
  143. package/fe/frontend/apps/dash/types.js +1 -0
  144. package/fe/frontend/apps/testPage/index.d.ts +3 -0
  145. package/fe/frontend/apps/testPage/index.js +6 -0
  146. package/fe/frontend/apps/testPage/testPage.entry.d.ts +2 -0
  147. package/fe/frontend/apps/testPage/testPage.entry.js +6 -0
  148. package/fe/frontend/extended/SchemaForm/data.d.ts +13 -0
  149. package/fe/frontend/extended/SchemaForm/data.js +8 -0
  150. package/fe/frontend/src/api/baseInfo.d.ts +31 -0
  151. package/fe/frontend/src/api/baseInfo.js +15 -0
  152. package/fe/frontend/src/common/CRUD/CRUD.d.ts +3 -0
  153. package/fe/frontend/src/common/CRUD/CRUD.js +2 -0
  154. package/fe/frontend/src/common/CRUD/index.d.ts +2 -0
  155. package/fe/frontend/src/common/CRUD/index.js +1 -0
  156. package/fe/frontend/src/common/auth/index.d.ts +7 -0
  157. package/fe/frontend/src/common/auth/index.js +20 -0
  158. package/fe/frontend/src/common/fetchErrorShow.d.ts +3 -0
  159. package/fe/frontend/src/common/fetchErrorShow.js +8 -0
  160. package/fe/frontend/src/common/generateMenuData.d.ts +4 -0
  161. package/fe/frontend/src/common/generateMenuData.js +12 -0
  162. package/fe/frontend/src/common/importComponent.d.ts +5 -0
  163. package/fe/frontend/src/common/importComponent.js +8 -0
  164. package/fe/frontend/src/common/language.d.ts +2 -0
  165. package/fe/frontend/src/common/language.js +9 -0
  166. package/fe/frontend/src/common/logFn/index.d.ts +5 -0
  167. package/fe/frontend/src/common/logFn/index.js +9 -0
  168. package/fe/frontend/src/common/menu.d.ts +34 -0
  169. package/fe/frontend/src/common/menu.js +101 -0
  170. package/fe/frontend/src/common/request.d.ts +37 -0
  171. package/fe/frontend/src/common/request.js +217 -0
  172. package/fe/frontend/src/components/AsyncSelect/AsyncSelect.d.ts +8 -0
  173. package/fe/frontend/src/components/AsyncSelect/AsyncSelect.js +32 -0
  174. package/fe/frontend/src/components/AsyncSelect/index.d.ts +4 -0
  175. package/fe/frontend/src/components/AsyncSelect/index.js +3 -0
  176. package/fe/frontend/src/components/BasePage/HeaderView.d.ts +9 -0
  177. package/fe/frontend/src/components/BasePage/HeaderView.js +14 -0
  178. package/fe/frontend/src/components/Router/index.d.ts +9 -0
  179. package/fe/frontend/src/components/Router/index.js +11 -0
  180. package/fe/frontend/src/components/Router/type.d.ts +2 -0
  181. package/fe/frontend/src/components/Router/type.js +1 -0
  182. package/fe/frontend/src/defaultPages/Iframe/index.d.ts +3 -0
  183. package/fe/frontend/src/defaultPages/Iframe/index.js +14 -0
  184. package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/DetailPanel.d.ts +7 -0
  185. package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/DetailPanel.js +94 -0
  186. package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/PopFrom.d.ts +13 -0
  187. package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/PopFrom.js +124 -0
  188. package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/builtIn.d.ts +44 -0
  189. package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/builtIn.js +7 -0
  190. package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/data.d.ts +4 -0
  191. package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/data.js +6 -0
  192. package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaSearch/index.d.ts +3 -0
  193. package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaSearch/index.js +63 -0
  194. package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/index.d.ts +11 -0
  195. package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/index.js +188 -0
  196. package/fe/frontend/src/defaultPages/SchemaPage/data/eventInfo.d.ts +8 -0
  197. package/fe/frontend/src/defaultPages/SchemaPage/data/eventInfo.js +6 -0
  198. package/fe/frontend/src/defaultPages/SchemaPage/data/index.d.ts +3 -0
  199. package/fe/frontend/src/defaultPages/SchemaPage/data/index.js +1 -0
  200. package/fe/frontend/src/defaultPages/SchemaPage/hooks/useComConfig.d.ts +10 -0
  201. package/fe/frontend/src/defaultPages/SchemaPage/hooks/useComConfig.js +14 -0
  202. package/fe/frontend/src/defaultPages/SchemaPage/index.css +167 -0
  203. package/fe/frontend/src/defaultPages/SchemaPage/index.d.ts +4 -0
  204. package/fe/frontend/src/defaultPages/SchemaPage/index.js +75 -0
  205. package/fe/frontend/src/defaultPages/SchemaPage/schemaType.d.ts +51 -0
  206. package/fe/frontend/src/defaultPages/SchemaPage/schemaType.js +4 -0
  207. package/fe/frontend/src/defaultPages/SchemaPage/utils/permissions.d.ts +3 -0
  208. package/fe/frontend/src/defaultPages/SchemaPage/utils/permissions.js +3 -0
  209. package/fe/frontend/src/defaultPages/SchemaPage/utils/schemaConversion.d.ts +3 -0
  210. package/fe/frontend/src/defaultPages/SchemaPage/utils/schemaConversion.js +115 -0
  211. package/fe/frontend/src/defaultPages/SchemaPage/utils/validator.d.ts +7 -0
  212. package/fe/frontend/src/defaultPages/SchemaPage/utils/validator.js +36 -0
  213. package/fe/frontend/src/defaultPages/SidebarSlotPage/SidebarSlotContainer.d.ts +10 -0
  214. package/fe/frontend/src/defaultPages/SidebarSlotPage/SidebarSlotContainer.js +38 -0
  215. package/fe/frontend/src/defaultPages/SidebarSlotPage/index.d.ts +3 -0
  216. package/fe/frontend/src/defaultPages/SidebarSlotPage/index.js +16 -0
  217. package/fe/frontend/src/defaultPages/SidebarSlotPageTmp.d.ts +3 -0
  218. package/fe/frontend/src/defaultPages/SidebarSlotPageTmp.js +17 -0
  219. package/fe/frontend/src/defaultPages/SlotPage/index.d.ts +3 -0
  220. package/fe/frontend/src/defaultPages/SlotPage/index.js +26 -0
  221. package/fe/frontend/src/exportStore.d.ts +17 -0
  222. package/fe/frontend/src/exportStore.js +16 -0
  223. package/fe/frontend/src/hooks/useCurrentMenuData.d.ts +19 -0
  224. package/fe/frontend/src/hooks/useCurrentMenuData.js +28 -0
  225. package/fe/frontend/src/hooks/useRouterParams.d.ts +5 -0
  226. package/fe/frontend/src/hooks/useRouterParams.js +11 -0
  227. package/fe/frontend/src/index.d.ts +16 -0
  228. package/fe/frontend/src/index.js +13 -0
  229. package/fe/frontend/src/main.css +96 -0
  230. package/fe/frontend/src/main.d.ts +27 -0
  231. package/fe/frontend/src/main.js +72 -0
  232. package/fe/frontend/src/stores/apiFreezer.d.ts +93 -0
  233. package/fe/frontend/src/stores/apiFreezer.js +49 -0
  234. package/fe/frontend/src/stores/mode.d.ts +19 -0
  235. package/fe/frontend/src/stores/mode.js +37 -0
  236. package/fe/frontend/src/stores/schemaEventBus.d.ts +42 -0
  237. package/fe/frontend/src/stores/schemaEventBus.js +70 -0
  238. package/fe/frontend/src/stores/schemaStore.d.ts +47 -0
  239. package/fe/frontend/src/stores/schemaStore.js +26 -0
  240. package/fe/frontend/src/typing/scalability.d.ts +47 -0
  241. package/fe/frontend/src/typing/scalability.js +1 -0
  242. package/fe/frontend/src/typing/window.d.ts +7 -0
  243. package/fe/frontend/src/typing/window.js +1 -0
  244. package/fe/model/types/data/button.d.ts +32 -0
  245. package/fe/model/types/data/button.js +16 -0
  246. package/fe/model/types/data/component.d.ts +40 -0
  247. package/fe/model/types/data/component.js +11 -0
  248. package/fe/model/types/data/fetchInfo.d.ts +20 -0
  249. package/fe/model/types/data/fetchInfo.js +1 -0
  250. package/fe/model/types/data/schema.d.ts +98 -0
  251. package/fe/model/types/data/schema.js +1 -0
  252. package/fe/model/types/data/search.d.ts +7 -0
  253. package/fe/model/types/data/search.js +1 -0
  254. package/fe/model/types/menuType.d.ts +73 -0
  255. package/fe/model/types/menuType.js +1 -0
  256. package/fe/model/types/model.d.ts +33 -0
  257. package/fe/model/types/model.js +1 -0
  258. package/fe/packages/common/array/index.d.ts +7 -0
  259. package/fe/packages/common/array/index.js +40 -0
  260. package/fe/packages/common/cache/LRUCache.d.ts +13 -0
  261. package/fe/packages/common/cache/LRUCache.js +47 -0
  262. package/fe/packages/common/cache/index.d.ts +2 -0
  263. package/fe/packages/common/cache/index.js +1 -0
  264. package/fe/packages/common/guards/index.d.ts +9 -0
  265. package/fe/packages/common/guards/index.js +24 -0
  266. package/fe/packages/common/http/index.d.ts +90 -0
  267. package/fe/packages/common/http/index.js +310 -0
  268. package/fe/packages/common/i18n/default.d.ts +92 -0
  269. package/fe/packages/common/i18n/default.js +90 -0
  270. package/fe/packages/common/i18n/en-US.d.ts +92 -0
  271. package/fe/packages/common/i18n/en-US.js +90 -0
  272. package/fe/packages/common/i18n/index.d.ts +43 -0
  273. package/fe/packages/common/i18n/index.js +173 -0
  274. package/fe/packages/common/i18n/locales.d.ts +8 -0
  275. package/fe/packages/common/i18n/locales.js +10 -0
  276. package/fe/packages/common/i18n/types.d.ts +71 -0
  277. package/fe/packages/common/i18n/types.js +1 -0
  278. package/fe/packages/common/index.d.ts +11 -0
  279. package/fe/packages/common/index.js +10 -0
  280. package/fe/packages/common/log/index.d.ts +33 -0
  281. package/fe/packages/common/log/index.js +176 -0
  282. package/fe/packages/common/number/index.d.ts +3 -0
  283. package/fe/packages/common/number/index.js +10 -0
  284. package/fe/packages/common/object/filterEmpty.d.ts +3 -0
  285. package/fe/packages/common/object/filterEmpty.js +33 -0
  286. package/fe/packages/common/object/index.d.ts +5 -0
  287. package/fe/packages/common/object/index.js +25 -0
  288. package/fe/packages/common/string/index.d.ts +4 -0
  289. package/fe/packages/common/string/index.js +17 -0
  290. package/fe/packages/common/types/index.d.ts +4 -0
  291. package/fe/packages/common/types/index.js +1 -0
  292. package/fe/packages/ui/react/assets/table/no-result.svg +5 -0
  293. package/fe/packages/ui/react/components/Button/Button.d.ts +58 -0
  294. package/fe/packages/ui/react/components/Button/Button.js +72 -0
  295. package/fe/packages/ui/react/components/Button/SumbitButton.d.ts +13 -0
  296. package/fe/packages/ui/react/components/Button/SumbitButton.js +25 -0
  297. package/fe/packages/ui/react/components/Button/index.d.ts +4 -0
  298. package/fe/packages/ui/react/components/Button/index.js +2 -0
  299. package/fe/packages/ui/react/components/Checkbox/Checkbox.d.ts +17 -0
  300. package/fe/packages/ui/react/components/Checkbox/Checkbox.js +39 -0
  301. package/fe/packages/ui/react/components/Checkbox/index.d.ts +2 -0
  302. package/fe/packages/ui/react/components/Checkbox/index.js +1 -0
  303. package/fe/packages/ui/react/components/ConfirmDialog/ConfirmDialog.d.ts +20 -0
  304. package/fe/packages/ui/react/components/ConfirmDialog/ConfirmDialog.js +11 -0
  305. package/fe/packages/ui/react/components/ConfirmDialog/index.d.ts +2 -0
  306. package/fe/packages/ui/react/components/ConfirmDialog/index.js +1 -0
  307. package/fe/packages/ui/react/components/DataTable/ActionBtn.d.ts +8 -0
  308. package/fe/packages/ui/react/components/DataTable/ActionBtn.js +96 -0
  309. package/fe/packages/ui/react/components/DataTable/index.d.ts +52 -0
  310. package/fe/packages/ui/react/components/DataTable/index.js +187 -0
  311. package/fe/packages/ui/react/components/Date/Calendar.d.ts +35 -0
  312. package/fe/packages/ui/react/components/Date/Calendar.js +216 -0
  313. package/fe/packages/ui/react/components/Date/Date.d.ts +38 -0
  314. package/fe/packages/ui/react/components/Date/Date.js +201 -0
  315. package/fe/packages/ui/react/components/Date/DateTestPage.d.ts +2 -0
  316. package/fe/packages/ui/react/components/Date/DateTestPage.js +29 -0
  317. package/fe/packages/ui/react/components/Date/LocaleContext.d.ts +6 -0
  318. package/fe/packages/ui/react/components/Date/LocaleContext.js +8 -0
  319. package/fe/packages/ui/react/components/Date/LocaleProvider.d.ts +19 -0
  320. package/fe/packages/ui/react/components/Date/LocaleProvider.js +24 -0
  321. package/fe/packages/ui/react/components/Date/TimePicker.d.ts +7 -0
  322. package/fe/packages/ui/react/components/Date/TimePicker.js +78 -0
  323. package/fe/packages/ui/react/components/Date/data.d.ts +6 -0
  324. package/fe/packages/ui/react/components/Date/data.js +4 -0
  325. package/fe/packages/ui/react/components/Date/dateLocaleStore.d.ts +16 -0
  326. package/fe/packages/ui/react/components/Date/dateLocaleStore.js +14 -0
  327. package/fe/packages/ui/react/components/Date/dropdownPositioning.d.ts +3 -0
  328. package/fe/packages/ui/react/components/Date/dropdownPositioning.js +12 -0
  329. package/fe/packages/ui/react/components/Date/index.d.ts +6 -0
  330. package/fe/packages/ui/react/components/Date/index.js +5 -0
  331. package/fe/packages/ui/react/components/Date/locales.d.ts +43 -0
  332. package/fe/packages/ui/react/components/Date/locales.js +21 -0
  333. package/fe/packages/ui/react/components/Drawer/Drawer.d.ts +29 -0
  334. package/fe/packages/ui/react/components/Drawer/Drawer.js +100 -0
  335. package/fe/packages/ui/react/components/Drawer/index.d.ts +3 -0
  336. package/fe/packages/ui/react/components/Drawer/index.js +1 -0
  337. package/fe/packages/ui/react/components/Dropdown/Dropdown.d.ts +26 -0
  338. package/fe/packages/ui/react/components/Dropdown/Dropdown.js +49 -0
  339. package/fe/packages/ui/react/components/Dropdown/index.d.ts +2 -0
  340. package/fe/packages/ui/react/components/Dropdown/index.js +1 -0
  341. package/fe/packages/ui/react/components/Form/Form.d.ts +18 -0
  342. package/fe/packages/ui/react/components/Form/Form.js +8 -0
  343. package/fe/packages/ui/react/components/Form/FormItem.d.ts +41 -0
  344. package/fe/packages/ui/react/components/Form/FormItem.js +43 -0
  345. package/fe/packages/ui/react/components/Form/SchemaForm/data.d.ts +40 -0
  346. package/fe/packages/ui/react/components/Form/SchemaForm/data.js +18 -0
  347. package/fe/packages/ui/react/components/Form/SchemaForm/index.d.ts +153 -0
  348. package/fe/packages/ui/react/components/Form/SchemaForm/index.js +79 -0
  349. package/fe/packages/ui/react/components/Form/index.d.ts +5 -0
  350. package/fe/packages/ui/react/components/Form/index.js +4 -0
  351. package/fe/packages/ui/react/components/Form/useForm.d.ts +3 -0
  352. package/fe/packages/ui/react/components/Form/useForm.js +1 -0
  353. package/fe/packages/ui/react/components/ImagePreview/ImagePreview.d.ts +8 -0
  354. package/fe/packages/ui/react/components/ImagePreview/ImagePreview.js +169 -0
  355. package/fe/packages/ui/react/components/ImagePreview/PreviewImage.d.ts +11 -0
  356. package/fe/packages/ui/react/components/ImagePreview/PreviewImage.js +28 -0
  357. package/fe/packages/ui/react/components/ImagePreview/index.d.ts +3 -0
  358. package/fe/packages/ui/react/components/ImagePreview/index.js +2 -0
  359. package/fe/packages/ui/react/components/Input/Input.d.ts +45 -0
  360. package/fe/packages/ui/react/components/Input/Input.js +61 -0
  361. package/fe/packages/ui/react/components/Input/index.d.ts +2 -0
  362. package/fe/packages/ui/react/components/Input/index.js +1 -0
  363. package/fe/packages/ui/react/components/InputNumber/InputNumber.d.ts +28 -0
  364. package/fe/packages/ui/react/components/InputNumber/InputNumber.js +144 -0
  365. package/fe/packages/ui/react/components/InputNumber/index.d.ts +2 -0
  366. package/fe/packages/ui/react/components/InputNumber/index.js +1 -0
  367. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.d.ts +30 -0
  368. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.js +63 -0
  369. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.d.ts +2 -0
  370. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.js +27 -0
  371. package/fe/packages/ui/react/components/Label/Label.d.ts +51 -0
  372. package/fe/packages/ui/react/components/Label/Label.js +35 -0
  373. package/fe/packages/ui/react/components/Label/index.d.ts +3 -0
  374. package/fe/packages/ui/react/components/Label/index.js +2 -0
  375. package/fe/packages/ui/react/components/Menu/Menu.d.ts +18 -0
  376. package/fe/packages/ui/react/components/Menu/Menu.js +102 -0
  377. package/fe/packages/ui/react/components/Menu/MenuContext.d.ts +39 -0
  378. package/fe/packages/ui/react/components/Menu/MenuContext.js +97 -0
  379. package/fe/packages/ui/react/components/Menu/MenuItem.d.ts +3 -0
  380. package/fe/packages/ui/react/components/Menu/MenuItem.js +33 -0
  381. package/fe/packages/ui/react/components/Menu/SubMenu.d.ts +10 -0
  382. package/fe/packages/ui/react/components/Menu/SubMenu.js +169 -0
  383. package/fe/packages/ui/react/components/Menu/index.d.ts +9 -0
  384. package/fe/packages/ui/react/components/Menu/index.js +5 -0
  385. package/fe/packages/ui/react/components/Menu/menuTypes.d.ts +59 -0
  386. package/fe/packages/ui/react/components/Menu/menuTypes.js +1 -0
  387. package/fe/packages/ui/react/components/Menu/utils.d.ts +2 -0
  388. package/fe/packages/ui/react/components/Menu/utils.js +7 -0
  389. package/fe/packages/ui/react/components/Message/Message.d.ts +20 -0
  390. package/fe/packages/ui/react/components/Message/Message.js +58 -0
  391. package/fe/packages/ui/react/components/Message/MessageManager.d.ts +37 -0
  392. package/fe/packages/ui/react/components/Message/MessageManager.js +90 -0
  393. package/fe/packages/ui/react/components/Message/data.d.ts +2 -0
  394. package/fe/packages/ui/react/components/Message/data.js +1 -0
  395. package/fe/packages/ui/react/components/Message/index.d.ts +3 -0
  396. package/fe/packages/ui/react/components/Message/index.js +1 -0
  397. package/fe/packages/ui/react/components/Modal/Modal.d.ts +27 -0
  398. package/fe/packages/ui/react/components/Modal/Modal.js +14 -0
  399. package/fe/packages/ui/react/components/Modal/ModalManager.d.ts +59 -0
  400. package/fe/packages/ui/react/components/Modal/ModalManager.js +90 -0
  401. package/fe/packages/ui/react/components/Modal/index.d.ts +4 -0
  402. package/fe/packages/ui/react/components/Modal/index.js +2 -0
  403. package/fe/packages/ui/react/components/Overlay/Overlay.d.ts +23 -0
  404. package/fe/packages/ui/react/components/Overlay/Overlay.js +53 -0
  405. package/fe/packages/ui/react/components/Overlay/index.d.ts +3 -0
  406. package/fe/packages/ui/react/components/Overlay/index.js +1 -0
  407. package/fe/packages/ui/react/components/Pagination/Pagination.d.ts +18 -0
  408. package/fe/packages/ui/react/components/Pagination/Pagination.js +88 -0
  409. package/fe/packages/ui/react/components/Pagination/index.d.ts +2 -0
  410. package/fe/packages/ui/react/components/Pagination/index.js +1 -0
  411. package/fe/packages/ui/react/components/Popup/Popup.d.ts +26 -0
  412. package/fe/packages/ui/react/components/Popup/Popup.js +81 -0
  413. package/fe/packages/ui/react/components/Popup/index.d.ts +2 -0
  414. package/fe/packages/ui/react/components/Popup/index.js +1 -0
  415. package/fe/packages/ui/react/components/Search/Search.d.ts +17 -0
  416. package/fe/packages/ui/react/components/Search/Search.js +12 -0
  417. package/fe/packages/ui/react/components/Search/index.d.ts +2 -0
  418. package/fe/packages/ui/react/components/Search/index.js +1 -0
  419. package/fe/packages/ui/react/components/Select/Select.d.ts +26 -0
  420. package/fe/packages/ui/react/components/Select/Select.js +123 -0
  421. package/fe/packages/ui/react/components/Select/dropdownPositioning.d.ts +3 -0
  422. package/fe/packages/ui/react/components/Select/dropdownPositioning.js +13 -0
  423. package/fe/packages/ui/react/components/Select/index.d.ts +2 -0
  424. package/fe/packages/ui/react/components/Select/index.js +1 -0
  425. package/fe/packages/ui/react/components/Skeleton/Skeleton.d.ts +28 -0
  426. package/fe/packages/ui/react/components/Skeleton/Skeleton.js +31 -0
  427. package/fe/packages/ui/react/components/Skeleton/index.d.ts +3 -0
  428. package/fe/packages/ui/react/components/Skeleton/index.js +1 -0
  429. package/fe/packages/ui/react/components/Switch/Switch.d.ts +11 -0
  430. package/fe/packages/ui/react/components/Switch/Switch.js +22 -0
  431. package/fe/packages/ui/react/components/Switch/index.d.ts +2 -0
  432. package/fe/packages/ui/react/components/Switch/index.js +1 -0
  433. package/fe/packages/ui/react/components/TableSearch/TableSearch.d.ts +68 -0
  434. package/fe/packages/ui/react/components/TableSearch/TableSearch.js +121 -0
  435. package/fe/packages/ui/react/components/TableSearch/index.d.ts +2 -0
  436. package/fe/packages/ui/react/components/TableSearch/index.js +1 -0
  437. package/fe/packages/ui/react/components/TableSearch/lang.d.ts +15 -0
  438. package/fe/packages/ui/react/components/TableSearch/lang.js +14 -0
  439. package/fe/packages/ui/react/components/TableSearch/tableSearchLocaleStore.d.ts +9 -0
  440. package/fe/packages/ui/react/components/TableSearch/tableSearchLocaleStore.js +11 -0
  441. package/fe/packages/ui/react/components/Textarea/Textarea.d.ts +67 -0
  442. package/fe/packages/ui/react/components/Textarea/Textarea.js +37 -0
  443. package/fe/packages/ui/react/components/Textarea/index.d.ts +2 -0
  444. package/fe/packages/ui/react/components/Textarea/index.js +1 -0
  445. package/fe/packages/ui/react/components/Tooltip/Tooltip.d.ts +25 -0
  446. package/fe/packages/ui/react/components/Tooltip/Tooltip.js +79 -0
  447. package/fe/packages/ui/react/components/Tooltip/index.d.ts +2 -0
  448. package/fe/packages/ui/react/components/Tooltip/index.js +1 -0
  449. package/fe/packages/ui/react/components/TreeSelect/TreeSelect.d.ts +25 -0
  450. package/fe/packages/ui/react/components/TreeSelect/TreeSelect.js +160 -0
  451. package/fe/packages/ui/react/components/TreeSelect/index.d.ts +2 -0
  452. package/fe/packages/ui/react/components/TreeSelect/index.js +1 -0
  453. package/fe/packages/ui/react/components/Upload/ImageUpload.d.ts +9 -0
  454. package/fe/packages/ui/react/components/Upload/ImageUpload.js +75 -0
  455. package/fe/packages/ui/react/components/Upload/Upload.d.ts +41 -0
  456. package/fe/packages/ui/react/components/Upload/Upload.js +6 -0
  457. package/fe/packages/ui/react/components/Upload/index.d.ts +3 -0
  458. package/fe/packages/ui/react/components/Upload/index.js +2 -0
  459. package/fe/packages/ui/react/components/breadcrumb/breadcrumb.d.ts +35 -0
  460. package/fe/packages/ui/react/components/breadcrumb/breadcrumb.js +81 -0
  461. package/fe/packages/ui/react/components/breadcrumb/index.d.ts +2 -0
  462. package/fe/packages/ui/react/components/breadcrumb/index.js +1 -0
  463. package/fe/packages/ui/react/components/hooks/useDropdownPositioning.d.ts +49 -0
  464. package/fe/packages/ui/react/components/hooks/useDropdownPositioning.js +137 -0
  465. package/fe/packages/ui/react/components/hooks/useInputController.d.ts +24 -0
  466. package/fe/packages/ui/react/components/hooks/useInputController.js +45 -0
  467. package/fe/packages/ui/react/components/index.d.ts +30 -0
  468. package/fe/packages/ui/react/components/index.js +29 -0
  469. package/fe/packages/ui/react/components/table/index.d.ts +2 -0
  470. package/fe/packages/ui/react/components/table/index.js +1 -0
  471. package/fe/packages/ui/react/components/table/table.d.ts +27 -0
  472. package/fe/packages/ui/react/components/table/table.js +116 -0
  473. package/fe/packages/ui/react/components/testPage/MenuTestPage.d.ts +2 -0
  474. package/fe/packages/ui/react/components/testPage/MenuTestPage.js +104 -0
  475. package/fe/packages/ui/react/components/testPage/index.d.ts +3 -0
  476. package/fe/packages/ui/react/components/testPage/index.js +337 -0
  477. package/fe/packages/ui/react/hooks/useBreadcrumb.d.ts +10 -0
  478. package/fe/packages/ui/react/hooks/useBreadcrumb.js +2 -0
  479. package/fe/packages/ui/react/hooks/useExecuteOnce.d.ts +30 -0
  480. package/fe/packages/ui/react/hooks/useExecuteOnce.js +57 -0
  481. package/fe/packages/ui/react/hooks/useInit.d.ts +3 -0
  482. package/fe/packages/ui/react/hooks/useInit.js +9 -0
  483. package/fe/packages/ui/react/hooks/useLanguage.d.ts +2 -0
  484. package/fe/packages/ui/react/hooks/useLanguage.js +4 -0
  485. package/fe/packages/ui/react/hooks/usePagination.d.ts +16 -0
  486. package/fe/packages/ui/react/hooks/usePagination.js +27 -0
  487. package/fe/packages/ui/react/hooks/useRefState.d.ts +30 -0
  488. package/fe/packages/ui/react/hooks/useRefState.js +29 -0
  489. package/fe/packages/ui/react/hooks/useWatch.d.ts +23 -0
  490. package/fe/packages/ui/react/hooks/useWatch.js +87 -0
  491. package/fe/packages/ui/react/hooks/useWatch.test.d.ts +2 -0
  492. package/fe/packages/ui/react/hooks/useWatch.test.js +22 -0
  493. package/fe/packages/ui/react/i18n/I18nProvider.d.ts +31 -0
  494. package/fe/packages/ui/react/i18n/I18nProvider.js +25 -0
  495. package/fe/packages/ui/react/i18n/index.d.ts +4 -0
  496. package/fe/packages/ui/react/i18n/index.js +3 -0
  497. package/fe/packages/ui/react/i18n/useI18n.d.ts +13 -0
  498. package/fe/packages/ui/react/i18n/useI18n.js +18 -0
  499. package/fe/packages/ui/react/index.css +238 -0
  500. package/fe/packages/ui/react/index.d.ts +5 -0
  501. package/fe/packages/ui/react/index.js +6 -0
  502. package/fe/packages/ui/react/lib/createStoreHook.d.ts +9 -0
  503. package/fe/packages/ui/react/lib/createStoreHook.js +6 -0
  504. package/fe/packages/ui/react/lib/export.d.ts +66 -0
  505. package/fe/packages/ui/react/lib/export.js +138 -0
  506. package/fe/packages/ui/react/lib/utils.d.ts +34 -0
  507. package/fe/packages/ui/react/lib/utils.js +70 -0
  508. package/fe/packages/ui/react/stores/breadcrumb.d.ts +15 -0
  509. package/fe/packages/ui/react/stores/breadcrumb.js +66 -0
  510. package/fe/packages/ui/react/stores/language.d.ts +4 -0
  511. package/fe/packages/ui/react/stores/language.js +2 -0
  512. package/{typings/type.d.ts → fe/packages/ui/react/types/index.d.ts} +1 -1
  513. package/fe/packages/ui/react/types/index.js +1 -0
  514. package/fe/typings/type.d.ts +5 -0
  515. package/fe/typings/type.js +1 -0
  516. package/model/index.d.ts +1 -1
  517. package/model/test.d.ts +1 -5
  518. package/model/types/data/button.d.ts +32 -0
  519. package/model/types/data/component.d.ts +40 -0
  520. package/model/types/data/fetchInfo.d.ts +20 -0
  521. package/model/types/data/schema.d.ts +98 -0
  522. package/model/types/data/search.d.ts +7 -0
  523. package/model/types/index.d.ts +3 -0
  524. package/model/types/menuType.d.ts +73 -0
  525. package/model/types/model.d.ts +33 -0
  526. package/package.json +61 -8
  527. package/{app → types/app}/controller/base.d.ts +4 -6
  528. package/types/app/controller/project.d.ts +22 -0
  529. package/{app → types/app}/controller/view.d.ts +1 -3
  530. package/{app → types/app}/data/signKey.d.ts +0 -1
  531. package/types/app/extend/$fetch.d.ts +8 -0
  532. package/types/app/extend/db.d.ts +2 -0
  533. package/{app → types/app}/extend/generateErrorMessage.d.ts +0 -1
  534. package/{app → types/app}/extend/logger.d.ts +1 -2
  535. package/{app → types/app}/extend/parsingParamsOnUrl.d.ts +0 -1
  536. package/{app → types/app}/extend/render-view.d.ts +1 -3
  537. package/{app → types/app}/middleware/api-params-verify.d.ts +1 -3
  538. package/{app → types/app}/middleware/api-sign-verify.d.ts +1 -3
  539. package/types/app/middleware/error-handle.d.ts +4 -0
  540. package/types/app/middleware/project-handler.d.ts +4 -0
  541. package/{app → types/app}/middleware.d.ts +0 -3
  542. package/{app/router/view.d.ts → types/app/router/project.d.ts} +1 -2
  543. package/types/app/router/view.d.ts +3 -0
  544. package/types/app/router-schema/project.d.ts +3 -0
  545. package/types/app/service/base.d.ts +9 -0
  546. package/types/app/service/project.d.ts +57 -0
  547. package/types/app/type.d.ts +5 -0
  548. package/types/app/typings.d.ts +43 -0
  549. package/types/bundler/defaultAlias.d.ts +3 -0
  550. package/types/bundler/dev.d.ts +1 -0
  551. package/types/bundler/index.d.ts +2 -0
  552. package/types/bundler/prod.d.ts +1 -0
  553. package/types/bundler/state.d.ts +18 -0
  554. package/types/bundler/utils.d.ts +9 -0
  555. package/types/config/config.default.d.ts +14 -0
  556. package/types/index.d.ts +28 -0
  557. package/types/packages/common/LRUCache.d.ts +1 -0
  558. package/types/packages/common/array/index.d.ts +6 -0
  559. package/types/packages/common/cache/LRUCache.d.ts +12 -0
  560. package/types/packages/common/cache/index.d.ts +1 -0
  561. package/types/packages/common/guards/index.d.ts +8 -0
  562. package/types/packages/common/http/index.d.ts +89 -0
  563. package/types/packages/common/i18n/default.d.ts +91 -0
  564. package/types/packages/common/i18n/en-US.d.ts +91 -0
  565. package/types/packages/common/i18n/index.d.ts +42 -0
  566. package/types/packages/common/i18n/locales.d.ts +7 -0
  567. package/types/packages/common/i18n/types.d.ts +70 -0
  568. package/types/packages/common/index.d.ts +10 -0
  569. package/types/packages/common/log/index.d.ts +32 -0
  570. package/types/packages/common/number/index.d.ts +2 -0
  571. package/types/packages/common/object/filterEmpty.d.ts +2 -0
  572. package/types/packages/common/object/filtereEmpty.d.ts +1 -0
  573. package/types/packages/common/object/index.d.ts +4 -0
  574. package/types/packages/common/string/index.d.ts +3 -0
  575. package/types/packages/common/types/index.d.ts +3 -0
  576. package/{packages → types/packages}/core/env.d.ts +0 -1
  577. package/{packages → types/packages}/core/index.d.ts +1 -2
  578. package/types/packages/core/loader/config.d.ts +9 -0
  579. package/types/packages/core/loader/controller.d.ts +17 -0
  580. package/types/packages/core/loader/extend.d.ts +8 -0
  581. package/types/packages/core/loader/middleware.d.ts +11 -0
  582. package/types/packages/core/loader/model.d.ts +36 -0
  583. package/types/packages/core/loader/router-schema.d.ts +18 -0
  584. package/{packages/core/loader/extend.d.ts → types/packages/core/loader/router.d.ts} +5 -1
  585. package/types/packages/core/loader/service.d.ts +17 -0
  586. package/{packages → types/packages}/core/paths.d.ts +0 -1
  587. package/{packages → types/packages}/core/types.d.ts +60 -9
  588. package/{packages → types/packages}/utils/getAllFilesInFolder.d.ts +5 -1
  589. package/types/packages/utils/getAllFnReturnValue.d.ts +0 -0
  590. package/{packages → types/packages}/utils/index.d.ts +0 -1
  591. package/{packages → types/packages}/utils/loadFile.d.ts +6 -1
  592. package/types/packages/utils/path.d.ts +24 -0
  593. package/types/packages/utils/runFileFn.d.ts +7 -0
  594. package/types/typings/type.d.ts +4 -0
  595. package/app/controller/base.d.ts.map +0 -1
  596. package/app/controller/base.js +0 -24
  597. package/app/controller/base.js.map +0 -1
  598. package/app/controller/project.d.ts +0 -12
  599. package/app/controller/project.d.ts.map +0 -1
  600. package/app/controller/project.js +0 -48
  601. package/app/controller/project.js.map +0 -1
  602. package/app/controller/view.d.ts.map +0 -1
  603. package/app/controller/view.js +0 -15
  604. package/app/controller/view.js.map +0 -1
  605. package/app/data/signKey.d.ts.map +0 -1
  606. package/app/data/signKey.js +0 -5
  607. package/app/data/signKey.js.map +0 -1
  608. package/app/extend/db.d.ts +0 -3
  609. package/app/extend/db.d.ts.map +0 -1
  610. package/app/extend/db.js +0 -8
  611. package/app/extend/db.js.map +0 -1
  612. package/app/extend/generateErrorMessage.d.ts.map +0 -1
  613. package/app/extend/generateErrorMessage.js +0 -12
  614. package/app/extend/generateErrorMessage.js.map +0 -1
  615. package/app/extend/logger.d.ts.map +0 -1
  616. package/app/extend/logger.js +0 -73
  617. package/app/extend/logger.js.map +0 -1
  618. package/app/extend/parsingParamsOnUrl.d.ts.map +0 -1
  619. package/app/extend/parsingParamsOnUrl.js +0 -23
  620. package/app/extend/parsingParamsOnUrl.js.map +0 -1
  621. package/app/extend/render-view.d.ts.map +0 -1
  622. package/app/extend/render-view.js +0 -22
  623. package/app/extend/render-view.js.map +0 -1
  624. package/app/middleware/api-params-verify.d.ts.map +0 -1
  625. package/app/middleware/api-params-verify.js +0 -64
  626. package/app/middleware/api-params-verify.js.map +0 -1
  627. package/app/middleware/api-sign-verify.d.ts.map +0 -1
  628. package/app/middleware/api-sign-verify.js +0 -29
  629. package/app/middleware/api-sign-verify.js.map +0 -1
  630. package/app/middleware/error-handle.d.ts +0 -6
  631. package/app/middleware/error-handle.d.ts.map +0 -1
  632. package/app/middleware/error-handle.js +0 -34
  633. package/app/middleware/error-handle.js.map +0 -1
  634. package/app/middleware/project-handler.d.ts +0 -5
  635. package/app/middleware/project-handler.d.ts.map +0 -1
  636. package/app/middleware/project-handler.js +0 -22
  637. package/app/middleware/project-handler.js.map +0 -1
  638. package/app/middleware.d.ts.map +0 -1
  639. package/app/middleware.js +0 -39
  640. package/app/middleware.js.map +0 -1
  641. package/app/router/project.d.ts +0 -5
  642. package/app/router/project.d.ts.map +0 -1
  643. package/app/router/project.js +0 -9
  644. package/app/router/project.js.map +0 -1
  645. package/app/router/view.d.ts.map +0 -1
  646. package/app/router/view.js +0 -6
  647. package/app/router/view.js.map +0 -1
  648. package/app/router-schema/project.d.ts +0 -4
  649. package/app/router-schema/project.d.ts.map +0 -1
  650. package/app/router-schema/project.js +0 -34
  651. package/app/router-schema/project.js.map +0 -1
  652. package/app/service/bese.d.ts +0 -11
  653. package/app/service/bese.d.ts.map +0 -1
  654. package/app/service/bese.js +0 -18
  655. package/app/service/bese.js.map +0 -1
  656. package/app/service/project.d.ts +0 -28
  657. package/app/service/project.d.ts.map +0 -1
  658. package/app/service/project.js +0 -39
  659. package/app/service/project.js.map +0 -1
  660. package/app/type.d.ts +0 -3
  661. package/app/type.d.ts.map +0 -1
  662. package/app/type.js +0 -3
  663. package/app/type.js.map +0 -1
  664. package/app/typings.d.ts +0 -52
  665. package/app/typings.d.ts.map +0 -1
  666. package/app/typings.js +0 -3
  667. package/app/typings.js.map +0 -1
  668. package/index.d.ts +0 -29
  669. package/index.d.ts.map +0 -1
  670. package/index.js +0 -22
  671. package/index.js.map +0 -1
  672. package/model/index.d.ts.map +0 -1
  673. package/model/index.js +0 -7
  674. package/model/index.js.map +0 -1
  675. package/model/test.d.ts.map +0 -1
  676. package/model/test.js +0 -6
  677. package/model/test.js.map +0 -1
  678. package/model/test2.d.ts +0 -6
  679. package/model/test2.d.ts.map +0 -1
  680. package/model/test2.js +0 -6
  681. package/model/test2.js.map +0 -1
  682. package/packages/core/env.d.ts.map +0 -1
  683. package/packages/core/env.js +0 -26
  684. package/packages/core/env.js.map +0 -1
  685. package/packages/core/index.d.ts.map +0 -1
  686. package/packages/core/index.js +0 -93
  687. package/packages/core/index.js.map +0 -1
  688. package/packages/core/loader/config.d.ts +0 -4
  689. package/packages/core/loader/config.d.ts.map +0 -1
  690. package/packages/core/loader/config.js +0 -32
  691. package/packages/core/loader/config.js.map +0 -1
  692. package/packages/core/loader/controller.d.ts +0 -4
  693. package/packages/core/loader/controller.d.ts.map +0 -1
  694. package/packages/core/loader/controller.js +0 -18
  695. package/packages/core/loader/controller.js.map +0 -1
  696. package/packages/core/loader/extend.d.ts.map +0 -1
  697. package/packages/core/loader/extend.js +0 -34
  698. package/packages/core/loader/extend.js.map +0 -1
  699. package/packages/core/loader/middleware.d.ts +0 -4
  700. package/packages/core/loader/middleware.d.ts.map +0 -1
  701. package/packages/core/loader/middleware.js +0 -16
  702. package/packages/core/loader/middleware.js.map +0 -1
  703. package/packages/core/loader/model.d.ts +0 -15
  704. package/packages/core/loader/model.d.ts.map +0 -1
  705. package/packages/core/loader/model.js +0 -90
  706. package/packages/core/loader/model.js.map +0 -1
  707. package/packages/core/loader/router-schema.d.ts +0 -4
  708. package/packages/core/loader/router-schema.d.ts.map +0 -1
  709. package/packages/core/loader/router-schema.js +0 -20
  710. package/packages/core/loader/router-schema.js.map +0 -1
  711. package/packages/core/loader/router.d.ts +0 -4
  712. package/packages/core/loader/router.d.ts.map +0 -1
  713. package/packages/core/loader/router.js +0 -46
  714. package/packages/core/loader/router.js.map +0 -1
  715. package/packages/core/loader/service.d.ts +0 -4
  716. package/packages/core/loader/service.d.ts.map +0 -1
  717. package/packages/core/loader/service.js +0 -17
  718. package/packages/core/loader/service.js.map +0 -1
  719. package/packages/core/paths.d.ts.map +0 -1
  720. package/packages/core/paths.js +0 -11
  721. package/packages/core/paths.js.map +0 -1
  722. package/packages/core/types.d.ts.map +0 -1
  723. package/packages/core/types.js +0 -3
  724. package/packages/core/types.js.map +0 -1
  725. package/packages/utils/getAllFilesInFolder.d.ts.map +0 -1
  726. package/packages/utils/getAllFilesInFolder.js +0 -46
  727. package/packages/utils/getAllFilesInFolder.js.map +0 -1
  728. package/packages/utils/getAllFnReturnValue.d.ts +0 -1
  729. package/packages/utils/getAllFnReturnValue.d.ts.map +0 -1
  730. package/packages/utils/getAllFnReturnValue.js +0 -2
  731. package/packages/utils/getAllFnReturnValue.js.map +0 -1
  732. package/packages/utils/index.d.ts.map +0 -1
  733. package/packages/utils/index.js +0 -21
  734. package/packages/utils/index.js.map +0 -1
  735. package/packages/utils/loadFile.d.ts.map +0 -1
  736. package/packages/utils/loadFile.js +0 -57
  737. package/packages/utils/loadFile.js.map +0 -1
  738. package/packages/utils/path.d.ts +0 -7
  739. package/packages/utils/path.d.ts.map +0 -1
  740. package/packages/utils/path.js +0 -51
  741. package/packages/utils/path.js.map +0 -1
  742. package/packages/utils/runFileFn.d.ts +0 -6
  743. package/packages/utils/runFileFn.d.ts.map +0 -1
  744. package/packages/utils/runFileFn.js +0 -6
  745. package/packages/utils/runFileFn.js.map +0 -1
  746. package/typings/type.d.ts.map +0 -1
  747. package/typings/type.js +0 -3
  748. package/typings/type.js.map +0 -1
@@ -0,0 +1,169 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowLeft, ArrowRight, FlipHorizontal, FlipVertical, RefreshCw, RotateCcw, RotateCw, X, ZoomIn, ZoomOut, } from 'lucide-react';
3
+ import { useI18n } from '../../i18n';
4
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
5
+ import { createPortal } from 'react-dom';
6
+ import { Button } from '../Button';
7
+ const clamp = (value, min, max) => Math.min(max, Math.max(min, value));
8
+ function PreviewCore({ images, initialIndex, onClose }) {
9
+ const t = useI18n();
10
+ const [index, setIndex] = useState(initialIndex);
11
+ const [scale, _setScale] = useState(1);
12
+ const scaleRef = useRef(scale);
13
+ const [rotation, setRotation] = useState(0);
14
+ const [flipX, setFlipX] = useState(false);
15
+ const [flipY, setFlipY] = useState(false);
16
+ const imgRef = useRef(null);
17
+ const lastScaleBeforeNatural = useRef(null);
18
+ const [position, setPosition] = useState({ x: 0, y: 0 });
19
+ const [isDragging, setIsDragging] = useState(false);
20
+ const dragStart = useRef({ x: 0, y: 0 });
21
+ const positionRef = useRef({ x: 0, y: 0 });
22
+ const setScale = useCallback((newValue) => {
23
+ let newState = newValue;
24
+ if (typeof newValue === 'function') {
25
+ newState = newValue(scaleRef.current || 1);
26
+ }
27
+ scaleRef.current = newState;
28
+ _setScale(newState);
29
+ }, []);
30
+ const hasImages = images.length > 0;
31
+ const currentIndex = useMemo(() => clamp(index, 0, Math.max(images.length - 1, 0)), [index, images.length]);
32
+ const currentImage = hasImages ? images[currentIndex] : '';
33
+ const reset = () => {
34
+ setScale(1);
35
+ setRotation(0);
36
+ setFlipX(false);
37
+ setFlipY(false);
38
+ setPosition({ x: 0, y: 0 });
39
+ positionRef.current = { x: 0, y: 0 };
40
+ lastScaleBeforeNatural.current = null;
41
+ };
42
+ const handleMouseDown = useCallback((e) => {
43
+ setIsDragging(true);
44
+ dragStart.current = { x: e.clientX - positionRef.current.x, y: e.clientY - positionRef.current.y };
45
+ }, []);
46
+ const handleMouseMove = useCallback((e) => {
47
+ if (!isDragging)
48
+ return;
49
+ const newX = e.clientX - dragStart.current.x;
50
+ const newY = e.clientY - dragStart.current.y;
51
+ positionRef.current = { x: newX, y: newY };
52
+ setPosition({ x: newX, y: newY });
53
+ }, [isDragging]);
54
+ const handleMouseUp = useCallback(() => {
55
+ setIsDragging(false);
56
+ }, []);
57
+ const toPrev = () => {
58
+ if (!hasImages)
59
+ return;
60
+ setIndex((prev) => (prev - 1 + images.length) % images.length);
61
+ reset();
62
+ };
63
+ const toNext = () => {
64
+ if (!hasImages)
65
+ return;
66
+ setIndex((prev) => (prev + 1) % images.length);
67
+ reset();
68
+ };
69
+ const zoomIn = () => setScale((prev) => clamp(prev + 0.2, 0.2, 5));
70
+ const zoomOut = () => setScale((prev) => clamp(prev - 0.2, 0.2, 5));
71
+ const rotateLeft = () => setRotation((prev) => prev - 90);
72
+ const rotateRight = () => setRotation((prev) => prev + 90);
73
+ useEffect(() => {
74
+ const handleKey = (e) => {
75
+ if (e.key === 'Escape') {
76
+ onClose();
77
+ return;
78
+ }
79
+ if (e.key === 'ArrowLeft') {
80
+ if (!hasImages)
81
+ return;
82
+ setIndex((prev) => (prev - 1 + images.length) % images.length);
83
+ reset();
84
+ return;
85
+ }
86
+ if (e.key === 'ArrowRight') {
87
+ if (!hasImages)
88
+ return;
89
+ setIndex((prev) => (prev + 1) % images.length);
90
+ reset();
91
+ }
92
+ };
93
+ document.addEventListener('keydown', handleKey);
94
+ return () => document.removeEventListener('keydown', handleKey);
95
+ }, [onClose, hasImages, images.length]);
96
+ useEffect(() => {
97
+ if (!imgRef.current)
98
+ return;
99
+ const transform = `translate(calc(-50% + ${position.x}px), calc(-50% + ${position.y}px)) rotate(${rotation}deg) scale(${flipX ? -scale : scale}, ${flipY ? -scale : scale})`;
100
+ imgRef.current.style.transform = transform;
101
+ }, [rotation, scale, flipX, flipY, position]);
102
+ if (!hasImages)
103
+ return null;
104
+ const content = (_jsxs("div", { className: "tc-ui-image-preview fixed inset-0 z-[1100] bg-black/40 text-white", onClick: onClose, children: [_jsx(Button, { variant: "text", type: "button", onClick: onClose, className: "absolute right-6 top-6 p-2 rounded-full bg-black/70 hover:bg-black/80 transition-colors z-10", "aria-label": t('components.imagePreview.closePreview'), children: _jsx(X, { size: 20 }) }), images.length > 1 && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "text", type: "button", onClick: (e) => {
105
+ e.stopPropagation();
106
+ toPrev();
107
+ }, className: "absolute left-4 top-1/2 -translate-y-1/2 p-3 rounded-full bg-black/70 hover:bg-black/80 transition-colors z-10", "aria-label": t('components.imagePreview.previousImage'), children: _jsx(ArrowLeft, { size: 20 }) }), _jsx(Button, { variant: "text", type: "button", onClick: (e) => {
108
+ e.stopPropagation();
109
+ toNext();
110
+ }, className: "absolute right-4 top-1/2 -translate-y-1/2 p-3 rounded-full bg-black/70 hover:bg-black/80 transition-colors z-10", "aria-label": t('components.imagePreview.nextImage'), children: _jsx(ArrowRight, { size: 20 }) })] })), _jsx("div", { className: "absolute inset-0 flex items-center justify-center overflow-hidden", onClick: (e) => e.stopPropagation(), onWheel: (e) => {
111
+ e.preventDefault();
112
+ if (e.deltaY < 0) {
113
+ zoomIn();
114
+ }
115
+ else {
116
+ zoomOut();
117
+ }
118
+ }, onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, style: { cursor: isDragging ? 'grabbing' : scale > 1 ? 'grab' : 'default' }, children: _jsx("div", { className: "relative max-h-[85vh] max-w-[90vw]", children: _jsx("img", { ref: imgRef, src: currentImage, alt: "", draggable: false, className: " select-none max-h-[85vh] max-w-[90vw] absolute left-1/2 top-1/2 origin-center" }) }) }), _jsxs("div", { className: "absolute bottom-6 left-1/2 -translate-x-1/2 flex items-center gap-2 bg-black/70 backdrop-blur px-3 py-2 rounded-lg", children: [_jsx(Button, { variant: "text", type: "button", onClick: (e) => {
119
+ e.stopPropagation();
120
+ zoomOut();
121
+ }, className: "flex items-center gap-1 px-3 py-2 rounded-md hover:bg-white/15 text-sm", "aria-label": t('components.imagePreview.zoomOut'), children: _jsx(ZoomOut, { size: 16 }) }), _jsx(Button, { variant: "text", type: "button", onClick: (e) => {
122
+ e.stopPropagation();
123
+ zoomIn();
124
+ }, className: "flex items-center gap-1 px-3 py-2 rounded-md hover:bg-white/15 text-sm", "aria-label": t('components.imagePreview.zoomIn'), children: _jsx(ZoomIn, { size: 16 }) }), _jsx(Button, { variant: "text", type: "button", onClick: (e) => {
125
+ e.stopPropagation();
126
+ if (!imgRef.current)
127
+ return;
128
+ const { naturalWidth, naturalHeight, clientWidth, clientHeight } = imgRef.current;
129
+ // 如果 lastScaleBeforeNatural 无值
130
+ // 第一次点击
131
+ // 将 scaleRef 复制给 lastScaleBeforeNatural
132
+ // 正常赋值
133
+ // 如果 lastScaleBeforeNatural 有值
134
+ // 则使用 lastScaleBeforeNatural
135
+ // 再清除 lastScaleBeforeNatural
136
+ if (lastScaleBeforeNatural.current === null) {
137
+ const scaleToNatural = Math.max(naturalWidth / Math.max(clientWidth, 1), naturalHeight / Math.max(clientHeight, 1), 1);
138
+ lastScaleBeforeNatural.current = scaleRef.current;
139
+ setScale(scaleToNatural);
140
+ }
141
+ else {
142
+ //
143
+ setScale(lastScaleBeforeNatural.current);
144
+ lastScaleBeforeNatural.current = null;
145
+ }
146
+ }, className: "flex items-center gap-2 px-3 py-2 rounded-md hover:bg-white/15 text-sm", "aria-label": "1:1", children: "1:1" }), _jsx(Button, { variant: "text", type: "button", onClick: (e) => {
147
+ e.stopPropagation();
148
+ reset();
149
+ }, className: "flex items-center gap-2 px-3 py-2 rounded-md hover:bg-white/15 text-sm", "aria-label": t('components.imagePreview.reset'), children: _jsx(RefreshCw, { size: 16 }) }), _jsx(Button, { variant: "text", type: "button", onClick: (e) => {
150
+ e.stopPropagation();
151
+ rotateLeft();
152
+ }, className: "flex items-center gap-2 px-3 py-2 rounded-md hover:bg-white/15 text-sm", "aria-label": t('components.imagePreview.rotateLeft'), children: _jsx(RotateCcw, { size: 16 }) }), _jsx(Button, { variant: "text", type: "button", onClick: (e) => {
153
+ e.stopPropagation();
154
+ rotateRight();
155
+ }, className: "flex items-center gap-2 px-3 py-2 rounded-md hover:bg-white/15 text-sm", "aria-label": t('components.imagePreview.rotateRight'), children: _jsx(RotateCw, { size: 16 }) }), _jsx(Button, { variant: "text", type: "button", onClick: (e) => {
156
+ e.stopPropagation();
157
+ setFlipX((prev) => !prev);
158
+ }, className: "flex items-center gap-2 px-3 py-2 rounded-md hover:bg-white/15 text-sm", "aria-label": t('components.imagePreview.flipHorizontal'), children: _jsx(FlipHorizontal, { size: 16 }) }), _jsx(Button, { variant: "text", type: "button", onClick: (e) => {
159
+ e.stopPropagation();
160
+ setFlipY((prev) => !prev);
161
+ }, className: "flex items-center gap-2 px-3 py-2 rounded-md hover:bg-white/15 text-sm", "aria-label": t('components.imagePreview.flipVertical'), children: _jsx(FlipVertical, { size: 16 }) })] })] }));
162
+ return createPortal(content, document.body);
163
+ }
164
+ export function ImagePreviewController({ open, images, initialIndex = 0, onClose }) {
165
+ if (!open || images.length === 0)
166
+ return null;
167
+ const key = `${images.join('|')}-${initialIndex}`;
168
+ return _jsx(PreviewCore, { images: images, initialIndex: initialIndex, onClose: onClose }, key);
169
+ }
@@ -0,0 +1,11 @@
1
+ import type { MOmit } from '../../types';
2
+ import { type ImagePreviewControllerProps } from './ImagePreview';
3
+ export type PreviewImageProps = MOmit<ImagePreviewControllerProps, 'open' | 'onClose'> & Pick<Partial<ImagePreviewControllerProps>, 'onClose'> & {
4
+ /**
5
+ * 缩略图边长,默认 80px
6
+ */
7
+ thumbSize?: number | string;
8
+ direction?: 'horizontal' | 'vertical';
9
+ };
10
+ export declare function PreviewImage(props: PreviewImageProps): import("react/jsx-runtime").JSX.Element | null;
11
+ //# sourceMappingURL=PreviewImage.d.ts.map
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useI18n } from '../../i18n';
3
+ import { useMemo, useState } from 'react';
4
+ import { Button } from '../Button';
5
+ import { ImagePreviewController } from './ImagePreview';
6
+ export function PreviewImage(props) {
7
+ const t = useI18n();
8
+ const { onClose, images, thumbSize = 80, direction = 'horizontal', ...ext } = props;
9
+ const [open, setOpen] = useState(false);
10
+ const [currentIndex, setCurrentIndex] = useState(ext.initialIndex ?? 0);
11
+ const sizeClass = useMemo(() => {
12
+ const value = typeof thumbSize === 'number' ? `${thumbSize}px` : thumbSize;
13
+ return `w-[${value}] h-[${value}]`;
14
+ }, [thumbSize]);
15
+ const sizeStyle = useMemo(() => {
16
+ const value = typeof thumbSize === 'number' ? `${thumbSize}px` : thumbSize;
17
+ return { width: value, height: value };
18
+ }, [thumbSize]);
19
+ if (!images?.length)
20
+ return null;
21
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: `flex gap-2 ${direction === 'vertical' ? 'flex-col' : ''}`, children: images.map((src, idx) => (_jsx(Button, { variant: "text", type: "button", className: `relative aspect-square overflow-hidden rounded border border-border ${sizeClass}`, style: sizeStyle, onClick: () => {
22
+ setCurrentIndex(idx);
23
+ setOpen(true);
24
+ }, "aria-label": t('components.imagePreview.previewImage', { index: idx + 1 }), children: _jsx("img", { src: src, alt: "", className: "h-full w-full object-cover" }) }, src + idx))) }), _jsx(ImagePreviewController, { ...ext, images: images, initialIndex: currentIndex, open: open, onClose: () => {
25
+ setOpen(false);
26
+ onClose?.();
27
+ } })] }));
28
+ }
@@ -0,0 +1,3 @@
1
+ export * from './ImagePreview';
2
+ export * from './PreviewImage';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './ImagePreview';
2
+ export * from './PreviewImage';
@@ -0,0 +1,45 @@
1
+ import type { ChangeEvent, InputHTMLAttributes, ReactNode } from 'react';
2
+ export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'defaultValue'> & {
3
+ value?: string;
4
+ /**
5
+ *
6
+ * @param v input value
7
+ * @param e changeEvent
8
+ */
9
+ onChange?: (v: string, e: ChangeEvent<HTMLInputElement>) => void;
10
+ /**
11
+ * 只有初始化时会使用
12
+ * 如果会改变请使用value
13
+ */
14
+ defaultValue?: string;
15
+ allowClear?: boolean | {
16
+ clearIcon: ReactNode;
17
+ };
18
+ /** 输入框内部右侧按钮 */
19
+ addonAfter?: ReactNode;
20
+ /** 原生 input 节点的自定义 className */
21
+ inputClassName?: string;
22
+ };
23
+ declare const Input: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "onChange"> & {
24
+ value?: string;
25
+ /**
26
+ *
27
+ * @param v input value
28
+ * @param e changeEvent
29
+ */
30
+ onChange?: (v: string, e: ChangeEvent<HTMLInputElement>) => void;
31
+ /**
32
+ * 只有初始化时会使用
33
+ * 如果会改变请使用value
34
+ */
35
+ defaultValue?: string;
36
+ allowClear?: boolean | {
37
+ clearIcon: ReactNode;
38
+ };
39
+ /** 输入框内部右侧按钮 */
40
+ addonAfter?: ReactNode;
41
+ /** 原生 input 节点的自定义 className */
42
+ inputClassName?: string;
43
+ } & import("react").RefAttributes<HTMLInputElement>>;
44
+ export { Input };
45
+ //# sourceMappingURL=Input.d.ts.map
@@ -0,0 +1,61 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from '../../lib/utils';
3
+ import { X } from 'lucide-react';
4
+ import { forwardRef, useCallback, useMemo } from 'react';
5
+ import { useInputController } from '../hooks/useInputController';
6
+ const Input = forwardRef(({ className, inputClassName, type, value: controlledValue, onChange, defaultValue, allowClear, disabled, addonAfter, ...props }, ref) => {
7
+ const { setInternalValue, setIsFocused, setRefs, controllerRef, isControlledRef, isFocused, value, hasValue, } = useInputController({
8
+ defaultValue,
9
+ controlledValue,
10
+ ref,
11
+ });
12
+ const isFileInput = type === 'file';
13
+ // 在change恒定时 不重复生成 fn
14
+ // isControlledRef setInternalValue 都是不会变的值
15
+ const handleChange = useCallback((e) => {
16
+ const newValue = e.target.value;
17
+ if (!isFileInput && !isControlledRef.current) {
18
+ setInternalValue(newValue);
19
+ }
20
+ onChange?.(newValue, e);
21
+ }, [isFileInput, isControlledRef, onChange, setInternalValue]);
22
+ const handleClear = useCallback((e) => {
23
+ e.preventDefault();
24
+ e.stopPropagation();
25
+ // 非受控时更新内部状态
26
+ if (!isControlledRef.current) {
27
+ setInternalValue('');
28
+ }
29
+ const syntheticEvent = {
30
+ target: { value: '' },
31
+ currentTarget: { value: '' },
32
+ };
33
+ onChange?.('', syntheticEvent);
34
+ controllerRef.current?.focus();
35
+ }, [controllerRef, isControlledRef, onChange, setInternalValue]);
36
+ const clearIcon = useMemo(() => {
37
+ if (allowClear) {
38
+ if (typeof allowClear === 'boolean') {
39
+ return (_jsx("span", { className: cn('w-5 h-5 rounded-full', 'bg-muted hover:bg-muted/80', 'text-foreground', 'transition-colors', 'flex items-center justify-center', 'focus:outline-none'), children: _jsx(X, { size: 12 }) }));
40
+ }
41
+ else {
42
+ return allowClear.clearIcon;
43
+ }
44
+ }
45
+ return undefined;
46
+ }, [allowClear]);
47
+ const showClearIcon = hasValue && clearIcon && !disabled;
48
+ return (_jsxs("div", { className: cn('tc-ui-input relative w-full', className), children: [_jsx("input", { type: type, ref: setRefs, ...(!isFileInput && { value }), onChange: handleChange, className: cn('flex w-full rounded-lg px-4 py-3 text-sm', 'border transition-colors duration-200', 'placeholder:text-muted-foreground', 'focus:outline-none', showClearIcon && 'pr-10', addonAfter && 'pr-12', disabled ? 'cursor-not-allowed bg-muted border-border text-muted-foreground' : 'bg-background', !disabled && !hasValue && !isFocused && 'border-border', !disabled && (hasValue || isFocused) && 'border-theme', inputClassName), onFocus: (e) => {
49
+ if (!disabled) {
50
+ setIsFocused(true);
51
+ props.onFocus?.(e);
52
+ }
53
+ }, onBlur: (e) => {
54
+ if (!disabled) {
55
+ setIsFocused(false);
56
+ props.onBlur?.(e);
57
+ }
58
+ }, disabled: disabled, ...props }), showClearIcon && (_jsx("button", { type: "button", onClick: handleClear, className: cn('absolute right-3 top-1/2 -translate-y-1/2'), children: clearIcon })), addonAfter && _jsx("div", { className: "absolute right-2 top-1/2 -translate-y-1/2", children: addonAfter })] }));
59
+ });
60
+ Input.displayName = 'Input';
61
+ export { Input };
@@ -0,0 +1,2 @@
1
+ export * from './Input';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ export * from './Input';
@@ -0,0 +1,28 @@
1
+ import type { ChangeEvent, InputHTMLAttributes, ReactNode } from 'react';
2
+ import { type InputNumberConstraints } from './inputNumberUtils';
3
+ export type InputNumberProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'step' | 'type' | 'value'> & InputNumberConstraints & {
4
+ value?: number;
5
+ defaultValue?: number;
6
+ onChange?: (value: number | undefined, e: ChangeEvent<HTMLInputElement>) => void;
7
+ allowClear?: boolean | {
8
+ clearIcon: ReactNode;
9
+ };
10
+ addonAfter?: ReactNode;
11
+ allowStep?: boolean;
12
+ /** 原生 input 节点的自定义 className */
13
+ inputClassName?: string;
14
+ };
15
+ declare const InputNumber: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "type" | "defaultValue" | "onChange" | "step"> & InputNumberConstraints & {
16
+ value?: number;
17
+ defaultValue?: number;
18
+ onChange?: (value: number | undefined, e: ChangeEvent<HTMLInputElement>) => void;
19
+ allowClear?: boolean | {
20
+ clearIcon: ReactNode;
21
+ };
22
+ addonAfter?: ReactNode;
23
+ allowStep?: boolean;
24
+ /** 原生 input 节点的自定义 className */
25
+ inputClassName?: string;
26
+ } & import("react").RefAttributes<HTMLInputElement>>;
27
+ export { InputNumber };
28
+ //# sourceMappingURL=InputNumber.d.ts.map
@@ -0,0 +1,144 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from '../../lib/utils';
3
+ import { ChevronDown, ChevronUp, X } from 'lucide-react';
4
+ import { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
5
+ import { formatNumber, isValidNumberInput, normalizeNumber, parseInputNumber, shouldSyncDisplayValue, stepValue, } from './inputNumberUtils';
6
+ const formatDisplayValue = (value, constraints) => typeof value === 'number' ? formatNumber(value, constraints) : '';
7
+ const getBlurValue = (rawValue) => {
8
+ if (rawValue === '' || rawValue === '-' || rawValue === '.' || rawValue === '-.') {
9
+ return undefined;
10
+ }
11
+ const normalizedRawValue = rawValue.endsWith('.') ? rawValue.slice(0, -1) : rawValue;
12
+ const parsedValue = Number(normalizedRawValue);
13
+ return Number.isFinite(parsedValue) ? parsedValue : undefined;
14
+ };
15
+ const InputNumber = forwardRef(({ className, inputClassName, value: controlledValue, onChange, defaultValue, allowClear, addonAfter, allowStep = false, disabled, min, max, precision, step, inputMode = 'decimal', ...props }, ref) => {
16
+ const constraints = useMemo(() => ({
17
+ min,
18
+ max,
19
+ precision,
20
+ step,
21
+ }), [max, min, precision, step]);
22
+ const isControlled = controlledValue !== undefined;
23
+ const [internalValue, setInternalValue] = useState(defaultValue);
24
+ const currentValue = isControlled ? controlledValue : internalValue;
25
+ const [isFocused, setIsFocused] = useState(false);
26
+ const [displayValue, setDisplayValue] = useState(() => formatDisplayValue(currentValue, constraints));
27
+ const inputRef = useRef(null);
28
+ const setRefs = useCallback((node) => {
29
+ inputRef.current = node;
30
+ if (typeof ref === 'function') {
31
+ ref(node);
32
+ }
33
+ else if (ref) {
34
+ ref.current = node;
35
+ }
36
+ }, [ref]);
37
+ useEffect(() => {
38
+ if (!shouldSyncDisplayValue({ isFocused, displayValue, currentValue })) {
39
+ return;
40
+ }
41
+ const nextDisplayValue = formatDisplayValue(currentValue, constraints);
42
+ if (nextDisplayValue !== displayValue) {
43
+ setDisplayValue(nextDisplayValue);
44
+ }
45
+ }, [constraints, currentValue, displayValue, isFocused]);
46
+ const emitChange = useCallback((nextValue, e, forceNotify = false) => {
47
+ if (!isControlled) {
48
+ setInternalValue(nextValue);
49
+ }
50
+ if (forceNotify || !Object.is(currentValue, nextValue)) {
51
+ onChange?.(nextValue, e);
52
+ }
53
+ }, [currentValue, isControlled, onChange]);
54
+ const createSyntheticChangeEvent = useCallback((value) => {
55
+ const target = inputRef.current;
56
+ if (target) {
57
+ target.value = value;
58
+ }
59
+ return {
60
+ target: { value },
61
+ currentTarget: { value },
62
+ };
63
+ }, []);
64
+ const handleChange = useCallback((e) => {
65
+ const nextDisplayValue = e.target.value;
66
+ if (!isValidNumberInput(nextDisplayValue)) {
67
+ return;
68
+ }
69
+ setDisplayValue(nextDisplayValue);
70
+ const parsedValue = parseInputNumber(nextDisplayValue);
71
+ if (parsedValue.kind === 'empty') {
72
+ emitChange(undefined, e);
73
+ return;
74
+ }
75
+ if (parsedValue.kind === 'number') {
76
+ emitChange(parsedValue.value, e);
77
+ }
78
+ }, [emitChange]);
79
+ const handleBlur = useCallback((e) => {
80
+ setIsFocused(false);
81
+ const nextValue = getBlurValue(displayValue);
82
+ if (nextValue === undefined) {
83
+ const syntheticEvent = createSyntheticChangeEvent('');
84
+ setDisplayValue('');
85
+ emitChange(undefined, syntheticEvent);
86
+ props.onBlur?.(e);
87
+ return;
88
+ }
89
+ const normalizedValue = normalizeNumber(nextValue, constraints);
90
+ const nextDisplayValue = formatDisplayValue(normalizedValue, constraints);
91
+ const syntheticEvent = createSyntheticChangeEvent(nextDisplayValue);
92
+ setDisplayValue(nextDisplayValue);
93
+ emitChange(normalizedValue, syntheticEvent);
94
+ props.onBlur?.(e);
95
+ }, [constraints, createSyntheticChangeEvent, displayValue, emitChange, props]);
96
+ const handleFocus = useCallback((e) => {
97
+ if (disabled) {
98
+ return;
99
+ }
100
+ setIsFocused(true);
101
+ props.onFocus?.(e);
102
+ }, [disabled, props]);
103
+ const clearIcon = useMemo(() => {
104
+ if (!allowClear) {
105
+ return undefined;
106
+ }
107
+ if (typeof allowClear === 'boolean') {
108
+ return (_jsx("span", { className: cn('h-5 w-5 rounded-full', 'bg-muted text-foreground', 'flex items-center justify-center', 'transition-colors hover:bg-muted/80'), children: _jsx(X, { size: 12 }) }));
109
+ }
110
+ return allowClear.clearIcon;
111
+ }, [allowClear]);
112
+ const hasValue = displayValue.length > 0;
113
+ const showClearIcon = hasValue && clearIcon && !disabled;
114
+ const hasRightAccessories = showClearIcon || addonAfter || allowStep;
115
+ const currentParsedValue = parseInputNumber(displayValue);
116
+ const stepBaseValue = currentParsedValue.kind === 'number' ? currentParsedValue.value : currentValue;
117
+ const normalizedCurrentStepValue = typeof stepBaseValue === 'number' ? normalizeNumber(stepBaseValue, constraints) : undefined;
118
+ const canStep = useCallback((direction) => {
119
+ if (disabled) {
120
+ return false;
121
+ }
122
+ const nextValue = stepValue(stepBaseValue, direction, constraints);
123
+ return !Object.is(nextValue, normalizedCurrentStepValue);
124
+ }, [constraints, disabled, normalizedCurrentStepValue, stepBaseValue]);
125
+ const handleStep = useCallback((direction) => {
126
+ const nextValue = stepValue(stepBaseValue, direction, constraints);
127
+ const nextDisplayValue = formatDisplayValue(nextValue, constraints);
128
+ const syntheticEvent = createSyntheticChangeEvent(nextDisplayValue);
129
+ setDisplayValue(nextDisplayValue);
130
+ emitChange(nextValue, syntheticEvent, true);
131
+ inputRef.current?.focus();
132
+ }, [constraints, createSyntheticChangeEvent, emitChange, stepBaseValue]);
133
+ const handleClear = useCallback((e) => {
134
+ e.preventDefault();
135
+ e.stopPropagation();
136
+ const syntheticEvent = createSyntheticChangeEvent('');
137
+ setDisplayValue('');
138
+ emitChange(undefined, syntheticEvent, true);
139
+ inputRef.current?.focus();
140
+ }, [createSyntheticChangeEvent, emitChange]);
141
+ return (_jsxs("div", { className: cn('tc-ui-input-number relative w-full', className), children: [_jsx("input", { ref: setRefs, type: "text", value: displayValue, onChange: handleChange, inputMode: inputMode, className: cn('flex w-full rounded-lg px-4 py-3 text-sm', 'border transition-colors duration-200', 'placeholder:text-muted-foreground', 'focus:outline-none', showClearIcon && !allowStep && !addonAfter && 'pr-10', hasRightAccessories && 'pr-24', allowStep && addonAfter && 'pr-28', disabled ? 'cursor-not-allowed bg-muted border-border text-muted-foreground' : 'bg-background', !disabled && !hasValue && !isFocused && 'border-border', !disabled && (hasValue || isFocused) && 'border-theme', inputClassName), onFocus: handleFocus, onBlur: handleBlur, disabled: disabled, ...props }), hasRightAccessories && (_jsxs("div", { className: "absolute right-2 top-1/2 flex -translate-y-1/2 items-center gap-1", children: [showClearIcon && (_jsx("button", { type: "button", onMouseDown: (e) => e.preventDefault(), onClick: handleClear, children: clearIcon })), addonAfter && _jsx("div", { children: addonAfter }), allowStep && (_jsxs("div", { className: "flex flex-col overflow-hidden rounded-md border border-border", children: [_jsx("button", { type: "button", onMouseDown: (e) => e.preventDefault(), onClick: () => handleStep('up'), disabled: !canStep('up'), className: cn('flex h-4 w-4 items-center justify-center bg-background text-foreground transition-colors', 'border-b border-border', 'disabled:cursor-not-allowed disabled:text-muted-foreground', !disabled && canStep('up') && 'hover:bg-muted'), children: _jsx(ChevronUp, { size: 12 }) }), _jsx("button", { type: "button", onMouseDown: (e) => e.preventDefault(), onClick: () => handleStep('down'), disabled: !canStep('down'), className: cn('flex h-4 w-4 items-center justify-center bg-background text-foreground transition-colors', 'disabled:cursor-not-allowed disabled:text-muted-foreground', !disabled && canStep('down') && 'hover:bg-muted'), children: _jsx(ChevronDown, { size: 12 }) })] }))] }))] }));
142
+ });
143
+ InputNumber.displayName = 'InputNumber';
144
+ export { InputNumber };
@@ -0,0 +1,2 @@
1
+ export * from './InputNumber';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ export * from './InputNumber';
@@ -0,0 +1,30 @@
1
+ export interface InputNumberConstraints {
2
+ min?: number;
3
+ max?: number;
4
+ precision?: number;
5
+ step?: number;
6
+ }
7
+ export type ParsedInputNumber = {
8
+ kind: 'empty';
9
+ } | {
10
+ kind: 'incomplete';
11
+ } | {
12
+ kind: 'invalid';
13
+ } | {
14
+ kind: 'number';
15
+ value: number;
16
+ };
17
+ export type StepDirection = 'up' | 'down';
18
+ export declare const isValidNumberInput: (value: string) => boolean;
19
+ export declare const clampValue: (value: number, constraints: InputNumberConstraints) => number;
20
+ export declare const applyPrecision: (value: number, precision?: number) => number;
21
+ export declare const normalizeNumber: (value: number, constraints: InputNumberConstraints) => number;
22
+ export declare const formatNumber: (value: number, constraints: InputNumberConstraints) => string;
23
+ export declare const parseInputNumber: (value: string) => ParsedInputNumber;
24
+ export declare const shouldSyncDisplayValue: ({ isFocused, displayValue, currentValue, }: {
25
+ isFocused: boolean;
26
+ displayValue: string;
27
+ currentValue: number | undefined;
28
+ }) => boolean;
29
+ export declare const stepValue: (currentValue: number | undefined, direction: StepDirection, constraints: InputNumberConstraints) => number;
30
+ //# sourceMappingURL=inputNumberUtils.d.ts.map
@@ -0,0 +1,63 @@
1
+ const isFiniteNumber = (value) => typeof value === 'number' && Number.isFinite(value);
2
+ export const isValidNumberInput = (value) => /^-?\d*(\.\d*)?$/.test(value);
3
+ export const clampValue = (value, constraints) => {
4
+ let nextValue = value;
5
+ if (isFiniteNumber(constraints.min)) {
6
+ nextValue = Math.max(nextValue, constraints.min);
7
+ }
8
+ if (isFiniteNumber(constraints.max)) {
9
+ nextValue = Math.min(nextValue, constraints.max);
10
+ }
11
+ return nextValue;
12
+ };
13
+ export const applyPrecision = (value, precision) => {
14
+ if (typeof precision !== 'number' || precision < 0) {
15
+ return value;
16
+ }
17
+ return Number(value.toFixed(precision));
18
+ };
19
+ export const normalizeNumber = (value, constraints) => {
20
+ return clampValue(applyPrecision(value, constraints.precision), constraints);
21
+ };
22
+ export const formatNumber = (value, constraints) => {
23
+ const normalized = normalizeNumber(value, constraints);
24
+ if (typeof constraints.precision === 'number' && constraints.precision >= 0) {
25
+ return normalized.toFixed(constraints.precision);
26
+ }
27
+ return String(normalized);
28
+ };
29
+ export const parseInputNumber = (value) => {
30
+ if (value === '') {
31
+ return { kind: 'empty' };
32
+ }
33
+ if (value === '-' || value === '.' || value === '-.' || /^-?\d+\.$/.test(value)) {
34
+ return { kind: 'incomplete' };
35
+ }
36
+ if (!isValidNumberInput(value)) {
37
+ return { kind: 'invalid' };
38
+ }
39
+ const parsedValue = Number(value);
40
+ if (!Number.isFinite(parsedValue)) {
41
+ return { kind: 'invalid' };
42
+ }
43
+ return { kind: 'number', value: parsedValue };
44
+ };
45
+ export const shouldSyncDisplayValue = ({ isFocused, displayValue, currentValue, }) => {
46
+ if (!isFocused) {
47
+ return true;
48
+ }
49
+ const parsedDisplayValue = parseInputNumber(displayValue);
50
+ if (parsedDisplayValue.kind === 'incomplete' || parsedDisplayValue.kind === 'invalid') {
51
+ return false;
52
+ }
53
+ if (parsedDisplayValue.kind === 'empty') {
54
+ return currentValue !== undefined;
55
+ }
56
+ return !Object.is(parsedDisplayValue.value, currentValue);
57
+ };
58
+ export const stepValue = (currentValue, direction, constraints) => {
59
+ const step = constraints.step && constraints.step > 0 ? constraints.step : 1;
60
+ const baseValue = isFiniteNumber(currentValue) ? currentValue : 0;
61
+ const delta = direction === 'up' ? step : -step;
62
+ return normalizeNumber(baseValue + delta, constraints);
63
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=inputNumberUtils.test.d.ts.map
@@ -0,0 +1,27 @@
1
+ import assert from 'node:assert/strict';
2
+ import test from 'node:test';
3
+ import { clampValue, formatNumber, parseInputNumber, shouldSyncDisplayValue, stepValue } from './inputNumberUtils';
4
+ test('parseInputNumber keeps empty and transitional values unresolved', () => {
5
+ assert.deepEqual(parseInputNumber(''), { kind: 'empty' });
6
+ assert.deepEqual(parseInputNumber('-'), { kind: 'incomplete' });
7
+ assert.deepEqual(parseInputNumber('.'), { kind: 'incomplete' });
8
+ assert.deepEqual(parseInputNumber('1.'), { kind: 'incomplete' });
9
+ assert.deepEqual(parseInputNumber('-1.'), { kind: 'incomplete' });
10
+ assert.deepEqual(parseInputNumber('1.25'), { kind: 'number', value: 1.25 });
11
+ });
12
+ test('formatNumber applies precision and clamps boundaries', () => {
13
+ assert.equal(formatNumber(1.236, { precision: 2 }), '1.24');
14
+ assert.equal(formatNumber(12, { max: 10 }), '10');
15
+ assert.equal(clampValue(-3, { min: 0 }), 0);
16
+ });
17
+ test('stepValue respects min max precision and step', () => {
18
+ assert.equal(stepValue(undefined, 'up', { step: 0.25, precision: 2 }), 0.25);
19
+ assert.equal(stepValue(9.9, 'up', { step: 1, max: 10, precision: 1 }), 10);
20
+ assert.equal(stepValue(0.3, 'down', { step: 0.2, min: 0, precision: 1 }), 0.1);
21
+ });
22
+ test('shouldSyncDisplayValue preserves editable decimals while focused', () => {
23
+ assert.equal(shouldSyncDisplayValue({ isFocused: true, displayValue: '12.5', currentValue: 12.5 }), false);
24
+ assert.equal(shouldSyncDisplayValue({ isFocused: true, displayValue: '12.56', currentValue: 12.56 }), false);
25
+ assert.equal(shouldSyncDisplayValue({ isFocused: true, displayValue: '12.56', currentValue: 3.14 }), true);
26
+ assert.equal(shouldSyncDisplayValue({ isFocused: false, displayValue: '12.56', currentValue: 12.56 }), true);
27
+ });