kn-cli 1.0.90 → 1.0.92

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 (271) hide show
  1. package/package.json +1 -1
  2. package/readme.md +7 -0
  3. package/src/create.js +22 -2
  4. package/src/utils/index.js +1 -1
  5. package/templates/template_admin/cli.config.js +1 -1
  6. package/templates/template_admin/jsconfig.json +5 -1
  7. package/templates/template_admin/package.json +1 -1
  8. package/templates/template_admin/public/index.html +2 -2
  9. package/templates/template_admin/public/src/components/{Auth → auth}/index.jsx +21 -3
  10. package/templates/template_admin/public/src/components/{IconFont → iconFont}/index.jsx +10 -0
  11. package/templates/template_admin/public/src/components/{Layout/Basic → layout/basic}/index.jsx +13 -3
  12. package/templates/template_admin/public/src/components/layout/centerBody/index.jsx +25 -0
  13. package/templates/template_admin/public/src/components/{Layout → layout}/index.jsx +15 -6
  14. package/templates/template_admin/public/src/components/layout/provider/index.jsx +19 -0
  15. package/templates/{template_app/public/src/components/Link → template_admin/public/src/components/link}/index.jsx +15 -0
  16. package/templates/template_admin/public/src/components/{Menu → menu}/index.jsx +15 -8
  17. package/templates/{template_app/public/src/components/Page/PageLoading → template_admin/public/src/components/page/pageLoading}/index.jsx +25 -4
  18. package/templates/{template_app/public/src/components/Popup → template_admin/public/src/components/popup}/index.jsx +13 -0
  19. package/templates/template_admin/public/src/components/{Toast → toast}/index.jsx +20 -1
  20. package/templates/template_admin/public/src/components/{TopMenu → topMenu}/index.jsx +13 -8
  21. package/templates/template_admin/public/src/dictionary/index.js +8 -3
  22. package/templates/template_admin/public/src/hooks/index.jsx +1 -0
  23. package/templates/template_admin/public/src/hooks/useDelay.jsx +5 -0
  24. package/templates/template_admin/public/src/hooks/useImageLoader.jsx +1 -2
  25. package/templates/template_admin/public/src/hooks/useLoading.jsx +5 -1
  26. package/templates/template_admin/public/src/hooks/usePreload.jsx +2 -1
  27. package/templates/template_admin/public/src/hooks/useScrollTop.jsx +12 -0
  28. package/templates/template_admin/public/src/hooks/useSearch.jsx +28 -2
  29. package/templates/template_admin/public/src/hooks/useUpdate.jsx +5 -0
  30. package/templates/template_admin/public/src/index.jsx +16 -2
  31. package/templates/template_admin/public/src/pages/material/index.jsx +2 -1
  32. package/templates/template_admin/public/src/pages/user/index.jsx +7 -2
  33. package/templates/template_admin/public/src/provider/app.jsx +39 -4
  34. package/templates/template_admin/public/src/provider/menu.jsx +4 -1
  35. package/templates/template_admin/public/src/route.jsx +8 -5
  36. package/templates/template_admin/public/src/services/index.js +38 -4
  37. package/templates/template_admin/public/src/services/user.js +3 -3
  38. package/templates/template_admin/public/src/type.js +48 -0
  39. package/templates/template_admin/public/src/utils/index.js +34 -18
  40. package/templates/template_app/cli.config.js +1 -1
  41. package/templates/template_app/jsconfig.json +5 -1
  42. package/templates/template_app/package.json +1 -1
  43. package/templates/template_app/public/src/components/{Auth → auth}/index.jsx +20 -2
  44. package/templates/template_app/public/src/components/{Header → header}/index.jsx +25 -1
  45. package/templates/{template_oa_jwt/public/src/components/IconFont → template_app/public/src/components/iconFont}/index.jsx +10 -0
  46. package/templates/template_app/public/src/components/{Layout/App → layout/app}/index.jsx +12 -2
  47. package/templates/template_app/public/src/components/layout/index.jsx +6 -0
  48. package/templates/{template_admin/public/src/components/Layout/Provider → template_app/public/src/components/layout/provider}/index.jsx +3 -0
  49. package/templates/template_app/public/src/components/link/index.jsx +39 -0
  50. package/templates/template_app/public/src/components/{Marquee → marquee}/index.jsx +11 -2
  51. package/templates/{template_oa/public/src/components/Page/PageLoading → template_app/public/src/components/page/pageLoading}/index.jsx +23 -3
  52. package/templates/{template_oa_jwt/public/src/components/Popup → template_app/public/src/components/popup}/index.jsx +13 -0
  53. package/templates/{template_oa_jwt/public/src/components/Toast → template_app/public/src/components/toast}/index.jsx +21 -1
  54. package/templates/template_app/public/src/dictionary/index.js +7 -3
  55. package/templates/template_app/public/src/hooks/index.jsx +1 -0
  56. package/templates/template_app/public/src/hooks/useDelay.jsx +5 -0
  57. package/templates/template_app/public/src/hooks/useImageLoader.jsx +1 -2
  58. package/templates/template_app/public/src/hooks/useLoading.jsx +5 -1
  59. package/templates/template_app/public/src/hooks/usePreload.jsx +2 -1
  60. package/templates/template_app/public/src/hooks/useScrollTop.jsx +12 -0
  61. package/templates/template_app/public/src/index.jsx +22 -5
  62. package/templates/template_app/public/src/pages/dictionary/index.jsx +9 -1
  63. package/templates/template_app/public/src/pages/index.jsx +16 -4
  64. package/templates/template_app/public/src/pages/list/index.jsx +7 -1
  65. package/templates/template_app/public/src/pages/login/index.jsx +10 -4
  66. package/templates/template_app/public/src/pages/user/index.jsx +7 -2
  67. package/templates/template_app/public/src/provider/app.jsx +5 -3
  68. package/templates/template_app/public/src/route.jsx +5 -2
  69. package/templates/template_app/public/src/services/index.js +10 -8
  70. package/templates/template_app/public/src/services/user.js +4 -4
  71. package/templates/template_app/public/src/type.js +27 -0
  72. package/templates/template_app/public/src/utils/index.js +6 -0
  73. package/templates/template_oa/cli.config.js +1 -1
  74. package/templates/template_oa/jsconfig.json +5 -1
  75. package/templates/template_oa/package.json +1 -1
  76. package/templates/template_oa/public/src/components/dialog/index.jsx +237 -0
  77. package/templates/{template_oa_jwt/public/src/components/Empty → template_oa/public/src/components/empty}/index.jsx +9 -0
  78. package/templates/{template_oa_jwt/public/src/components/FormRow → template_oa/public/src/components/formRow}/index.jsx +25 -3
  79. package/templates/{template_oa_jwt/public/src/components/FormTable → template_oa/public/src/components/formTable}/index.jsx +39 -1
  80. package/templates/template_oa/public/src/components/iconFont/index.jsx +22 -0
  81. package/templates/template_oa/public/src/components/{IFrame → iframe}/index.jsx +18 -4
  82. package/templates/template_oa/public/src/components/{Layout/Basic → layout/basic}/index.jsx +7 -1
  83. package/templates/template_oa/public/src/components/{Layout/CenterBody → layout/centerBody}/index.jsx +2 -0
  84. package/templates/template_oa/public/src/components/{Layout/FormBlock → layout/formBlock}/index.jsx +3 -1
  85. package/templates/{template_oa_jwt/public/src/components/Layout → template_oa/public/src/components/layout}/index.jsx +12 -6
  86. package/templates/{template_oa_jwt/public/src/components/Layout/Provider → template_oa/public/src/components/layout/provider}/index.jsx +4 -0
  87. package/templates/{template_offcial/public/src/components/Link → template_oa/public/src/components/link}/index.jsx +16 -0
  88. package/templates/template_oa/public/src/components/{Nav → nav}/index.jsx +8 -2
  89. package/templates/{template_admin/public/src/components/Page/PageLoading → template_oa/public/src/components/page/pageLoading}/index.jsx +25 -4
  90. package/templates/{template_admin/public/src/components/Popup → template_oa/public/src/components/popup}/index.jsx +13 -0
  91. package/templates/{template_oa_jwt/public/src/components/Select/DepSelect → template_oa/public/src/components/select/depSelect}/index.jsx +15 -0
  92. package/templates/template_oa/public/src/components/{Select/StaffSelect → select/staffSelect}/index.jsx +27 -0
  93. package/templates/template_oa/public/src/components/title/index.jsx +3 -0
  94. package/templates/template_oa/public/src/components/{Toast → toast}/index.jsx +21 -1
  95. package/templates/template_oa/public/src/components/{Upload → upload}/index.jsx +41 -3
  96. package/templates/template_oa/public/src/hooks/index.jsx +1 -0
  97. package/templates/template_oa/public/src/hooks/useDelay.jsx +5 -0
  98. package/templates/template_oa/public/src/hooks/useImageLoader.jsx +1 -2
  99. package/templates/template_oa/public/src/hooks/useLoading.jsx +5 -1
  100. package/templates/template_oa/public/src/hooks/usePreload.jsx +2 -1
  101. package/templates/template_oa/public/src/hooks/useScrollTop.jsx +12 -0
  102. package/templates/template_oa/public/src/hooks/useSearch.jsx +28 -2
  103. package/templates/template_oa/public/src/hooks/useUpdate.jsx +5 -0
  104. package/templates/template_oa/public/src/index.jsx +15 -1
  105. package/templates/template_oa/public/src/pages/video/index.jsx +17 -13
  106. package/templates/template_oa/public/src/provider/app.jsx +33 -2
  107. package/templates/template_oa/public/src/route.jsx +4 -2
  108. package/templates/template_oa/public/src/services/common.js +11 -0
  109. package/templates/template_oa/public/src/services/index.js +44 -2
  110. package/templates/template_oa/public/src/type.js +48 -0
  111. package/templates/template_oa/public/src/utils/index.js +34 -17
  112. package/templates/template_oa_jwt/cli.config.js +1 -1
  113. package/templates/template_oa_jwt/jsconfig.json +5 -1
  114. package/templates/template_oa_jwt/package.json +1 -1
  115. package/templates/template_oa_jwt/public/src/components/dialog/index.jsx +237 -0
  116. package/templates/{template_oa/public/src/components/Empty → template_oa_jwt/public/src/components/empty}/index.jsx +9 -0
  117. package/templates/{template_oa/public/src/components/FormRow → template_oa_jwt/public/src/components/formRow}/index.jsx +25 -3
  118. package/templates/{template_oa/public/src/components/FormTable → template_oa_jwt/public/src/components/formTable}/index.jsx +41 -2
  119. package/templates/template_oa_jwt/public/src/components/formTable/index.less +18 -0
  120. package/templates/template_oa_jwt/public/src/components/iconFont/index.jsx +22 -0
  121. package/templates/template_oa_jwt/public/src/components/{IFrame → iframe}/index.jsx +15 -0
  122. package/templates/template_oa_jwt/public/src/components/{Layout/Basic → layout/basic}/index.jsx +11 -6
  123. package/templates/template_oa_jwt/public/src/components/{Layout/CenterBody → layout/centerBody}/index.jsx +2 -0
  124. package/templates/template_oa_jwt/public/src/components/{Layout/FormBlock → layout/formBlock}/index.jsx +3 -1
  125. package/templates/{template_oa/public/src/components/Layout → template_oa_jwt/public/src/components/layout}/index.jsx +10 -4
  126. package/templates/{template_oa/public/src/components/Layout/Provider → template_oa_jwt/public/src/components/layout/provider}/index.jsx +4 -0
  127. package/templates/template_oa_jwt/public/src/components/{Link → link}/index.jsx +16 -0
  128. package/templates/template_oa_jwt/public/src/components/{Nav → nav}/index.jsx +11 -5
  129. package/templates/template_oa_jwt/public/src/components/{Page/PageLoading → page/pageLoading}/index.jsx +25 -4
  130. package/templates/{template_oa/public/src/components/Popup → template_oa_jwt/public/src/components/popup}/index.jsx +13 -0
  131. package/templates/{template_oa/public/src/components/Select/DepSelect → template_oa_jwt/public/src/components/select/depSelect}/index.jsx +15 -0
  132. package/templates/template_oa_jwt/public/src/components/{Select/StaffSelect → select/staffSelect}/index.jsx +27 -0
  133. package/templates/template_oa_jwt/public/src/components/title/index.jsx +3 -0
  134. package/templates/template_oa_jwt/public/src/components/toast/index.jsx +80 -0
  135. package/templates/template_oa_jwt/public/src/components/{Upload → upload}/index.jsx +41 -3
  136. package/templates/template_oa_jwt/public/src/dictionary/index.js +2 -0
  137. package/templates/template_oa_jwt/public/src/hooks/index.jsx +2 -2
  138. package/templates/template_oa_jwt/public/src/hooks/useDelay.jsx +5 -0
  139. package/templates/template_oa_jwt/public/src/hooks/useImageLoader.jsx +1 -2
  140. package/templates/template_oa_jwt/public/src/hooks/useLoading.jsx +5 -1
  141. package/templates/template_oa_jwt/public/src/hooks/usePreload.jsx +2 -1
  142. package/templates/template_oa_jwt/public/src/hooks/useScrollTop.jsx +12 -0
  143. package/templates/template_oa_jwt/public/src/hooks/useSearch.jsx +28 -2
  144. package/templates/template_oa_jwt/public/src/hooks/useUpdate.jsx +5 -0
  145. package/templates/template_oa_jwt/public/src/pages/demo/index.jsx +17 -11
  146. package/templates/template_oa_jwt/public/src/provider/app.jsx +30 -1
  147. package/templates/template_oa_jwt/public/src/route.jsx +4 -2
  148. package/templates/template_oa_jwt/public/src/services/common.js +13 -1
  149. package/templates/template_oa_jwt/public/src/services/index.js +52 -8
  150. package/templates/template_oa_jwt/public/src/services/token.js +7 -0
  151. package/templates/template_oa_jwt/public/src/utils/index.js +62 -22
  152. package/templates/template_offcial/cli.config.js +1 -1
  153. package/templates/template_offcial/jsconfig.json +5 -1
  154. package/templates/template_offcial/package.json +1 -1
  155. package/templates/template_offcial/public/src/components/{Footer → footer}/index.jsx +15 -1
  156. package/templates/template_offcial/public/src/components/{Header → header}/index.jsx +14 -0
  157. package/templates/{template_app/public/src/components/IconFont → template_offcial/public/src/components/iconFont}/index.jsx +10 -0
  158. package/templates/template_offcial/public/src/components/{Layout → layout}/index.jsx +10 -3
  159. package/templates/{template_app/public/src/components/Layout/Provider → template_offcial/public/src/components/layout/provider}/index.jsx +7 -0
  160. package/templates/template_offcial/public/src/components/link/index.jsx +39 -0
  161. package/templates/template_offcial/public/src/components/page/pageLoading/index.jsx +51 -0
  162. package/templates/template_offcial/public/src/components/popup/index.jsx +35 -0
  163. package/templates/{template_app/public/src/components/Toast → template_offcial/public/src/components/toast}/index.jsx +20 -1
  164. package/templates/template_offcial/public/src/hooks/index.jsx +1 -0
  165. package/templates/template_offcial/public/src/hooks/useImageLoader.jsx +1 -0
  166. package/templates/template_offcial/public/src/hooks/useInToView.jsx +3 -0
  167. package/templates/template_offcial/public/src/hooks/usePreload.jsx +1 -0
  168. package/templates/template_offcial/public/src/hooks/useScroll.jsx +8 -0
  169. package/templates/template_offcial/public/src/index.jsx +15 -2
  170. package/templates/template_offcial/public/src/pages/index.jsx +8 -1
  171. package/templates/template_offcial/public/src/pages/pc/index.jsx +4 -2
  172. package/templates/template_offcial/public/src/provider/app.jsx +28 -2
  173. package/templates/template_offcial/public/src/route.jsx +4 -2
  174. package/templates/template_offcial/public/src/services/index.js +38 -2
  175. package/templates/template_offcial/public/src/services/user.js +3 -3
  176. package/templates/template_offcial/public/src/type.js +47 -0
  177. package/templates/template_admin/public/src/components/Alert/index.jsx +0 -0
  178. package/templates/template_admin/public/src/components/Alert/index.less +0 -0
  179. package/templates/template_admin/public/src/components/Header/index.jsx +0 -57
  180. package/templates/template_admin/public/src/components/Layout/CenterBody/index.jsx +0 -15
  181. package/templates/template_admin/public/src/components/Link/index.jsx +0 -24
  182. package/templates/template_admin/public/src/components/Loading/index.jsx +0 -14
  183. package/templates/template_admin/public/src/components/Loading/index.less +0 -85
  184. package/templates/template_admin/public/src/components/mask/index.jsx +0 -47
  185. package/templates/template_admin/public/src/components/mask/index.less +0 -32
  186. package/templates/template_admin/public/src/hooks/useLogin.jsx +0 -33
  187. package/templates/template_app/public/src/components/Header/index.less +0 -57
  188. package/templates/template_app/public/src/components/Layout/index.jsx +0 -4
  189. package/templates/template_app/public/src/hooks/useLogin.jsx +0 -33
  190. package/templates/template_oa/public/src/components/Alert/index.jsx +0 -0
  191. package/templates/template_oa/public/src/components/Alert/index.less +0 -0
  192. package/templates/template_oa/public/src/components/Auth/index.jsx +0 -44
  193. package/templates/template_oa/public/src/components/Dialog/index.jsx +0 -150
  194. package/templates/template_oa/public/src/components/Footer/index.jsx +0 -17
  195. package/templates/template_oa/public/src/components/Footer/index.less +0 -28
  196. package/templates/template_oa/public/src/components/IconFont/index.jsx +0 -10
  197. package/templates/template_oa/public/src/components/Link/index.jsx +0 -24
  198. package/templates/template_oa/public/src/components/Loading/index.jsx +0 -14
  199. package/templates/template_oa/public/src/components/Loading/index.less +0 -85
  200. package/templates/template_oa_jwt/public/src/components/Alert/index.jsx +0 -0
  201. package/templates/template_oa_jwt/public/src/components/Alert/index.less +0 -0
  202. package/templates/template_oa_jwt/public/src/components/Auth/index.jsx +0 -44
  203. package/templates/template_oa_jwt/public/src/components/Dialog/index.jsx +0 -150
  204. package/templates/template_oa_jwt/public/src/components/Footer/index.jsx +0 -17
  205. package/templates/template_oa_jwt/public/src/components/Footer/index.less +0 -28
  206. package/templates/template_oa_jwt/public/src/components/Loading/index.jsx +0 -16
  207. package/templates/template_oa_jwt/public/src/components/Loading/index.less +0 -96
  208. package/templates/template_offcial/public/src/components/Alert/index.jsx +0 -0
  209. package/templates/template_offcial/public/src/components/Alert/index.less +0 -0
  210. package/templates/template_offcial/public/src/components/IconFont/index.jsx +0 -10
  211. package/templates/template_offcial/public/src/components/Layout/Provider/index.jsx +0 -12
  212. package/templates/template_offcial/public/src/components/Page/PageLoading/index.jsx +0 -30
  213. package/templates/template_offcial/public/src/components/Popup/index.jsx +0 -22
  214. package/templates/template_offcial/public/src/components/Toast/index.jsx +0 -60
  215. /package/templates/template_admin/public/src/components/{IconFont → iconFont}/index.less +0 -0
  216. /package/templates/template_admin/public/src/components/{Layout/Basic → layout/basic}/index.less +0 -0
  217. /package/templates/template_admin/public/src/components/{Layout/CenterBody → layout/centerBody}/index.less +0 -0
  218. /package/templates/template_admin/public/src/components/{Layout → layout}/index.less +0 -0
  219. /package/templates/template_admin/public/src/components/{Link → link}/index.less +0 -0
  220. /package/templates/template_admin/public/src/components/{Menu → menu}/index.less +0 -0
  221. /package/templates/template_admin/public/src/components/{Page/PageLoading → page/pageLoading}/index.less +0 -0
  222. /package/templates/template_admin/public/src/components/{Popup → popup}/index.less +0 -0
  223. /package/templates/template_admin/public/src/components/{Toast → toast}/index.less +0 -0
  224. /package/templates/template_admin/public/src/components/{TopMenu → topMenu}/index.less +0 -0
  225. /package/templates/{template_admin/public/src/components/Header → template_app/public/src/components/header}/index.less +0 -0
  226. /package/templates/template_app/public/src/components/{IconFont → iconFont}/index.less +0 -0
  227. /package/templates/template_app/public/src/components/{Layout/App → layout/app}/index.less +0 -0
  228. /package/templates/template_app/public/src/components/{Link → link}/index.less +0 -0
  229. /package/templates/template_app/public/src/components/{Marquee → marquee}/index.less +0 -0
  230. /package/templates/template_app/public/src/components/{Page/PageLoading → page/pageLoading}/index.less +0 -0
  231. /package/templates/template_app/public/src/components/{Popup → popup}/index.less +0 -0
  232. /package/templates/template_app/public/src/components/{Toast → toast}/index.less +0 -0
  233. /package/templates/template_oa/public/src/components/{Dialog → dialog}/index.less +0 -0
  234. /package/templates/template_oa/public/src/components/{Empty → empty}/index.less +0 -0
  235. /package/templates/template_oa/public/src/components/{FormRow → formRow}/index.less +0 -0
  236. /package/templates/{template_oa_jwt/public/src/components/FormTable → template_oa/public/src/components/formTable}/index.less +0 -0
  237. /package/templates/template_oa/public/src/components/{IconFont → iconFont}/index.less +0 -0
  238. /package/templates/template_oa/public/src/components/{IFrame → iframe}/index.less +0 -0
  239. /package/templates/template_oa/public/src/components/{Layout/Basic → layout/basic}/index.less +0 -0
  240. /package/templates/template_oa/public/src/components/{Layout/CenterBody → layout/centerBody}/index.less +0 -0
  241. /package/templates/template_oa/public/src/components/{Layout/FormBlock → layout/formBlock}/index.less +0 -0
  242. /package/templates/template_oa/public/src/components/{Layout → layout}/index.less +0 -0
  243. /package/templates/template_oa/public/src/components/{Link → link}/index.less +0 -0
  244. /package/templates/template_oa/public/src/components/{Nav → nav}/index.less +0 -0
  245. /package/templates/template_oa/public/src/components/{Page/PageLoading → page/pageLoading}/index.less +0 -0
  246. /package/templates/template_oa/public/src/components/{Popup → popup}/index.less +0 -0
  247. /package/templates/template_oa/public/src/components/{Select/StaffSelect → select/staffSelect}/index.less +0 -0
  248. /package/templates/template_oa/public/src/components/{Toast → toast}/index.less +0 -0
  249. /package/templates/template_oa_jwt/public/src/components/{Dialog → dialog}/index.less +0 -0
  250. /package/templates/template_oa_jwt/public/src/components/{Empty → empty}/index.less +0 -0
  251. /package/templates/template_oa_jwt/public/src/components/{FormRow → formRow}/index.less +0 -0
  252. /package/templates/template_oa_jwt/public/src/components/{IconFont → iconFont}/index.less +0 -0
  253. /package/templates/template_oa_jwt/public/src/components/{IFrame → iframe}/index.less +0 -0
  254. /package/templates/template_oa_jwt/public/src/components/{Layout/Basic → layout/basic}/index.less +0 -0
  255. /package/templates/template_oa_jwt/public/src/components/{Layout/CenterBody → layout/centerBody}/index.less +0 -0
  256. /package/templates/template_oa_jwt/public/src/components/{Layout/FormBlock → layout/formBlock}/index.less +0 -0
  257. /package/templates/template_oa_jwt/public/src/components/{Layout → layout}/index.less +0 -0
  258. /package/templates/template_oa_jwt/public/src/components/{Link → link}/index.less +0 -0
  259. /package/templates/template_oa_jwt/public/src/components/{Nav → nav}/index.less +0 -0
  260. /package/templates/template_oa_jwt/public/src/components/{Page/PageLoading → page/pageLoading}/index.less +0 -0
  261. /package/templates/template_oa_jwt/public/src/components/{Popup → popup}/index.less +0 -0
  262. /package/templates/template_oa_jwt/public/src/components/{Select/StaffSelect → select/staffSelect}/index.less +0 -0
  263. /package/templates/template_oa_jwt/public/src/components/{Toast → toast}/index.less +0 -0
  264. /package/templates/template_offcial/public/src/components/{Footer → footer}/index.less +0 -0
  265. /package/templates/template_offcial/public/src/components/{Header → header}/index.less +0 -0
  266. /package/templates/template_offcial/public/src/components/{IconFont → iconFont}/index.less +0 -0
  267. /package/templates/template_offcial/public/src/components/{Layout → layout}/index.less +0 -0
  268. /package/templates/template_offcial/public/src/components/{Link → link}/index.less +0 -0
  269. /package/templates/template_offcial/public/src/components/{Page/PageLoading → page/pageLoading}/index.less +0 -0
  270. /package/templates/template_offcial/public/src/components/{Popup → popup}/index.less +0 -0
  271. /package/templates/template_offcial/public/src/components/{Toast → toast}/index.less +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kn-cli",
