@origen-ui/admin-cli 1.0.0

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 (430) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +17 -0
  3. package/bin/og-admin.mjs +131 -0
  4. package/package.json +28 -0
  5. package/templates/current/clean/.codebuddy/AGENTS.md +18 -0
  6. package/templates/current/clean/.codebuddy/rules/01-feature-architecture.md +12 -0
  7. package/templates/current/clean/.codebuddy/rules/02-vue-typescript.md +12 -0
  8. package/templates/current/clean/.codebuddy/rules/03-component-policy.md +30 -0
  9. package/templates/current/clean/.codebuddy/rules/04-api-auth-router.md +12 -0
  10. package/templates/current/clean/.codebuddy/rules/05-style.md +12 -0
  11. package/templates/current/clean/.codebuddy/rules/06-quality.md +12 -0
  12. package/templates/current/clean/.codebuddy/skills/build-admin-feature/SKILL.md +17 -0
  13. package/templates/current/clean/.codebuddy/skills/style-og-origen-ui/SKILL.md +14 -0
  14. package/templates/current/clean/.codebuddy/skills/use-og-dialog/SKILL.md +15 -0
  15. package/templates/current/clean/.codebuddy/skills/use-og-editor/SKILL.md +28 -0
  16. package/templates/current/clean/.codebuddy/skills/use-og-form/SKILL.md +15 -0
  17. package/templates/current/clean/.codebuddy/skills/use-og-form-table/SKILL.md +28 -0
  18. package/templates/current/clean/.codebuddy/skills/use-og-http/SKILL.md +16 -0
  19. package/templates/current/clean/.codebuddy/skills/use-og-router-tabs/SKILL.md +14 -0
  20. package/templates/current/clean/.codebuddy/skills/use-og-search/SKILL.md +17 -0
  21. package/templates/current/clean/.codebuddy/skills/use-og-table/SKILL.md +19 -0
  22. package/templates/current/clean/.codebuddy/skills/use-og-upload/SKILL.md +28 -0
  23. package/templates/current/clean/.codex/AGENTS.md +15 -0
  24. package/templates/current/clean/.codex/rules/01-feature-architecture.md +6 -0
  25. package/templates/current/clean/.codex/rules/02-vue-typescript.md +6 -0
  26. package/templates/current/clean/.codex/rules/03-component-policy.md +24 -0
  27. package/templates/current/clean/.codex/rules/04-api-auth-router.md +6 -0
  28. package/templates/current/clean/.codex/rules/05-style.md +6 -0
  29. package/templates/current/clean/.codex/rules/06-quality.md +6 -0
  30. package/templates/current/clean/.codex/skills/build-admin-feature/SKILL.md +14 -0
  31. package/templates/current/clean/.codex/skills/build-admin-feature/references/component-selection.md +25 -0
  32. package/templates/current/clean/.codex/skills/style-og-origen-ui/SKILL.md +11 -0
  33. package/templates/current/clean/.codex/skills/style-og-origen-ui/agents/openai.yaml +4 -0
  34. package/templates/current/clean/.codex/skills/use-og-dialog/SKILL.md +12 -0
  35. package/templates/current/clean/.codex/skills/use-og-dialog/agents/openai.yaml +4 -0
  36. package/templates/current/clean/.codex/skills/use-og-editor/SKILL.md +25 -0
  37. package/templates/current/clean/.codex/skills/use-og-form/SKILL.md +12 -0
  38. package/templates/current/clean/.codex/skills/use-og-form-table/SKILL.md +25 -0
  39. package/templates/current/clean/.codex/skills/use-og-http/SKILL.md +13 -0
  40. package/templates/current/clean/.codex/skills/use-og-http/agents/openai.yaml +4 -0
  41. package/templates/current/clean/.codex/skills/use-og-router-tabs/SKILL.md +11 -0
  42. package/templates/current/clean/.codex/skills/use-og-search/SKILL.md +14 -0
  43. package/templates/current/clean/.codex/skills/use-og-table/SKILL.md +16 -0
  44. package/templates/current/clean/.codex/skills/use-og-upload/SKILL.md +25 -0
  45. package/templates/current/clean/.cursor/AGENTS.md +18 -0
  46. package/templates/current/clean/.cursor/rules/01-feature-architecture.mdc +12 -0
  47. package/templates/current/clean/.cursor/rules/02-vue-typescript.mdc +12 -0
  48. package/templates/current/clean/.cursor/rules/03-component-policy.mdc +30 -0
  49. package/templates/current/clean/.cursor/rules/04-api-auth-router.mdc +12 -0
  50. package/templates/current/clean/.cursor/rules/05-style.mdc +12 -0
  51. package/templates/current/clean/.cursor/rules/06-quality.mdc +12 -0
  52. package/templates/current/clean/.cursor/skills/build-admin-feature/SKILL.md +14 -0
  53. package/templates/current/clean/.cursor/skills/style-og-origen-ui/SKILL.md +11 -0
  54. package/templates/current/clean/.cursor/skills/use-og-dialog/SKILL.md +12 -0
  55. package/templates/current/clean/.cursor/skills/use-og-editor/SKILL.md +25 -0
  56. package/templates/current/clean/.cursor/skills/use-og-form/SKILL.md +12 -0
  57. package/templates/current/clean/.cursor/skills/use-og-form-table/SKILL.md +25 -0
  58. package/templates/current/clean/.cursor/skills/use-og-http/SKILL.md +13 -0
  59. package/templates/current/clean/.cursor/skills/use-og-router-tabs/SKILL.md +11 -0
  60. package/templates/current/clean/.cursor/skills/use-og-search/SKILL.md +14 -0
  61. package/templates/current/clean/.cursor/skills/use-og-table/SKILL.md +16 -0
  62. package/templates/current/clean/.cursor/skills/use-og-upload/SKILL.md +25 -0
  63. package/templates/current/clean/.env.example +7 -0
  64. package/templates/current/clean/.env.production.example +31 -0
  65. package/templates/current/clean/.qoder/AGENTS.md +15 -0
  66. package/templates/current/clean/.qoder/rules/01-feature-architecture.md +12 -0
  67. package/templates/current/clean/.qoder/rules/02-vue-typescript.md +12 -0
  68. package/templates/current/clean/.qoder/rules/03-component-policy.md +30 -0
  69. package/templates/current/clean/.qoder/rules/04-api-auth-router.md +12 -0
  70. package/templates/current/clean/.qoder/rules/05-style.md +12 -0
  71. package/templates/current/clean/.qoder/rules/06-quality.md +12 -0
  72. package/templates/current/clean/.qoder/skills/build-admin-feature/SKILL.md +14 -0
  73. package/templates/current/clean/.qoder/skills/style-og-origen-ui/SKILL.md +11 -0
  74. package/templates/current/clean/.qoder/skills/use-og-dialog/SKILL.md +12 -0
  75. package/templates/current/clean/.qoder/skills/use-og-editor/SKILL.md +25 -0
  76. package/templates/current/clean/.qoder/skills/use-og-form/SKILL.md +12 -0
  77. package/templates/current/clean/.qoder/skills/use-og-form-table/SKILL.md +25 -0
  78. package/templates/current/clean/.qoder/skills/use-og-http/SKILL.md +13 -0
  79. package/templates/current/clean/.qoder/skills/use-og-router-tabs/SKILL.md +11 -0
  80. package/templates/current/clean/.qoder/skills/use-og-search/SKILL.md +14 -0
  81. package/templates/current/clean/.qoder/skills/use-og-table/SKILL.md +16 -0
  82. package/templates/current/clean/.qoder/skills/use-og-upload/SKILL.md +25 -0
  83. package/templates/current/clean/AGENTS.md +16 -0
  84. package/templates/current/clean/README.md +116 -0
  85. package/templates/current/clean/component-catalog.json +765 -0
  86. package/templates/current/clean/e2e/admin-shell.spec.ts +150 -0
  87. package/templates/current/clean/e2e/demo-shell.spec.ts +328 -0
  88. package/templates/current/clean/evals/component-selection.json +29 -0
  89. package/templates/current/clean/gitignore +3 -0
  90. package/templates/current/clean/index.html +13 -0
  91. package/templates/current/clean/openapi.json +1623 -0
  92. package/templates/current/clean/package.json +65 -0
  93. package/templates/current/clean/playwright.config.ts +31 -0
  94. package/templates/current/clean/playwright.demo.config.ts +25 -0
  95. package/templates/current/clean/recipes/README.md +7 -0
  96. package/templates/current/clean/recipes/remote-crud-dialog-form.json +15 -0
  97. package/templates/current/clean/recipes/remote-crud-dialog-form.vue +66 -0
  98. package/templates/current/clean/scaffold.lock.json +12 -0
  99. package/templates/current/clean/scripts/check-admin-bundle.mjs +214 -0
  100. package/templates/current/clean/scripts/check-admin-scaffold.mjs +168 -0
  101. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/Forbidden.vue +26 -0
  102. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/NotFound.vue +26 -0
  103. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/ServerError.vue +26 -0
  104. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/error-pages.spec.ts +32 -0
  105. package/templates/current/clean/scripts/clean-overlay/src/main.ts +91 -0
  106. package/templates/current/clean/scripts/clean-overlay/src/router/componentRegistry.ts +25 -0
  107. package/templates/current/clean/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +47 -0
  108. package/templates/current/clean/scripts/clean-overlay/src/router/staticRoutes.ts +63 -0
  109. package/templates/current/clean/scripts/demo-api.ts +797 -0
  110. package/templates/current/clean/scripts/generate-api.ts +27 -0
  111. package/templates/current/clean/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +38 -0
  112. package/templates/current/clean/scripts/remove-examples.mjs +54 -0
  113. package/templates/current/clean/src/App.vue +67 -0
  114. package/templates/current/clean/src/api/client.spec.ts +66 -0
  115. package/templates/current/clean/src/api/client.ts +72 -0
  116. package/templates/current/clean/src/api/generated/data-contracts.ts +268 -0
  117. package/templates/current/clean/src/api/generated/http-client.ts +266 -0
  118. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/206/205/345/256/271/346/226/207/347/253/240.ts +147 -0
  119. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/256/241/350/256/241.ts +53 -0
  120. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/346/226/207/344/273/266/344/270/212/344/274/240.ts +66 -0
  121. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/347/224/250/346/210/267.ts +171 -0
  122. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/217/234/345/215/225.ts +181 -0
  123. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/247/222/350/211/262.ts +169 -0
  124. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/256/242/345/215/225/350/215/211/347/250/277.ts +170 -0
  125. package/templates/current/clean/src/api/generated//350/256/244/350/257/201.ts +98 -0
  126. package/templates/current/clean/src/api/http-adapter.spec.ts +33 -0
  127. package/templates/current/clean/src/api/http-adapter.ts +83 -0
  128. package/templates/current/clean/src/api/index.ts +41 -0
  129. package/templates/current/clean/src/app/createAdminUi.spec.ts +110 -0
  130. package/templates/current/clean/src/app/createAdminUi.ts +78 -0
  131. package/templates/current/clean/src/app/menu.spec.ts +255 -0
  132. package/templates/current/clean/src/app/menu.ts +268 -0
  133. package/templates/current/clean/src/app/menuTypes.ts +17 -0
  134. package/templates/current/clean/src/app/origenUiLocale.spec.ts +14 -0
  135. package/templates/current/clean/src/app/origenUiLocale.ts +65 -0
  136. package/templates/current/clean/src/app/permission.ts +9 -0
  137. package/templates/current/clean/src/app/runtimeConfig.ts +77 -0
  138. package/templates/current/clean/src/demo-api.spec.ts +167 -0
  139. package/templates/current/clean/src/env.d.ts +14 -0
  140. package/templates/current/clean/src/features/appearance/components/ThemePanel.vue +200 -0
  141. package/templates/current/clean/src/features/appearance/composables/useTheme.ts +17 -0
  142. package/templates/current/clean/src/features/appearance/store/theme.ts +140 -0
  143. package/templates/current/clean/src/features/auth/pages/Login.vue +159 -0
  144. package/templates/current/clean/src/features/auth/store/auth.spec.ts +131 -0
  145. package/templates/current/clean/src/features/auth/store/auth.ts +210 -0
  146. package/templates/current/clean/src/features/errors/pages/Forbidden.vue +26 -0
  147. package/templates/current/clean/src/features/errors/pages/NotFound.vue +26 -0
  148. package/templates/current/clean/src/features/errors/pages/ServerError.vue +26 -0
  149. package/templates/current/clean/src/features/errors/pages/error-pages.spec.ts +32 -0
  150. package/templates/current/clean/src/features/security/components/DevtoolsProtectionOverlay.vue +56 -0
  151. package/templates/current/clean/src/features/security/devtoolsProtection.spec.ts +211 -0
  152. package/templates/current/clean/src/features/security/devtoolsProtection.ts +242 -0
  153. package/templates/current/clean/src/features/shell/components/AdminWatermark.spec.ts +90 -0
  154. package/templates/current/clean/src/features/shell/components/AdminWatermark.vue +47 -0
  155. package/templates/current/clean/src/features/shell/components/RouteProgress.vue +68 -0
  156. package/templates/current/clean/src/features/shell/composables/useRouteProgress.spec.ts +95 -0
  157. package/templates/current/clean/src/features/shell/composables/useRouteProgress.ts +52 -0
  158. package/templates/current/clean/src/features/shell/store/sidebar.ts +55 -0
  159. package/templates/current/clean/src/features/system/access/api/admin-repository.ts +279 -0
  160. package/templates/current/clean/src/features/system/access/api/rbac.spec.ts +72 -0
  161. package/templates/current/clean/src/features/system/access/api/rbac.ts +272 -0
  162. package/templates/current/clean/src/features/system/access/composables/useAuthorizationRefresh.ts +15 -0
  163. package/templates/current/clean/src/features/workspace/pages/Empty.vue +18 -0
  164. package/templates/current/clean/src/features/workspace/pages/Profile.vue +183 -0
  165. package/templates/current/clean/src/layouts/AdminLayout.vue +61 -0
  166. package/templates/current/clean/src/layouts/BreadcrumbBar.vue +27 -0
  167. package/templates/current/clean/src/layouts/SideMenu.vue +119 -0
  168. package/templates/current/clean/src/layouts/TopBar.vue +301 -0
  169. package/templates/current/clean/src/layouts/WorkspaceTabs.vue +44 -0
  170. package/templates/current/clean/src/layouts/topBarMenuSearch.spec.ts +31 -0
  171. package/templates/current/clean/src/layouts/topBarMenuSearch.ts +21 -0
  172. package/templates/current/clean/src/locales/en-US.ts +55 -0
  173. package/templates/current/clean/src/locales/index.ts +119 -0
  174. package/templates/current/clean/src/locales/messages.spec.ts +23 -0
  175. package/templates/current/clean/src/locales/zh-CN.ts +55 -0
  176. package/templates/current/clean/src/locales/zh-TW.ts +44 -0
  177. package/templates/current/clean/src/main.ts +91 -0
  178. package/templates/current/clean/src/router/bootstrap.ts +76 -0
  179. package/templates/current/clean/src/router/componentRegistry.ts +25 -0
  180. package/templates/current/clean/src/router/dynamicRoutes.spec.ts +47 -0
  181. package/templates/current/clean/src/router/dynamicRoutes.ts +162 -0
  182. package/templates/current/clean/src/router/guards.ts +5 -0
  183. package/templates/current/clean/src/router/queryEncryption.spec.ts +82 -0
  184. package/templates/current/clean/src/router/queryEncryption.ts +133 -0
  185. package/templates/current/clean/src/router/routeQuery.spec.ts +11 -0
  186. package/templates/current/clean/src/router/routeQuery.ts +3 -0
  187. package/templates/current/clean/src/router/runtimeErrorRecovery.spec.ts +161 -0
  188. package/templates/current/clean/src/router/runtimeErrorRecovery.ts +108 -0
  189. package/templates/current/clean/src/router/staticRoutes.ts +63 -0
  190. package/templates/current/clean/src/router/useRouteQueryDefaults.spec.ts +90 -0
  191. package/templates/current/clean/src/router/useRouteQueryDefaults.ts +51 -0
  192. package/templates/current/clean/src/router/useRouteQueryDefaults.types.ts +19 -0
  193. package/templates/current/clean/src/store/index.ts +3 -0
  194. package/templates/current/clean/src/styles/element/index.scss +33 -0
  195. package/templates/current/clean/src/styles/index.css +39 -0
  196. package/templates/current/clean/src/styles/layout.css +115 -0
  197. package/templates/current/clean/src/styles/shell.css +196 -0
  198. package/templates/current/clean/src/styles/source-package-style-compat.css +1 -0
  199. package/templates/current/clean/src/templates/og-form.ts +48 -0
  200. package/templates/current/clean/src/templates/og-table.ts +212 -0
  201. package/templates/current/clean/src/templates/router.ts +51 -0
  202. package/templates/current/clean/src/templates/templates.spec.ts +90 -0
  203. package/templates/current/clean/src/theme/index.ts +7 -0
  204. package/templates/current/clean/src/utils/__tests__/color-mix.spec.ts +39 -0
  205. package/templates/current/clean/src/utils/color-mix.ts +76 -0
  206. package/templates/current/clean/src/utils/permissions.ts +6 -0
  207. package/templates/current/clean/tsconfig.json +40 -0
  208. package/templates/current/clean/tsconfig.node.json +9 -0
  209. package/templates/current/clean/vite.build-policy.ts +405 -0
  210. package/templates/current/clean/vite.config.ts +37 -0
  211. package/templates/current/examples/.codebuddy/AGENTS.md +18 -0
  212. package/templates/current/examples/.codebuddy/rules/01-feature-architecture.md +12 -0
  213. package/templates/current/examples/.codebuddy/rules/02-vue-typescript.md +12 -0
  214. package/templates/current/examples/.codebuddy/rules/03-component-policy.md +30 -0
  215. package/templates/current/examples/.codebuddy/rules/04-api-auth-router.md +12 -0
  216. package/templates/current/examples/.codebuddy/rules/05-style.md +12 -0
  217. package/templates/current/examples/.codebuddy/rules/06-quality.md +12 -0
  218. package/templates/current/examples/.codebuddy/skills/build-admin-feature/SKILL.md +17 -0
  219. package/templates/current/examples/.codebuddy/skills/style-og-origen-ui/SKILL.md +14 -0
  220. package/templates/current/examples/.codebuddy/skills/use-og-dialog/SKILL.md +15 -0
  221. package/templates/current/examples/.codebuddy/skills/use-og-editor/SKILL.md +28 -0
  222. package/templates/current/examples/.codebuddy/skills/use-og-form/SKILL.md +15 -0
  223. package/templates/current/examples/.codebuddy/skills/use-og-form-table/SKILL.md +28 -0
  224. package/templates/current/examples/.codebuddy/skills/use-og-http/SKILL.md +16 -0
  225. package/templates/current/examples/.codebuddy/skills/use-og-router-tabs/SKILL.md +14 -0
  226. package/templates/current/examples/.codebuddy/skills/use-og-search/SKILL.md +17 -0
  227. package/templates/current/examples/.codebuddy/skills/use-og-table/SKILL.md +19 -0
  228. package/templates/current/examples/.codebuddy/skills/use-og-upload/SKILL.md +28 -0
  229. package/templates/current/examples/.codex/AGENTS.md +15 -0
  230. package/templates/current/examples/.codex/rules/01-feature-architecture.md +6 -0
  231. package/templates/current/examples/.codex/rules/02-vue-typescript.md +6 -0
  232. package/templates/current/examples/.codex/rules/03-component-policy.md +24 -0
  233. package/templates/current/examples/.codex/rules/04-api-auth-router.md +6 -0
  234. package/templates/current/examples/.codex/rules/05-style.md +6 -0
  235. package/templates/current/examples/.codex/rules/06-quality.md +6 -0
  236. package/templates/current/examples/.codex/skills/build-admin-feature/SKILL.md +14 -0
  237. package/templates/current/examples/.codex/skills/build-admin-feature/references/component-selection.md +25 -0
  238. package/templates/current/examples/.codex/skills/style-og-origen-ui/SKILL.md +11 -0
  239. package/templates/current/examples/.codex/skills/style-og-origen-ui/agents/openai.yaml +4 -0
  240. package/templates/current/examples/.codex/skills/use-og-dialog/SKILL.md +12 -0
  241. package/templates/current/examples/.codex/skills/use-og-dialog/agents/openai.yaml +4 -0
  242. package/templates/current/examples/.codex/skills/use-og-editor/SKILL.md +25 -0
  243. package/templates/current/examples/.codex/skills/use-og-form/SKILL.md +12 -0
  244. package/templates/current/examples/.codex/skills/use-og-form-table/SKILL.md +25 -0
  245. package/templates/current/examples/.codex/skills/use-og-http/SKILL.md +13 -0
  246. package/templates/current/examples/.codex/skills/use-og-http/agents/openai.yaml +4 -0
  247. package/templates/current/examples/.codex/skills/use-og-router-tabs/SKILL.md +11 -0
  248. package/templates/current/examples/.codex/skills/use-og-search/SKILL.md +14 -0
  249. package/templates/current/examples/.codex/skills/use-og-table/SKILL.md +16 -0
  250. package/templates/current/examples/.codex/skills/use-og-upload/SKILL.md +25 -0
  251. package/templates/current/examples/.cursor/AGENTS.md +18 -0
  252. package/templates/current/examples/.cursor/rules/01-feature-architecture.mdc +12 -0
  253. package/templates/current/examples/.cursor/rules/02-vue-typescript.mdc +12 -0
  254. package/templates/current/examples/.cursor/rules/03-component-policy.mdc +30 -0
  255. package/templates/current/examples/.cursor/rules/04-api-auth-router.mdc +12 -0
  256. package/templates/current/examples/.cursor/rules/05-style.mdc +12 -0
  257. package/templates/current/examples/.cursor/rules/06-quality.mdc +12 -0
  258. package/templates/current/examples/.cursor/skills/build-admin-feature/SKILL.md +14 -0
  259. package/templates/current/examples/.cursor/skills/style-og-origen-ui/SKILL.md +11 -0
  260. package/templates/current/examples/.cursor/skills/use-og-dialog/SKILL.md +12 -0
  261. package/templates/current/examples/.cursor/skills/use-og-editor/SKILL.md +25 -0
  262. package/templates/current/examples/.cursor/skills/use-og-form/SKILL.md +12 -0
  263. package/templates/current/examples/.cursor/skills/use-og-form-table/SKILL.md +25 -0
  264. package/templates/current/examples/.cursor/skills/use-og-http/SKILL.md +13 -0
  265. package/templates/current/examples/.cursor/skills/use-og-router-tabs/SKILL.md +11 -0
  266. package/templates/current/examples/.cursor/skills/use-og-search/SKILL.md +14 -0
  267. package/templates/current/examples/.cursor/skills/use-og-table/SKILL.md +16 -0
  268. package/templates/current/examples/.cursor/skills/use-og-upload/SKILL.md +25 -0
  269. package/templates/current/examples/.env.example +7 -0
  270. package/templates/current/examples/.env.production.example +31 -0
  271. package/templates/current/examples/.qoder/AGENTS.md +15 -0
  272. package/templates/current/examples/.qoder/rules/01-feature-architecture.md +12 -0
  273. package/templates/current/examples/.qoder/rules/02-vue-typescript.md +12 -0
  274. package/templates/current/examples/.qoder/rules/03-component-policy.md +30 -0
  275. package/templates/current/examples/.qoder/rules/04-api-auth-router.md +12 -0
  276. package/templates/current/examples/.qoder/rules/05-style.md +12 -0
  277. package/templates/current/examples/.qoder/rules/06-quality.md +12 -0
  278. package/templates/current/examples/.qoder/skills/build-admin-feature/SKILL.md +14 -0
  279. package/templates/current/examples/.qoder/skills/style-og-origen-ui/SKILL.md +11 -0
  280. package/templates/current/examples/.qoder/skills/use-og-dialog/SKILL.md +12 -0
  281. package/templates/current/examples/.qoder/skills/use-og-editor/SKILL.md +25 -0
  282. package/templates/current/examples/.qoder/skills/use-og-form/SKILL.md +12 -0
  283. package/templates/current/examples/.qoder/skills/use-og-form-table/SKILL.md +25 -0
  284. package/templates/current/examples/.qoder/skills/use-og-http/SKILL.md +13 -0
  285. package/templates/current/examples/.qoder/skills/use-og-router-tabs/SKILL.md +11 -0
  286. package/templates/current/examples/.qoder/skills/use-og-search/SKILL.md +14 -0
  287. package/templates/current/examples/.qoder/skills/use-og-table/SKILL.md +16 -0
  288. package/templates/current/examples/.qoder/skills/use-og-upload/SKILL.md +25 -0
  289. package/templates/current/examples/AGENTS.md +16 -0
  290. package/templates/current/examples/README.md +116 -0
  291. package/templates/current/examples/component-catalog.json +765 -0
  292. package/templates/current/examples/e2e/admin-shell.spec.ts +150 -0
  293. package/templates/current/examples/e2e/demo-shell.spec.ts +328 -0
  294. package/templates/current/examples/evals/component-selection.json +29 -0
  295. package/templates/current/examples/gitignore +3 -0
  296. package/templates/current/examples/index.html +13 -0
  297. package/templates/current/examples/openapi.json +1623 -0
  298. package/templates/current/examples/package.json +65 -0
  299. package/templates/current/examples/playwright.config.ts +31 -0
  300. package/templates/current/examples/playwright.demo.config.ts +25 -0
  301. package/templates/current/examples/recipes/README.md +7 -0
  302. package/templates/current/examples/recipes/remote-crud-dialog-form.json +15 -0
  303. package/templates/current/examples/recipes/remote-crud-dialog-form.vue +66 -0
  304. package/templates/current/examples/scaffold.lock.json +12 -0
  305. package/templates/current/examples/scripts/check-admin-bundle.mjs +214 -0
  306. package/templates/current/examples/scripts/check-admin-scaffold.mjs +168 -0
  307. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/Forbidden.vue +26 -0
  308. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/NotFound.vue +26 -0
  309. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/ServerError.vue +26 -0
  310. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/error-pages.spec.ts +32 -0
  311. package/templates/current/examples/scripts/clean-overlay/src/main.ts +91 -0
  312. package/templates/current/examples/scripts/clean-overlay/src/router/componentRegistry.ts +25 -0
  313. package/templates/current/examples/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +47 -0
  314. package/templates/current/examples/scripts/clean-overlay/src/router/staticRoutes.ts +63 -0
  315. package/templates/current/examples/scripts/demo-api.ts +797 -0
  316. package/templates/current/examples/scripts/generate-api.ts +27 -0
  317. package/templates/current/examples/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +38 -0
  318. package/templates/current/examples/scripts/remove-examples.mjs +54 -0
  319. package/templates/current/examples/src/App.vue +67 -0
  320. package/templates/current/examples/src/api/client.spec.ts +66 -0
  321. package/templates/current/examples/src/api/client.ts +72 -0
  322. package/templates/current/examples/src/api/generated/data-contracts.ts +268 -0
  323. package/templates/current/examples/src/api/generated/http-client.ts +266 -0
  324. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/206/205/345/256/271/346/226/207/347/253/240.ts +147 -0
  325. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/256/241/350/256/241.ts +53 -0
  326. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/346/226/207/344/273/266/344/270/212/344/274/240.ts +66 -0
  327. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/347/224/250/346/210/267.ts +171 -0
  328. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/217/234/345/215/225.ts +181 -0
  329. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/247/222/350/211/262.ts +169 -0
  330. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/256/242/345/215/225/350/215/211/347/250/277.ts +170 -0
  331. package/templates/current/examples/src/api/generated//350/256/244/350/257/201.ts +98 -0
  332. package/templates/current/examples/src/api/http-adapter.spec.ts +33 -0
  333. package/templates/current/examples/src/api/http-adapter.ts +83 -0
  334. package/templates/current/examples/src/api/index.ts +41 -0
  335. package/templates/current/examples/src/app/createAdminUi.spec.ts +110 -0
  336. package/templates/current/examples/src/app/createAdminUi.ts +78 -0
  337. package/templates/current/examples/src/app/menu.spec.ts +255 -0
  338. package/templates/current/examples/src/app/menu.ts +268 -0
  339. package/templates/current/examples/src/app/menuTypes.ts +17 -0
  340. package/templates/current/examples/src/app/origenUiLocale.spec.ts +14 -0
  341. package/templates/current/examples/src/app/origenUiLocale.ts +65 -0
  342. package/templates/current/examples/src/app/permission.ts +9 -0
  343. package/templates/current/examples/src/app/runtimeConfig.ts +77 -0
  344. package/templates/current/examples/src/demo-api.spec.ts +167 -0
  345. package/templates/current/examples/src/env.d.ts +14 -0
  346. package/templates/current/examples/src/features/appearance/components/ThemePanel.vue +200 -0
  347. package/templates/current/examples/src/features/appearance/composables/useTheme.ts +17 -0
  348. package/templates/current/examples/src/features/appearance/store/theme.ts +140 -0
  349. package/templates/current/examples/src/features/auth/pages/Login.vue +159 -0
  350. package/templates/current/examples/src/features/auth/store/auth.spec.ts +131 -0
  351. package/templates/current/examples/src/features/auth/store/auth.ts +210 -0
  352. package/templates/current/examples/src/features/errors/pages/Forbidden.vue +26 -0
  353. package/templates/current/examples/src/features/errors/pages/NotFound.vue +26 -0
  354. package/templates/current/examples/src/features/errors/pages/ServerError.vue +26 -0
  355. package/templates/current/examples/src/features/errors/pages/error-pages.spec.ts +32 -0
  356. package/templates/current/examples/src/features/feature-composables.spec.ts +208 -0
  357. package/templates/current/examples/src/features/security/components/DevtoolsProtectionOverlay.vue +56 -0
  358. package/templates/current/examples/src/features/security/devtoolsProtection.spec.ts +211 -0
  359. package/templates/current/examples/src/features/security/devtoolsProtection.ts +242 -0
  360. package/templates/current/examples/src/features/shell/components/AdminWatermark.spec.ts +90 -0
  361. package/templates/current/examples/src/features/shell/components/AdminWatermark.vue +47 -0
  362. package/templates/current/examples/src/features/shell/components/RouteProgress.vue +68 -0
  363. package/templates/current/examples/src/features/shell/composables/useRouteProgress.spec.ts +95 -0
  364. package/templates/current/examples/src/features/shell/composables/useRouteProgress.ts +52 -0
  365. package/templates/current/examples/src/features/shell/store/sidebar.ts +55 -0
  366. package/templates/current/examples/src/features/system/access/api/admin-repository.ts +279 -0
  367. package/templates/current/examples/src/features/system/access/api/rbac.spec.ts +72 -0
  368. package/templates/current/examples/src/features/system/access/api/rbac.ts +272 -0
  369. package/templates/current/examples/src/features/system/access/composables/useAuthorizationRefresh.ts +15 -0
  370. package/templates/current/examples/src/features/system/audit/composables/useAuditManagement.ts +117 -0
  371. package/templates/current/examples/src/features/system/audit/pages/AuditList.vue +20 -0
  372. package/templates/current/examples/src/features/system/menus/components/MenuEditorForm.vue +189 -0
  373. package/templates/current/examples/src/features/system/menus/composables/useMenuManagement.ts +327 -0
  374. package/templates/current/examples/src/features/system/menus/pages/MenuList.vue +49 -0
  375. package/templates/current/examples/src/features/system/roles/components/RoleEditorForm.vue +112 -0
  376. package/templates/current/examples/src/features/system/roles/composables/useRoleManagement.ts +198 -0
  377. package/templates/current/examples/src/features/system/roles/pages/RoleList.vue +45 -0
  378. package/templates/current/examples/src/features/system/users/components/UserEditorForm.vue +101 -0
  379. package/templates/current/examples/src/features/system/users/composables/useUserManagement.ts +233 -0
  380. package/templates/current/examples/src/features/system/users/pages/UserList.vue +49 -0
  381. package/templates/current/examples/src/features/workspace/pages/Dashboard.spec.ts +32 -0
  382. package/templates/current/examples/src/features/workspace/pages/Dashboard.vue +297 -0
  383. package/templates/current/examples/src/features/workspace/pages/Empty.vue +18 -0
  384. package/templates/current/examples/src/features/workspace/pages/Profile.vue +183 -0
  385. package/templates/current/examples/src/layouts/AdminLayout.vue +61 -0
  386. package/templates/current/examples/src/layouts/BreadcrumbBar.vue +27 -0
  387. package/templates/current/examples/src/layouts/SideMenu.vue +119 -0
  388. package/templates/current/examples/src/layouts/TopBar.vue +301 -0
  389. package/templates/current/examples/src/layouts/WorkspaceTabs.vue +44 -0
  390. package/templates/current/examples/src/layouts/topBarMenuSearch.spec.ts +31 -0
  391. package/templates/current/examples/src/layouts/topBarMenuSearch.ts +21 -0
  392. package/templates/current/examples/src/locales/en-US.ts +55 -0
  393. package/templates/current/examples/src/locales/index.ts +119 -0
  394. package/templates/current/examples/src/locales/messages.spec.ts +23 -0
  395. package/templates/current/examples/src/locales/zh-CN.ts +55 -0
  396. package/templates/current/examples/src/locales/zh-TW.ts +44 -0
  397. package/templates/current/examples/src/main.ts +91 -0
  398. package/templates/current/examples/src/router/bootstrap.ts +76 -0
  399. package/templates/current/examples/src/router/componentRegistry.ts +83 -0
  400. package/templates/current/examples/src/router/dynamicRoutes.spec.ts +109 -0
  401. package/templates/current/examples/src/router/dynamicRoutes.ts +162 -0
  402. package/templates/current/examples/src/router/guards.ts +5 -0
  403. package/templates/current/examples/src/router/queryEncryption.spec.ts +82 -0
  404. package/templates/current/examples/src/router/queryEncryption.ts +133 -0
  405. package/templates/current/examples/src/router/routeQuery.spec.ts +11 -0
  406. package/templates/current/examples/src/router/routeQuery.ts +3 -0
  407. package/templates/current/examples/src/router/runtimeErrorRecovery.spec.ts +161 -0
  408. package/templates/current/examples/src/router/runtimeErrorRecovery.ts +108 -0
  409. package/templates/current/examples/src/router/staticRoutes.ts +63 -0
  410. package/templates/current/examples/src/router/useRouteQueryDefaults.spec.ts +90 -0
  411. package/templates/current/examples/src/router/useRouteQueryDefaults.ts +51 -0
  412. package/templates/current/examples/src/router/useRouteQueryDefaults.types.ts +19 -0
  413. package/templates/current/examples/src/store/index.ts +3 -0
  414. package/templates/current/examples/src/styles/element/index.scss +33 -0
  415. package/templates/current/examples/src/styles/index.css +39 -0
  416. package/templates/current/examples/src/styles/layout.css +115 -0
  417. package/templates/current/examples/src/styles/shell.css +196 -0
  418. package/templates/current/examples/src/styles/source-package-style-compat.css +1 -0
  419. package/templates/current/examples/src/templates/og-form.ts +48 -0
  420. package/templates/current/examples/src/templates/og-table.ts +212 -0
  421. package/templates/current/examples/src/templates/router.ts +51 -0
  422. package/templates/current/examples/src/templates/templates.spec.ts +90 -0
  423. package/templates/current/examples/src/theme/index.ts +7 -0
  424. package/templates/current/examples/src/utils/__tests__/color-mix.spec.ts +39 -0
  425. package/templates/current/examples/src/utils/color-mix.ts +76 -0
  426. package/templates/current/examples/src/utils/permissions.ts +6 -0
  427. package/templates/current/examples/tsconfig.json +40 -0
  428. package/templates/current/examples/tsconfig.node.json +9 -0
  429. package/templates/current/examples/vite.build-policy.ts +405 -0
  430. package/templates/current/examples/vite.config.ts +37 -0
