elegant-router.d.ts 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. /* eslint-disable */
  2. /* prettier-ignore */
  3. // Generated by elegant-router
  4. // Read more: https://github.com/soybeanjs/elegant-router
  5. declare module "@elegant-router/types" {
  6. type ElegantConstRoute = import('@elegant-router/vue').ElegantConstRoute;
  7. /**
  8. * route layout
  9. */
  10. export type RouteLayout = "base" | "blank";
  11. /**
  12. * route map
  13. */
  14. export type RouteMap = {
  15. "root": "/";
  16. "not-found": "/:pathMatch(.*)*";
  17. "exception": "/exception";
  18. "exception_403": "/exception/403";
  19. "exception_404": "/exception/404";
  20. "exception_500": "/exception/500";
  21. "document": "/document";
  22. "document_project": "/document/project";
  23. "document_project-link": "/document/project-link";
  24. "document_video": "/document/video";
  25. "document_vue": "/document/vue";
  26. "document_vite": "/document/vite";
  27. "document_unocss": "/document/unocss";
  28. "document_naive": "/document/naive";
  29. "document_pro-naive": "/document/pro-naive";
  30. "document_antd": "/document/antd";
  31. "document_alova": "/document/alova";
  32. "403": "/403";
  33. "404": "/404";
  34. "500": "/500";
  35. "about": "/about";
  36. "home": "/home";
  37. "iframe-page": "/iframe-page/:url";
  38. "login": "/login/:module(pwd-login|code-login|register|reset-pwd|bind-wechat)?";
  39. "manage": "/manage";
  40. "manage_config": "/manage/config";
  41. "manage_log": "/manage/log";
  42. "manage_menu": "/manage/menu";
  43. "manage_role": "/manage/role";
  44. "manage_schedule": "/manage/schedule";
  45. "manage_user": "/manage/user";
  46. "plugin": "/plugin";
  47. "plugin_barcode": "/plugin/barcode";
  48. "plugin_charts": "/plugin/charts";
  49. "plugin_charts_antv": "/plugin/charts/antv";
  50. "plugin_charts_echarts": "/plugin/charts/echarts";
  51. "plugin_charts_vchart": "/plugin/charts/vchart";
  52. "plugin_copy": "/plugin/copy";
  53. "plugin_editor": "/plugin/editor";
  54. "plugin_editor_markdown": "/plugin/editor/markdown";
  55. "plugin_editor_quill": "/plugin/editor/quill";
  56. "plugin_excel": "/plugin/excel";
  57. "plugin_gantt": "/plugin/gantt";
  58. "plugin_gantt_dhtmlx": "/plugin/gantt/dhtmlx";
  59. "plugin_gantt_vtable": "/plugin/gantt/vtable";
  60. "plugin_icon": "/plugin/icon";
  61. "plugin_map": "/plugin/map";
  62. "plugin_pdf": "/plugin/pdf";
  63. "plugin_pinyin": "/plugin/pinyin";
  64. "plugin_print": "/plugin/print";
  65. "plugin_swiper": "/plugin/swiper";
  66. "plugin_tables": "/plugin/tables";
  67. "plugin_tables_vtable": "/plugin/tables/vtable";
  68. "plugin_typeit": "/plugin/typeit";
  69. "plugin_video": "/plugin/video";
  70. "pro-naive": "/pro-naive";
  71. "pro-naive_form": "/pro-naive/form";
  72. "pro-naive_form_basic": "/pro-naive/form/basic";
  73. "pro-naive_form_query": "/pro-naive/form/query";
  74. "pro-naive_form_step": "/pro-naive/form/step";
  75. "pro-naive_table": "/pro-naive/table";
  76. "pro-naive_table_remote": "/pro-naive/table/remote";
  77. "pro-naive_table_row-edit": "/pro-naive/table/row-edit";
  78. "user-center": "/user-center";
  79. };
  80. /**
  81. * route key
  82. */
  83. export type RouteKey = keyof RouteMap;
  84. /**
  85. * route path
  86. */
  87. export type RoutePath = RouteMap[RouteKey];
  88. /**
  89. * custom route key
  90. */
  91. export type CustomRouteKey = Extract<
  92. RouteKey,
  93. | "root"
  94. | "not-found"
  95. | "exception"
  96. | "exception_403"
  97. | "exception_404"
  98. | "exception_500"
  99. | "document"
  100. | "document_project"
  101. | "document_project-link"
  102. | "document_video"
  103. | "document_vue"
  104. | "document_vite"
  105. | "document_unocss"
  106. | "document_naive"
  107. | "document_pro-naive"
  108. | "document_antd"
  109. | "document_alova"
  110. >;
  111. /**
  112. * the generated route key
  113. */
  114. export type GeneratedRouteKey = Exclude<RouteKey, CustomRouteKey>;
  115. /**
  116. * the first level route key, which contain the layout of the route
  117. */
  118. export type FirstLevelRouteKey = Extract<
  119. RouteKey,
  120. | "403"
  121. | "404"
  122. | "500"
  123. | "about"
  124. | "home"
  125. | "iframe-page"
  126. | "login"
  127. | "manage"
  128. | "plugin"
  129. | "pro-naive"
  130. | "user-center"
  131. >;
  132. /**
  133. * the custom first level route key
  134. */
  135. export type CustomFirstLevelRouteKey = Extract<
  136. CustomRouteKey,
  137. | "root"
  138. | "not-found"
  139. | "exception"
  140. | "document"
  141. >;
  142. /**
  143. * the last level route key, which has the page file
  144. */
  145. export type LastLevelRouteKey = Extract<
  146. RouteKey,
  147. | "403"
  148. | "404"
  149. | "500"
  150. | "iframe-page"
  151. | "login"
  152. | "about"
  153. | "home"
  154. | "manage_config"
  155. | "manage_log"
  156. | "manage_menu"
  157. | "manage_role"
  158. | "manage_schedule"
  159. | "manage_user"
  160. | "plugin_barcode"
  161. | "plugin_charts_antv"
  162. | "plugin_charts_echarts"
  163. | "plugin_charts_vchart"
  164. | "plugin_copy"
  165. | "plugin_editor_markdown"
  166. | "plugin_editor_quill"
  167. | "plugin_excel"
  168. | "plugin_gantt_dhtmlx"
  169. | "plugin_gantt_vtable"
  170. | "plugin_icon"
  171. | "plugin_map"
  172. | "plugin_pdf"
  173. | "plugin_pinyin"
  174. | "plugin_print"
  175. | "plugin_swiper"
  176. | "plugin_tables_vtable"
  177. | "plugin_typeit"
  178. | "plugin_video"
  179. | "pro-naive_form_basic"
  180. | "pro-naive_form_query"
  181. | "pro-naive_form_step"
  182. | "pro-naive_table_remote"
  183. | "pro-naive_table_row-edit"
  184. | "user-center"
  185. >;
  186. /**
  187. * the custom last level route key
  188. */
  189. export type CustomLastLevelRouteKey = Extract<
  190. CustomRouteKey,
  191. | "root"
  192. | "not-found"
  193. | "exception_403"
  194. | "exception_404"
  195. | "exception_500"
  196. | "document_project"
  197. | "document_project-link"
  198. | "document_video"
  199. | "document_vue"
  200. | "document_vite"
  201. | "document_unocss"
  202. | "document_naive"
  203. | "document_pro-naive"
  204. | "document_antd"
  205. | "document_alova"
  206. >;
  207. /**
  208. * the single level route key
  209. */
  210. export type SingleLevelRouteKey = FirstLevelRouteKey & LastLevelRouteKey;
  211. /**
  212. * the custom single level route key
  213. */
  214. export type CustomSingleLevelRouteKey = CustomFirstLevelRouteKey & CustomLastLevelRouteKey;
  215. /**
  216. * the first level route key, but not the single level
  217. */
  218. export type FirstLevelRouteNotSingleKey = Exclude<FirstLevelRouteKey, SingleLevelRouteKey>;
  219. /**
  220. * the custom first level route key, but not the single level
  221. */
  222. export type CustomFirstLevelRouteNotSingleKey = Exclude<CustomFirstLevelRouteKey, CustomSingleLevelRouteKey>;
  223. /**
  224. * the center level route key
  225. */
  226. export type CenterLevelRouteKey = Exclude<GeneratedRouteKey, FirstLevelRouteKey | LastLevelRouteKey>;
  227. /**
  228. * the custom center level route key
  229. */
  230. export type CustomCenterLevelRouteKey = Exclude<CustomRouteKey, CustomFirstLevelRouteKey | CustomLastLevelRouteKey>;
  231. /**
  232. * the center level route key
  233. */
  234. type GetChildRouteKey<K extends RouteKey, T extends RouteKey = RouteKey> = T extends `${K}_${infer R}`
  235. ? R extends `${string}_${string}`
  236. ? never
  237. : T
  238. : never;
  239. /**
  240. * the single level route
  241. */
  242. type SingleLevelRoute<K extends SingleLevelRouteKey = SingleLevelRouteKey> = K extends string
  243. ? Omit<ElegantConstRoute, 'children'> & {
  244. name: K;
  245. path: RouteMap[K];
  246. component: `layout.${RouteLayout}$view.${K}`;
  247. }
  248. : never;
  249. /**
  250. * the last level route
  251. */
  252. type LastLevelRoute<K extends GeneratedRouteKey> = K extends LastLevelRouteKey
  253. ? Omit<ElegantConstRoute, 'children'> & {
  254. name: K;
  255. path: RouteMap[K];
  256. component: `view.${K}`;
  257. }
  258. : never;
  259. /**
  260. * the center level route
  261. */
  262. type CenterLevelRoute<K extends GeneratedRouteKey> = K extends CenterLevelRouteKey
  263. ? Omit<ElegantConstRoute, 'component'> & {
  264. name: K;
  265. path: RouteMap[K];
  266. children: (CenterLevelRoute<GetChildRouteKey<K>> | LastLevelRoute<GetChildRouteKey<K>>)[];
  267. }
  268. : never;
  269. /**
  270. * the multi level route
  271. */
  272. type MultiLevelRoute<K extends FirstLevelRouteNotSingleKey = FirstLevelRouteNotSingleKey> = K extends string
  273. ? ElegantConstRoute & {
  274. name: K;
  275. path: RouteMap[K];
  276. component: `layout.${RouteLayout}`;
  277. children: (CenterLevelRoute<GetChildRouteKey<K>> | LastLevelRoute<GetChildRouteKey<K>>)[];
  278. }
  279. : never;
  280. /**
  281. * the custom first level route
  282. */
  283. type CustomSingleLevelRoute<K extends CustomFirstLevelRouteKey = CustomFirstLevelRouteKey> = K extends string
  284. ? Omit<ElegantConstRoute, 'children'> & {
  285. name: K;
  286. path: RouteMap[K];
  287. component?: `layout.${RouteLayout}$view.${LastLevelRouteKey}`;
  288. }
  289. : never;
  290. /**
  291. * the custom last level route
  292. */
  293. type CustomLastLevelRoute<K extends CustomRouteKey> = K extends CustomLastLevelRouteKey
  294. ? Omit<ElegantConstRoute, 'children'> & {
  295. name: K;
  296. path: RouteMap[K];
  297. component?: `view.${LastLevelRouteKey}`;
  298. }
  299. : never;
  300. /**
  301. * the custom center level route
  302. */
  303. type CustomCenterLevelRoute<K extends CustomRouteKey> = K extends CustomCenterLevelRouteKey
  304. ? Omit<ElegantConstRoute, 'component'> & {
  305. name: K;
  306. path: RouteMap[K];
  307. children: (CustomCenterLevelRoute<GetChildRouteKey<K>> | CustomLastLevelRoute<GetChildRouteKey<K>>)[];
  308. }
  309. : never;
  310. /**
  311. * the custom multi level route
  312. */
  313. type CustomMultiLevelRoute<K extends CustomFirstLevelRouteNotSingleKey = CustomFirstLevelRouteNotSingleKey> =
  314. K extends string
  315. ? ElegantConstRoute & {
  316. name: K;
  317. path: RouteMap[K];
  318. component: `layout.${RouteLayout}`;
  319. children: (CustomCenterLevelRoute<GetChildRouteKey<K>> | CustomLastLevelRoute<GetChildRouteKey<K>>)[];
  320. }
  321. : never;
  322. /**
  323. * the custom route
  324. */
  325. type CustomRoute = CustomSingleLevelRoute | CustomMultiLevelRoute;
  326. /**
  327. * the generated route
  328. */
  329. type GeneratedRoute = SingleLevelRoute | MultiLevelRoute;
  330. /**
  331. * the elegant route
  332. */
  333. type ElegantRoute = GeneratedRoute | CustomRoute;
  334. }