3
- "version": "1.0.90",
3
+ "version": "1.0.92",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -140,6 +140,13 @@ report
140
140
 
141
141
 
142
142
  # 更新日志
143
+ * 1.0.92
144
+ 所有模版文件夹首字母大写问题修正
145
+
146
+ * 1.0.91
147
+ 创建项目时自动将项目名称设置为当前文件夹的名称
148
+ 模版内doc注释规范化、文件夹首字母大写更正
149
+
143
150
  * 1.0.90
144
151
  优化在hashMode=false的情况下,html内引用js、css资源时在尾部增加v=版本号
145
152
 
package/src/create.js CHANGED
@@ -2,7 +2,7 @@
2
2
  const chalk= require("chalk");
3
3
  const path= require( "path");
4
4
  const {Listr} = require('listr2');
5
- const {TaskNodeVersion,copyDir}= require('./utils');
5
+ const {TaskNodeVersion,copyDir,replaceFileData}= require('./utils');
6
6
  const inquirer = require('inquirer');
7
7
  const ROOT=path.resolve(__dirname,"../");
8
8
 
@@ -13,6 +13,7 @@ const ROOT=path.resolve(__dirname,"../");
13
13
  */
14
14
  module.exports=async ()=> {
15
15
  const sourceDir = process.cwd();
16
+ const project_name = path.parse(sourceDir).base;//新建的项目名称以当前文件夹名为名
16
17
  const templatesDir = path.resolve(ROOT,"templates");
17
18
  let templateName='';
18
19
  const answer = await inquirer.prompt([
@@ -51,7 +52,26 @@ module.exports=async ()=> {
51
52
  },
52
53
  {
53
54
  title: "项目创建中",
54
- task: () => copyDir(path.resolve(templatesDir,templateName),sourceDir)
55
+ task: async () => {
56
+ const project_dir = path.resolve(templatesDir,templateName);
57
+ // 将模版复制到目标目录
58
+ const req= await copyDir(project_dir,sourceDir);
59
+ if(req){
60
+ // 替换工程名称
61
+ const cliConfigName = path.resolve(sourceDir,'cli.config.js');
62
+ const packageConfigName = path.resolve(sourceDir,'package.json');
63
+ await replaceFileData(cliConfigName,function(data){
64
+ data = data.replace(/projectName/ig,project_name);
65
+ return data;
66
+ });
67
+ await replaceFileData(packageConfigName,function(data){
68
+ data = data.replace(/projectName/ig,project_name);
69
+ return data;
70
+ });
71
+ return true;
72
+ }
73
+ return false;
74
+ }
55
75
  },
56
76
  ]);
57
77
  try{
@@ -12,7 +12,7 @@ module.exports = {
12
12
  if(err){
13
13
  throw new Error(err);
14
14
  }
15
- resolve();
15
+ resolve(true);
16
16
  })
17
17
  })