@@ -0,0 +1,150 @@
1
+ import type { Page } from '@playwright/test'
2
+ import { expect, test } from '@playwright/test'
3
+
4
+ const permissions = [
5
+ 'workspace:dashboard:read',
6
+ 'system:user:read',
7
+ 'system:role:read',
8
+ 'system:menu:read',
9
+ 'system:audit:read',
10
+ ]
11
+
12
+ const menus = [
13
+ {
14
+ code: 'dashboard',
15
+ path: '/dashboard',
16
+ title: '工作台',
17
+ componentKey: 'dashboard',
18
+ icon: 'dashboard',
19
+ permissions: ['workspace:dashboard:read'],
20
+ menu: true,
21
+ cache: true,
22
+ order: 10,
23
+ },
24
+ {
25
+ code: 'system',
26
+ path: '/system',
27
+ title: '系统管理',
28
+ componentKey: 'outlet',
29
+ icon: 'system',
30
+ menu: true,
31
+ order: 20,
32
+ children: [
33
+ {
34
+ code: 'users',
35
+ path: 'users',
36
+ title: '用户管理',
37
+ componentKey: 'user-list',
38
+ permissions: ['system:user:read'],
39
+ menu: true,
40
+ order: 10,
41
+ },
42
+ {
43
+ code: 'roles',
44
+ path: 'roles',
45
+ title: '角色管理',
46
+ componentKey: 'role-list',
47
+ permissions: ['system:role:read'],
48
+ menu: true,
49
+ order: 20,
50
+ },
51
+ {
52
+ code: 'menus',
53
+ path: 'menus',
54
+ title: '菜单管理',
55
+ componentKey: 'menu-list',
56
+ permissions: ['system:menu:read'],
57
+ menu: true,
58
+ order: 30,
59
+ },
60
+ {
61
+ code: 'audit',
62
+ path: 'audit',
63
+ title: '审计日志',
64
+ componentKey: 'audit-list',
65
+ permissions: ['system:audit:read'],
66
+ menu: true,
67
+ order: 40,
68
+ },
69
+ ],
70
+ },
71
+ ]
72
+
73
+ function envelope(data: unknown): { code: number, data: unknown, message: string } {
74
+ return { code: 0, data, message: 'ok' }
75
+ }
76
+
77
+ async function mockBackend(page: Page): Promise<{ login: number, menus: number, profile: number }> {
78
+ const calls = { login: 0, menus: 0, profile: 0 }
79
+ await page.route('**/api/auth/login', async (route) => {
80
+ calls.login += 1
81
+ await route.fulfill({
82
+ json: envelope({
83
+ accessToken: 'production-e2e-token',
84
+ user: { id: 'admin-1', username: 'admin', displayName: 'E2E 管理员' },
85
+ permissions,
86
+ roleIds: ['role-admin'],
87
+ authorizationRevision: 7,
88
+ }),
89
+ })
90
+ })
91
+ await page.route('**/api/auth/profile', async (route) => {
92
+ calls.profile += 1
93
+ await route.fulfill({
94
+ json: envelope({
95
+ user: { id: 'admin-1', username: 'admin', displayName: 'E2E 管理员' },
96
+ permissions,
97
+ roleIds: ['role-admin'],
98
+ authorizationRevision: 7,
99
+ }),
100
+ })
101
+ })
102
+ await page.route('**/api/system/menus*', async (route) => {
103
+ calls.menus += 1
104
+ await route.fulfill({ json: envelope(menus) })
105
+ })
106
+ return calls
107
+ }
108
+
109
+ async function signIn(page: Page): Promise<void> {
110
+ await page.goto('/login')
111
+ await page.getByLabel('账号').fill('admin')
112
+ await page.getByLabel('密码').fill('secure-password')
113
+ await page.getByRole('button', { name: '登录' }).click()
114
+ await expect(page).toHaveURL(/\/dashboard$/)
115
+ }
116
+
117
+ const adapterError = 'No @origen-ui/router adapter has been installed on this application.'
118
+
119
+ test.describe('admin production shell', () => {
120
+ test('loads authentication, profile, and menus through remote API contracts', async ({
121
+ page,
122
+ }) => {
123
+ const pageErrors: string[] = []
124
+ page.on('pageerror', (error) => {
125
+ pageErrors.push(error.message)
126
+ })
127
+ await page.addInitScript(() => {
128
+ sessionStorage.setItem('og-admin-devtools-unlocked', 'true')
129
+ })
130
+ const calls = await mockBackend(page)
131
+
132
+ await signIn(page)
133
+ await page.reload()
134
+
135
+ await expect(page.locator('.admin-shell')).toBeVisible()
136
+ if (test.info().project.name === 'mobile-chromium')
137
+ await page.locator('.top-bar__icon-btn').first().click()
138
+ await expect(page.getByRole('navigation', { name: '应用导航' })).toHaveCount(1)
139
+ await expect(page.locator('.breadcrumb-bar')).toBeVisible()
140
+ await expect(page.locator('.workspace-tabs')).toBeVisible()
141
+ await expect(page.locator('.admin-shell__route-view')).toBeVisible()
142
+ await expect(page.locator('.dashboard-page')).toBeVisible()
143
+ await expect(page.locator('.page-header')).toHaveCount(0)
144
+
145
+ expect(calls.login).toBe(1)
146
+ expect(calls.profile).toBeGreaterThanOrEqual(1)
147
+ expect(calls.menus).toBeGreaterThanOrEqual(1)
148
+ expect(pageErrors).not.toContain(adapterError)
149
+ })
150
+ })
@@ -0,0 +1,328 @@
1
+ import type { APIRequestContext } from '@playwright/test'
2
+ import { expect, test } from '@playwright/test'
3
+
4
+ test.setTimeout(120_000)
5
+
6
+ interface Envelope<T> {
7
+ code: number
8
+ message: string
9
+ data: T
10
+ }
11
+
12
+ interface DemoLogin {
13
+ accessToken: string
14
+ permissions: string[]
15
+ }
16
+
17
+ interface DemoRecord {
18
+ id: string
19
+ }
20
+
21
+ interface DemoSummary {
22
+ userCount: number
23
+ roleCount: number
24
+ menuCount: number
25
+ auditCount: number
26
+ revision: number
27
+ }
28
+
29
+ async function demoRequest<T>(
30
+ request: APIRequestContext,
31
+ method: 'GET' | 'POST',
32
+ path: string,
33
+ token?: string,
34
+ data?: unknown,
35
+ ): Promise<T> {
36
+ const response = await request.fetch(path, {
37
+ method,
38
+ data,
39
+ headers: token ? { Authorization: `Bearer ${token}` } : undefined,
40
+ })
41
+ expect(response.status()).toBe(200)
42
+
43
+ const body = (await response.json()) as Envelope<T>
44
+ expect(body.code).toBe(0)
45
+ return body.data
46
+ }
47
+
48
+ test('admin demo logs in, registers remote routes, and persists mutations for this session', async ({
49
+ page,
50
+ request,
51
+ }) => {
52
+ const login = await demoRequest<DemoLogin>(request, 'POST', '/api/auth/login', undefined, {
53
+ username: 'admin',
54
+ password: 'admin123',
55
+ })
56
+ expect(login.permissions).toContain('system:user:write')
57
+
58
+ await page.goto('/login')
59
+ const loginInputs = page.locator('.login-page input')
60
+ await loginInputs.nth(0).fill('admin')
61
+ await loginInputs.nth(1).fill('admin123')
62
+ await Promise.all([
63
+ page.waitForURL('**/dashboard'),
64
+ page.locator('button.login-card__submit').click(),
65
+ ])
66
+
67
+ await expect(page.locator('.admin-shell')).toBeVisible({ timeout: 15_000 })
68
+ await page.setViewportSize({ width: 1920, height: 1080 })
69
+ await expect(page.locator('.dashboard-page')).toBeVisible()
70
+ await page.getByRole('button', { name: '简体中文', exact: true }).click()
71
+ await page.getByText('English', { exact: true }).last().click()
72
+ await expect(page.locator('.top-bar__search .el-select__placeholder')).toHaveText(
73
+ 'Search menus or pages',
74
+ )
75
+ await expect(page.locator('html')).toHaveAttribute('lang', 'en-US')
76
+ await page.getByRole('button', { name: 'English', exact: true }).click()
77
+ await page.getByText('繁體中文', { exact: true }).last().click()
78
+ await expect(page.locator('.top-bar__search .el-select__placeholder')).toHaveText(
79
+ '搜尋選單或頁面',
80
+ )
81
+ await expect(page.locator('html')).toHaveAttribute('lang', 'zh-TW')
82
+ await page.getByRole('button', { name: '繁體中文', exact: true }).click()
83
+ await page.getByText('简体中文', { exact: true }).last().click()
84
+ await expect(page.locator('.top-bar__search .el-select__placeholder')).toHaveText(
85
+ '搜索菜单或页面',
86
+ )
87
+ await expect(page.getByRole('button', { name: '消息' })).toHaveCount(0)
88
+ const documentNavigations: string[] = []
89
+ const runtimeWarnings: string[] = []
90
+ page.on('request', (request) => {
91
+ if (request.isNavigationRequest() && request.frame() === page.mainFrame())
92
+ documentNavigations.push(request.url())
93
+ })
94
+ page.on('console', (message) => {
95
+ if (message.type() === 'warning' || message.type() === 'error')
96
+ runtimeWarnings.push(message.text())
97
+ })
98
+ const menuSearch = page.locator('.top-bar__search input')
99
+ await menuSearch.fill('Users')
100
+ await page.locator('.el-select-dropdown__item').filter({ hasText: 'System / Users' }).click()
101
+ await expect(page).toHaveURL(/\/system\/users$/)
102
+ await menuSearch.fill('Dashboard')
103
+ await page.locator('.el-select-dropdown__item').filter({ hasText: 'Dashboard' }).click()
104
+ await expect(page).toHaveURL(/\/dashboard$/)
105
+ await page.getByText('System', { exact: true }).click()
106
+ await expect(page.getByRole('menuitem', { name: 'Users', exact: true })).toBeVisible()
107
+ await page.getByRole('menuitem', { name: 'Users', exact: true }).click()
108
+ await expect(page).toHaveURL(/\/system\/users$/)
109
+ await expect(page.locator('.table-page')).toBeVisible()
110
+ await expect(page.locator('.page-header')).toHaveCount(0)
111
+ const breadcrumbBox = await page.locator('.breadcrumb-bar').boundingBox()
112
+ const tableBox = await page.locator('.table-page > .table').boundingBox()
113
+ const routeViewBox = await page.locator('.admin-shell__route-view').boundingBox()
114
+ expect(breadcrumbBox).not.toBeNull()
115
+ expect(tableBox).not.toBeNull()
116
+ expect(routeViewBox).not.toBeNull()
117
+ expect(breadcrumbBox!.y + breadcrumbBox!.height).toBeLessThanOrEqual(tableBox!.y)
118
+ expect(tableBox!.height).toBeGreaterThan(routeViewBox!.height * 0.8)
119
+ await expect(page.locator('.top-bar__badge')).toHaveCount(0)
120
+ await expect(page.locator('.search')).toHaveAttribute('data-search-columns', '4')
121
+ const searchGridBox = await page.locator('.search__grid').boundingBox()
122
+ const searchFieldBox = await page.locator('[data-search-field="keyword"]').boundingBox()
123
+ expect(searchGridBox).not.toBeNull()
124
+ expect(searchFieldBox).not.toBeNull()
125
+ expect(searchFieldBox!.width).toBeLessThan(searchGridBox!.width * 0.3)
126
+ await expect(
127
+ page.locator('#main-content').getByText('Demo Administrator', { exact: true }),
128
+ ).toBeVisible()
129
+
130
+ await menuSearch.fill('Menus')
131
+ await page.locator('.el-select-dropdown__item').filter({ hasText: 'System / Menus' }).click()
132
+ await expect(page).toHaveURL(/\/system\/menus$/)
133
+ const updatedHeader = page
134
+ .locator('.el-table__header th.el-table__cell.is-sortable')
135
+ .filter({ hasText: '最近更新' })
136
+ const updatedHeaderContent = updatedHeader.locator('.table__header-content')
137
+ const updatedCaret = updatedHeader.locator('.caret-wrapper')
138
+ await expect(updatedHeaderContent).toBeVisible()
139
+ await expect(updatedCaret).toBeVisible()
140
+ const [updatedContentBox, updatedCaretBox] = await Promise.all([
141
+ updatedHeaderContent.boundingBox(),
142
+ updatedCaret.boundingBox(),
143
+ ])
144
+ expect(updatedContentBox).not.toBeNull()
145
+ expect(updatedCaretBox).not.toBeNull()
146
+ expect(updatedCaretBox!.y).toBeLessThan(updatedContentBox!.y + updatedContentBox!.height)
147
+ expect(updatedCaretBox!.y + updatedCaretBox!.height).toBeGreaterThan(updatedContentBox!.y)
148
+ const ascendingSortRequest = page.waitForRequest((request) => {
149
+ const url = new URL(request.url())
150
+ return (
151
+ request.method() === 'GET' &&
152
+ url.pathname.endsWith('/api/system/menus') &&
153
+ url.searchParams.get('sortBy') === 'updatedAt' &&
154
+ url.searchParams.get('sortOrder') === 'ascending'
155
+ )
156
+ })
157
+ await updatedHeader.click()
158
+ await ascendingSortRequest
159
+ const systemMenuRow = page.locator('.el-table__body tr').filter({ hasText: 'System' }).first()
160
+ const systemExpand = systemMenuRow.locator('.el-table__expand-icon')
161
+ await expect(systemExpand).toBeVisible()
162
+ await systemExpand.click()
163
+ await expect(page.locator('.el-table__body tr').filter({ hasText: 'Users' })).toBeHidden()
164
+ await systemExpand.click()
165
+ await expect(page.locator('.el-table__body tr').filter({ hasText: 'Users' })).toBeVisible()
166
+ expect(documentNavigations).toHaveLength(0)
167
+ expect(runtimeWarnings).not.toEqual(
168
+ expect.arrayContaining([
169
+ expect.stringContaining('injection "Symbol(og-table)" not found'),
170
+ expect.stringContaining('Failed to resolve directive: loading'),
171
+ ]),
172
+ )
173
+
174
+ const tabs = page.locator('.workspace-tabs [role="tab"]')
175
+ expect(await tabs.count()).toBeGreaterThanOrEqual(2)
176
+ await expect(page.locator('.workspace-tabs .og-tabs__bar')).toHaveCSS('display', 'flex')
177
+ const tabTops = await tabs.evaluateAll((elements) =>
178
+ elements.map((element) => Math.round(element.getBoundingClientRect().top)),
179
+ )
180
+ expect(new Set(tabTops).size).toBe(1)
181
+
182
+ const keywordField = page.locator('[data-search-field="keyword"]')
183
+ const keywordLabel = keywordField.locator('.el-form-item__label')
184
+ const keywordInput = keywordField.locator('input')
185
+ const labelBox = await keywordLabel.boundingBox()
186
+ const inputBox = await keywordInput.boundingBox()
187
+ expect(labelBox).not.toBeNull()
188
+ expect(inputBox).not.toBeNull()
189
+ expect(labelBox!.x + labelBox!.width).toBeLessThanOrEqual(inputBox!.x)
190
+
191
+ await page.setViewportSize({ width: 600, height: 900 })
192
+ await expect(page.locator('.workspace-tabs .og-tabs__bar')).toHaveCSS('display', 'flex')
193
+ const narrowTabTops = await tabs.evaluateAll((elements) =>
194
+ elements.map((element) => Math.round(element.getBoundingClientRect().top)),
195
+ )
196
+ expect(new Set(narrowTabTops).size).toBe(1)
197
+ const rowActions = page.locator('.table-row-actions').first()
198
+ await expect(rowActions.locator('.table-row-actions__action')).toHaveCount(1)
199
+ await expect(rowActions.locator('.table-row-actions__more')).toBeVisible()
200
+ await expect(
201
+ page.locator('.table-page > .table--bordered.table--no-pagination .table__body'),
202
+ ).toHaveCSS('margin-bottom', '10px')
203
+ await rowActions.locator('.table-row-actions__action').click()
204
+ const mobileDialog = page.locator('.el-dialog.dialog__surface')
205
+ await expect(mobileDialog).toBeVisible()
206
+ for (const width of [600, 375]) {
207
+ await page.setViewportSize({ width, height: 900 })
208
+ const dialogBox = await mobileDialog.boundingBox()
209
+ expect(dialogBox).not.toBeNull()
210
+ expect(dialogBox!.x).toBeGreaterThanOrEqual(0)
211
+ expect(dialogBox!.x + dialogBox!.width).toBeLessThanOrEqual(width)
212
+ expect(
213
+ await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth),
214
+ ).toBe(true)
215
+ }
216
+ await page.keyboard.press('Escape')
217
+ await expect(mobileDialog).toBeHidden()
218
+
219
+ async function assertEditorFormDoesNotOverflow(
220
+ menu: string,
221
+ createButton: string,
222
+ ): Promise<void> {
223
+ await page.goto(`/system/${menu.toLowerCase()}`)
224
+ await expect(page).toHaveURL(new RegExp(`/system/${menu.toLowerCase()}$`))
225
+ await page.getByRole('button', { name: createButton, exact: true }).click()
226
+
227
+ const dialog = page
228
+ .locator('.el-dialog.dialog__surface')
229
+ .filter({ has: page.locator('.form-container') })
230
+ const body = dialog.locator('.el-dialog__body')
231
+ await expect(dialog).toBeVisible()
232
+ await expect(body).toBeVisible()
233
+ expect(await body.evaluate((element) => element.scrollWidth <= element.clientWidth)).toBe(true)
234
+
235
+ const label = dialog.locator('.el-form-item__label').first()
236
+ await expect(label).toHaveCSS('align-items', 'center')
237
+ const labelMetrics = await label.evaluate((element) => {
238
+ const style = getComputedStyle(element)
239
+ return {
240
+ height: element.getBoundingClientRect().height,
241
+ lineHeight: Number.parseFloat(style.lineHeight),
242
+ }
243
+ })
244
+ expect(labelMetrics.lineHeight).toBeLessThan(labelMetrics.height)
245
+
246
+ await page.keyboard.press('Escape')
247
+ await expect(dialog).toBeHidden()
248
+ }
249
+
250
+ for (const viewport of [
251
+ { width: 1280, height: 900 },
252
+ { width: 375, height: 900 },
253
+ ]) {
254
+ await page.setViewportSize(viewport)
255
+ await assertEditorFormDoesNotOverflow('Users', '新增成员')
256
+ await assertEditorFormDoesNotOverflow('Roles', '新增角色')
257
+ await assertEditorFormDoesNotOverflow('Menus', '新增菜单')
258
+ }
259
+
260
+ await page.setViewportSize({ width: 600, height: 900 })
261
+
262
+ const suffix = `${Date.now()}`
263
+ const role = await demoRequest<DemoRecord>(
264
+ request,
265
+ 'POST',
266
+ '/api/system/roles',
267
+ login.accessToken,
268
+ {
269
+ name: `Demo smoke role ${suffix}`,
270
+ code: `demo_smoke_${suffix}`,
271
+ description: 'Created by the local demo Playwright smoke test.',
272
+ permissions: ['system:audit:read'],
273
+ status: 'active',
274
+ },
275
+ )
276
+ expect(role.id).toMatch(/^role-/)
277
+
278
+ const user = await demoRequest<DemoRecord>(
279
+ request,
280
+ 'POST',
281
+ '/api/system/users',
282
+ login.accessToken,
283
+ {
284
+ name: `Demo smoke user ${suffix}`,
285
+ email: `demo-smoke-${suffix}@example.test`,
286
+ department: 'Platform',
287
+ roleIds: [role.id],
288
+ status: 'active',
289
+ },
290
+ )
291
+ expect(user.id).toMatch(/^user-/)
292
+
293
+ const menu = await demoRequest<DemoRecord>(
294
+ request,
295
+ 'POST',
296
+ '/api/system/menus',
297
+ login.accessToken,
298
+ {
299
+ parentId: 'menu-system',
300
+ kind: 'page',
301
+ code: `demo-smoke-${suffix}`,
302
+ title: `Demo smoke menu ${suffix}`,
303
+ path: `demo-smoke-${suffix}`,
304
+ componentKey: 'audit-list',
305
+ icon: 'audit',
306
+ order: 90,
307
+ status: 'active',
308
+ visible: true,
309
+ cache: false,
310
+ tabHidden: true,
311
+ },
312
+ )
313
+ expect(menu.id).toMatch(/^menu-/)
314
+
315
+ const summary = await demoRequest<DemoSummary>(
316
+ request,
317
+ 'GET',
318
+ '/api/system/rbac/summary',
319
+ login.accessToken,
320
+ )
321
+ expect(summary).toMatchObject({
322
+ userCount: 3,
323
+ roleCount: 3,
324
+ menuCount: 7,
325
+ auditCount: 3,
326
+ revision: 4,
327
+ })
328
+ })
@@ -0,0 +1,29 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "cases": [
4
+ {
5
+ "id": "remote-user-crud",
6
+ "prompt": "Implement a permissioned remote user CRUD page with filters, paging, and an edit dialog.",
7
+ "required": ["OgTableWithSearch", "OgForm", "OgDialog", "@origen-ui/http"],
8
+ "forbidden": ["ElTable", "ElForm", "ElDialog", "axios"]
9
+ },
10
+ {
11
+ "id": "rich-text",
12
+ "prompt": "Implement a rich-text article editor and a safe read-only preview.",
13
+ "required": ["OgEditor", "OgEditorViewer"],
14
+ "forbidden": ["v-html"]
15
+ },
16
+ {
17
+ "id": "line-items",
18
+ "prompt": "Implement an editable order line-item field inside a schema form.",
19
+ "required": ["OgForm", "OgFormTable"],
20
+ "forbidden": ["ElTable"]
21
+ },
22
+ {
23
+ "id": "file-upload",
24
+ "prompt": "Implement validated attachment upload and project the result to a URL field.",
25
+ "required": ["OgUpload"],
26
+ "forbidden": ["ElUpload"]
27
+ }
28
+ ]
29
+ }
@@ -0,0 +1,3 @@
1
+ node_modules
2
+ dist
3
+ .env
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="theme-color" content="#f5f7fb" />
7
+ <title>@origen-ui/admin</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/main.ts"></script>
12
+ </body>
13
+ </html>