18
18
  },
@@ -1,6 +1,6 @@
1
1
 
2
2
  module.exports = {
3
- name:'template-admin',
3
+ name:'projectName',
4
4
  registryType:'npm',//npm镜像源,taobao|npm
5
5
  less:{
6
6
  javascriptEnabled:true,//是否开启less js
@@ -3,8 +3,12 @@
3
3
  "baseUrl": ".",
4
4
  "emitDecoratorMetadata": true,
5
5
  "experimentalDecorators": true,
6
+ "lib": ["dom", "ES2021"],
7
+ "allowJs":true,
8
+ "checkJs": true,
9
+ "jsx": "react",
6
10
  "paths": {
7
11
  "@/*": ["./public/src/*"]
8
- }
12
+ },
9
13
  }
10
14
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "template_admin",
2
+ "name": "projectName",
3
3
  "version": "1.0.0",
4
4
  "main": "lib/index",
5
5
  "scripts": {
@@ -21,8 +21,8 @@
21
21
  var docEl = document.documentElement;
22
22
  function setRemUnit(type) {
23
23
  let w = Math.max(window.innerWidth, docEl.clientWidth, docEl.offsetWidth);
24
- let defaultWidth = 375;//填入设计稿上的宽度
25
- w = w > defaultWidth ? defaultWidth : w;
24
+ let defaultWidth = 1200;//填入设计稿上的宽度
25
+ // w = w > defaultWidth ? defaultWidth : w;
26
26
  var rem = w / defaultWidth * 100;
27
27
  docEl.style.fontSize = rem + 'px'
28
28
  }
@@ -1,8 +1,19 @@
1
+ // @ts-ignore
1
2
  import React, { useEffect, useState } from 'react';
2
- import ProviderApp from '@/provider/app';
3
+ // @ts-ignore
3
4
  import { useNavigate } from 'react-router-dom';
4
- import {useLoading} from '@/hooks';
5
5
 
6
+ import ProviderApp from '@/provider/app';
7
+ import {useLoading} from '@/hooks/index';
8
+
9
+ /**
10
+ * 检查用户是否带有某个权限
11
+ * @param {object} props
12
+ * @param {string} [props.name] - 权限的名称
13
+ * @param {JSX.Element} [props.children] - 子组件
14
+ *
15
+ * @returns {JSX.Element}
16
+ */
6
17
  export const AuthShow=(props)=>{
7
18
  const {name} = props;
8
19
  const app = ProviderApp.useContainer();
@@ -12,6 +23,13 @@ export const AuthShow=(props)=>{
12
23
  return <></>
13
24
  }
14
25
 
26
+ /**
27
+ * 用户登录态校验
28
+ * @param {object} props
29
+ * @param {JSX.Element} [props.children] - 当登录校验合法后显示的子组件
30
+ *
31
+ * @returns {JSX.Element}
32
+ */
15
33
  export const AuthLogin=(props)=>{
16
34
  const navigate = useNavigate();
17
35
  const [pass,setPass] = useState(false)
@@ -32,7 +50,7 @@ export const AuthLogin=(props)=>{
32
50
  navigate('/superAdminLogin');
33
51
  }
34
52
  }
35
- useEffect(check,[]);
53
+ useEffect(()=>{check()},[]);
36
54
 
37
55
  if(pass){
38
56
  return props.children;
@@ -1,6 +1,16 @@
1
+ // @ts-ignore
1
2
  import React from "react";
3
+ // @ts-ignore
2
4
  import styles from'./index.less';
3
5
 
6
+ /**
7
+ * iconFont图标
8
+ * @param {object} props
9
+ * @param {string} [props.icon] - 图标名称
10
+ * @param {string} [props.className] - 扩展类名
11
+ *
12
+ * @returns {JSX.Element}
13
+ */
4
14
  const IconFont=(props)=>{
5
15
  const {icon,className,...others} = props;
6
16
  return (
@@ -1,13 +1,23 @@
1
+ // @ts-ignore
1
2
  import React from 'react';
3
+ // @ts-ignore
2
4
  import {Outlet} from 'react-router-dom';
3
- import {LayoutCenterBody} from '@/components/Layout';
4
5
 
6
+ import {LayoutCenterBody} from '@/components/layout';
5
7
 
8
+ // @ts-ignore
6
9
  import styles from './index.less';
7
10
 
8
-
11
+ /**
12
+ * 基础页面框架
13
+ * @param {object} props
14
+ * @param {JSX.Element} [props.nav] - 左侧导航栏组件
15
+ * @param {JSX.Element} [props.topMenu] - 顶部导航栏组件
16
+ *
17
+ * @returns {JSX.Element}
18
+ */
9
19
  const LayoutBasic=(props)=>{
10
- const {className,nav="",topMenu=""} = props;
20
+ const {nav="",topMenu=""} = props;
11
21
  return (
12
22
  <LayoutCenterBody layout='x-center'>
13
23
  <section className={styles.wrap} >
@@ -0,0 +1,25 @@
1
+ // @ts-ignore
2
+ import React from 'react';
3
+
4
+ // @ts-ignore
5
+ import styles from './index.less';
6
+
7
+ /**
8
+ * 居中定位的layout
9
+ * @param {object} props
10
+ * @param {string} [props.className] - 扩展类样式
11
+ * @param {string} [props.layout='normal'] - 布局样式,xy-center|x-center|y-center
12
+ * @param {JSX.Element|string} [props.children] - 容器内的子组件
13
+ *
14
+ * @returns {JSX.Element}
15
+ */
16
+ const LayoutCenterBody=(props)=>{
17
+ const {className,layout='normal'} = props;
18
+
19
+ return (
20
+ <section data-layout={layout} className={ className?`${styles.contentBody} ${className}`:styles.contentBody }>
21
+ {props.children}
22
+ </section>
23
+ )
24
+ }
25
+ export default LayoutCenterBody;
@@ -1,16 +1,25 @@
1
+ // @ts-ignore
1
2
  import React from 'react';
2
- import ProviderApp from '@/provider/app';
3
-
3
+ // @ts-ignore
4
4
  import {Outlet} from 'react-router-dom';
5
+ // @ts-ignore
5
6
  import { ConfigProvider } from 'antd';
6
- import LayoutBasic from './Basic';
7
- import LayoutCenterBody from './CenterBody';
7
+ // @ts-ignore
8
8
  import zhCN from 'antd/lib/locale/zh_CN';
9
9
 
10
+ import ProviderApp from '@/provider/app';
11
+ import LayoutBasic from './basic/index';
12
+ import LayoutCenterBody from './centerBody/index';
13
+
14
+ // @ts-ignore
10
15
  import styles from './index.less';
11
16
 
12
- // 站点最基础的layout,用于控制一些全局环境变量
13
- const Layout = (props) => {
17
+ /**
18
+ * 页面根框架,用于注入各类provider
19
+ *
20
+ * @returns {JSX.Element}
21
+ */
22
+ const Layout = () => {
14
23
  return (
15
24
  <ProviderApp.Provider>
16
25
  <ConfigProvider locale={zhCN}>
@@ -0,0 +1,19 @@
1
+ // @ts-ignore
2
+ import React from 'react';
3
+ // @ts-ignore
4
+ import {Outlet} from 'react-router-dom';
5
+
6
+ import ProviderApp from '@/provider/app';
7
+
8
+ /**
9
+ * 注入AppProvider
10
+ * @returns {JSX.Element}
11
+ */
12
+ const LayoutProvider=()=>{
13
+ return (
14
+ <ProviderApp.Provider>
15
+ <Outlet />
16
+ </ProviderApp.Provider>
17
+ )
18
+ }
19
+ export default LayoutProvider;
@@ -1,7 +1,22 @@
1
+ // @ts-ignore
1
2
  import React from 'react';
3
+
2
4
  import { openLink } from '@/utils';
5
+
6
+ // @ts-ignore
3
7
  import styles from './index.less';
4
8
 
9
+ /**
10
+ * 超链接组件
11
+ * @param {object} [props]
12
+ * @param {JSX.Element|string} [props.children] - 子组件
13
+ * @param {string} [props.className] - 扩展类样式名称
14
+ * @param {Function} [props.onClick] - 点击链接的回调
15
+ * @param {string} [props.href] - 跳转链接
16
+ * @param {string} [props.target] - 当target='_blank'时代表新窗口打开
17
+ *
18
+ * @returns {JSX.Element}
19
+ */
5
20
  const Link=(props)=>{
6
21
  const {children,className='',onClick,href='',target=''} = props;
7
22
 
@@ -1,12 +1,16 @@
1
-
2
- import { Menu } from 'antd';
1
+ // @ts-ignore
3
2
  import React, { useEffect, useRef, useState } from 'react';
3
+ // @ts-ignore
4
+ import { Menu } from 'antd';
5
+ // @ts-ignore
4
6
  import {matchPath,useLocation,useNavigate,} from 'react-router-dom';
7
+ // @ts-ignore
5
8
  import { AppstoreOutlined, MailOutlined, SettingOutlined } from '@ant-design/icons';
6
- import {useDelay,useLoading} from '@/hooks';
7
- import ProviderMenu from '@/provider/menu';
8
9
 
10
+ import {useLoading} from '@/hooks/index';
11
+ import ProviderMenu from '@/provider/menu';
9
12
 
13
+ // @ts-ignore
10
14
  import styles from './index.less';
11
15
 
12
16
  const ICON_NAME={
@@ -17,11 +21,14 @@ const ICON_NAME={
17
21
 
18
22
 
19
23
 
20
-
21
- const LeftMenu=(props)=>{
24
+ /**
25
+ * 左侧导航栏的demo组件
26
+ *
27
+ * @returns {JSX.Element}
28
+ */
29
+ const LeftMenu=()=>{
22
30
 
23
31
  const providerMenu = ProviderMenu.useContainer();
24
- const delay = useDelay();
25
32
  const loader = useLoading();
26
33
  const [menus,setMenus] = useState([]);
27
34
  const [openKeys,setOpenKeys] = useState([]);
@@ -54,7 +61,7 @@ const LeftMenu=(props)=>{
54
61
  return item;
55
62
  }
56
63
 
57
-
64
+ // @ts-ignore
58
65
  window.matchPath=matchPath;
59
66
 
60
67
 
@@ -1,13 +1,27 @@
1
- import React,{useEffect, useState} from 'react';
1
+ // @ts-ignore
2
+ import React from 'react';
3
+ // @ts-ignore
2
4
  import ReactDOM from 'react-dom';
3
- import CSS from './index.less';
4
- import Popup from '@/components/Popup';
5
+
6
+ import Popup from '@/components/popup';
7
+
8
+ // @ts-ignore
5
9
  import imgLoading from '@/assets/images/loading.svg';
6
10
 
11
+ // @ts-ignore
12
+ import CSS from './index.less';
13
+
14
+ /**
15
+ * 页面Loading状态
16
+ * @param {object} [props]
17
+ * @param {boolean} [props.visible=true] - 是否显示状态
18
+ *
19
+ * @returns {JSX.Element}
20
+ */
7
21
  const PageLoading = (props) => {
8
22
  const {visible=true} = props;
9
23
  if(!visible){
10
- return '';
24
+ return <></>;
11
25
  }
12
26
  return (
13
27
  <div className={CSS.wrap } >
@@ -18,6 +32,13 @@ const PageLoading = (props) => {
18
32
  );
19
33
  };
20
34
 
35
+ /**
36
+ * 全屏置顶显示一个页面loading组件
37
+ * @param {object} [props]
38
+ * @param {boolean} [props.canTouch=false] - 是否允许用户点击屏幕穿透到下面的组件
39
+ *
40
+ * @returns {(string)=>void}
41
+ */
21
42
  export const ShowPageLoading=(props={canTouch:false})=>{
22
43
  let popup = Popup(()=>{},{cantouch:props.canTouch});
23
44
  ReactDOM.render(
@@ -1,8 +1,21 @@
1
+ // @ts-ignore
1
2
  import React from 'react';
3
+ // @ts-ignore
2
4
  import ReactDOM from 'react-dom';
5
+
6
+ // @ts-ignore
3
7
  import styles from './index.less';
4
8
  styles;
5
9
 
10
+ /**
11
+ * 一个全屏置顶的遮罩层
12
+ * @param {(result)=>void} reslove - 遮罩层的关闭回调
13
+ * @param {Object} [options] - 参数
14
+ * @param {boolean} [options.cantouch=false] - 是否允许被点击穿透
15
+ * @param {boolean} [options.transparent=false] - 是否遮罩层完全透明
16
+ *
17
+ * @returns { {dom:HTMLElement,destory:()=>void} }
18
+ */
6
19
  const Popup = (reslove,options) => {
7
20
  let rootDom = document.createElement('div');
8
21
  rootDom.className='popup-box';
@@ -1,7 +1,13 @@
1
+ // @ts-ignore
1
2
  import React,{useEffect} from 'react';
3
+ // @ts-ignore
2
4
  import ReactDOM from 'react-dom';
5
+
6
+ // @ts-ignore
7
+ import Popup from '@/components/popup';
8
+
9
+ // @ts-ignore
3
10
  import styles from './index.less';
4
- import Popup from '@/components/Popup/index.jsx';
5
11
 
6
12
  const toastList=[];
7
13
  const runNext=()=>{
@@ -43,12 +49,25 @@ const Toast=props=>{
43
49
  )
44
50
  }
45
51
 
52
+ /**
53
+ * @typedef {object} ToastOptions
54
+ * @property {string} message - 吐司文案内容
55
+ * @property {number} [delay=2000] - 持续时间,毫秒
56
+ * @property {string} [position] - 显示位置,center|top|bottom
57
+ * @property {Function} [resolve] - 显示完毕的回调
58
+ */
46
59
 
60
+ /**
61
+ * 显示一个吐司信息
62
+ * @param {ToastOptions|string} [props] - 文案内容或一个配置参数
63
+ * @returns { Promise }
64
+ */
47
65
  const ShowToast=props=>{
48
66
  if(typeof props === 'string'){
49
67
  props = {message:props}
50
68
  }
51
69
  return new Promise((resolve) => {
70
+ // @ts-ignore
52
71
  props.resolve = resolve;
53
72
  toastList.push(props);
54
73
  if(toastList.length===1){
@@ -1,15 +1,20 @@
1
+ // @ts-ignore
1
2
  import React, { useState,useEffect, useRef} from 'react';
3
+ // @ts-ignore
2
4
  import { matchPath,useLocation,useNavigate } from 'react-router-dom';
3
-
4
-
5
+ // @ts-ignore
5
6
  import { LogoutOutlined, UserOutlined } from '@ant-design/icons';
6
- import imgAvatar from '@/assets/images/avatar.png';
7
- import { Menu,Dropdown } from 'antd'
7
+ // @ts-ignore
8
+ import { Menu,Dropdown } from 'antd';
9
+
8
10
  import ProviderApp from '@/provider/app';
9
11
  import ProviderMenu from '@/provider/menu';
10
- import styles from './index.less';
11
12
  import {GET_MENU} from '@/services/auth';
12
13
 
14
+ // @ts-ignore
15
+ import imgAvatar from '@/assets/images/avatar.png';
16
+ // @ts-ignore
17
+ import styles from './index.less';
13
18
 
14
19
  /**
15
20
  * 菜单下的隐藏子路由集
@@ -53,9 +58,9 @@ const SUB_MENU_CONFIG=[
53
58
  左侧导航栏数据为顶部导航栏数据的menus内子项{label,icon,children}组成
54
59
  routeTemplate用来识别动态参数的路由,同前端本地路由配置同步即可
55
60
  当顶部导航栏只有一项时,将自动隐藏顶部导航菜单
56
- * @returns
61
+ * @returns {JSX.Element}
57
62
  */
58
- const TopMenu=(props)=>{
63
+ const TopMenu=()=>{
59
64
  const app = ProviderApp.useContainer();
60
65
  const providerMenu = ProviderMenu.useContainer();
61
66
  const curRoute = useLocation();
@@ -187,7 +192,7 @@ const TopMenu=(props)=>{
187
192
  setSelectedKeys([]);
188
193
  providerMenu.setMenus([]);
189
194
  }
190
- useEffect(loadMenu,[]);
195
+ useEffect(()=>{loadMenu()},[]);
191
196
 
192
197
  useEffect(()=>{
193
198
  reloadOpenMenu();
@@ -1,8 +1,12 @@
1
1
 
2
- import React, { useState, useEffect,useMemo} from 'react';
3
- import {GET_USER_TYPE} from '@/services/user';
2
+ // @ts-ignore
3
+ import React from 'react';
4
+ // @ts-ignore
4
5
  import {useDictionary} from 'kn-hooks';
5
- import ShowToast from '@/components/Toast';
6
+
7
+ import {GET_USER_TYPE} from '@/services/user';
8
+ import ShowToast from '@/components/toast';
9
+
6
10
  export const SelectOption=(props)=>{
7
11
  const {value}=props;
8
12
  const name = props['data-keyname'];
@@ -10,6 +14,7 @@ export const SelectOption=(props)=>{
10
14
  ShowToast(`点击option name=${name},value=${value},label=${props.children}`)
11
15
  if(props.onClick)props.onClick();
12
16
  }
17
+ // @ts-ignore
13
18
  return <hgroup onClick={onClick} key={value} name={name} value={value}>{props.children}</hgroup>
14
19
  }
15
20
 
@@ -6,6 +6,7 @@ import usePreload from './usePreload';
6
6
  import useSearch from './useSearch';
7
7
  import useUpdate from './useUpdate';
8
8
  import useLoading from './useLoading';
9
+ // @ts-ignore
9
10
  import {usePagination,usePaginationWithForm} from 'kn-hooks';
10
11
 
11
12
  export {
@@ -1,18 +1,23 @@
1
+ // @ts-ignore
1
2
  import { useRef,useState,useMemo, useEffect } from 'react';
2
3
 
3
4
  const useDelay=()=>{
4
5
  const [loading,setLoading] = useState(false);
5
6
  const refSet = useRef();
7
+ // @ts-ignore
6
8
  refSet.current = setLoading;
7
9
  useEffect(()=>{
10
+ // @ts-ignore
8
11
  refSet.current = setLoading;
9
12
  },[setLoading]);
10
13
 
11
14
  const actions=useMemo(()=>{
12
15
  const wait=(ms)=>{
16
+ // @ts-ignore
13
17
  refSet.current(true);
14
18
  return new Promise(res=>{
15
19
  setTimeout(()=>{
20
+ // @ts-ignore
16
21
  refSet.current(false);
17
22
  res();
18
23
  }, ms);
@@ -1,7 +1,6 @@
1
+ // @ts-ignore
1
2
  import React, { useEffect,useState,useMemo } from 'react';
2
3
 
3
-
4
-
5
4
  const useImageLoader=(img_src)=>{
6
5
  const [src,setSrc] = useState('');
7
6
  useEffect(() => {
@@ -1,5 +1,7 @@
1
+ // @ts-ignore
1
2
  import { useRef,useState, useEffect } from 'react';
2
- import {ShowPageLoading} from '@/components/Page/PageLoading';
3
+
4
+ import {ShowPageLoading} from '@/components/page/pageLoading';
3
5
 
4
6
  const useLoading=(props={})=>{
5
7
  const {canTouch=false} = props;
@@ -20,10 +22,12 @@ const useLoading=(props={})=>{
20
22
  useEffect(()=>{
21
23
  if(count > 0 ){
22
24
  if(!refPageLoading.current){
25
+ // @ts-ignore
23
26
  refPageLoading.current = ShowPageLoading({canTouch:canTouch});
24
27
  }
25
28
  }else{
26
29
  if(refPageLoading.current){
30
+ // @ts-ignore
27
31
  refPageLoading.current();//销毁
28
32
  refPageLoading.current=null;
29
33
  }
@@ -1,4 +1,5 @@
1
- import React, { useEffect,useState,useMemo,useRef,useCallback } from 'react';
1
+ // @ts-ignore
2
+ import React, { useState,useMemo,useCallback } from 'react';
2
3
 
3
4
  const usePreload=(files)=>{
4
5
  const [list] = useState(files);
@@ -1,8 +1,19 @@
1
+ // @ts-ignore
1
2
  import { useState, useMemo, useEffect } from 'react'
3
+ // @ts-ignore
2
4
  import { createContainer } from 'unstated-next'
3
5
 
6
+ /**
7
+ * @typedef {[HTMLElement,Function]} UseStateElement
8
+ */
9
+
10
+
4
11
  const useActivity = () => {
5
12
  const [scrollTop, setScrollTop] = useState(0);
13
+
14
+ /**
15
+ * @type UseStateElement
16
+ */
6
17
  const [containerNode, setContainerNode] = useState();
7
18
  const [clientHeight, setClientHeight] = useState(0);
8
19
  const [titleRefs, setTitleRefs] = useState({});
@@ -12,6 +23,7 @@ const useActivity = () => {
12
23
  setContainerNode(node);
13
24
  setClientHeight(node.clientHeight)
14
25
  node.addEventListener('scroll', (e) => {
26
+ // @ts-ignore
15
27
  setScrollTop(e.target.scrollTop);
16
28
  })
17
29
  }, [])