@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.
- package/LICENSE +21 -0
- package/README.md +17 -0
- package/bin/og-admin.mjs +131 -0
- package/package.json +28 -0
- package/templates/current/clean/.codebuddy/AGENTS.md +18 -0
- package/templates/current/clean/.codebuddy/rules/01-feature-architecture.md +12 -0
- package/templates/current/clean/.codebuddy/rules/02-vue-typescript.md +12 -0
- package/templates/current/clean/.codebuddy/rules/03-component-policy.md +30 -0
- package/templates/current/clean/.codebuddy/rules/04-api-auth-router.md +12 -0
- package/templates/current/clean/.codebuddy/rules/05-style.md +12 -0
- package/templates/current/clean/.codebuddy/rules/06-quality.md +12 -0
- package/templates/current/clean/.codebuddy/skills/build-admin-feature/SKILL.md +17 -0
- package/templates/current/clean/.codebuddy/skills/style-og-origen-ui/SKILL.md +14 -0
- package/templates/current/clean/.codebuddy/skills/use-og-dialog/SKILL.md +15 -0
- package/templates/current/clean/.codebuddy/skills/use-og-editor/SKILL.md +28 -0
- package/templates/current/clean/.codebuddy/skills/use-og-form/SKILL.md +15 -0
- package/templates/current/clean/.codebuddy/skills/use-og-form-table/SKILL.md +28 -0
- package/templates/current/clean/.codebuddy/skills/use-og-http/SKILL.md +16 -0
- package/templates/current/clean/.codebuddy/skills/use-og-router-tabs/SKILL.md +14 -0
- package/templates/current/clean/.codebuddy/skills/use-og-search/SKILL.md +17 -0
- package/templates/current/clean/.codebuddy/skills/use-og-table/SKILL.md +19 -0
- package/templates/current/clean/.codebuddy/skills/use-og-upload/SKILL.md +28 -0
- package/templates/current/clean/.codex/AGENTS.md +15 -0
- package/templates/current/clean/.codex/rules/01-feature-architecture.md +6 -0
- package/templates/current/clean/.codex/rules/02-vue-typescript.md +6 -0
- package/templates/current/clean/.codex/rules/03-component-policy.md +24 -0
- package/templates/current/clean/.codex/rules/04-api-auth-router.md +6 -0
- package/templates/current/clean/.codex/rules/05-style.md +6 -0
- package/templates/current/clean/.codex/rules/06-quality.md +6 -0
- package/templates/current/clean/.codex/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/clean/.codex/skills/build-admin-feature/references/component-selection.md +25 -0
- package/templates/current/clean/.codex/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/clean/.codex/skills/style-og-origen-ui/agents/openai.yaml +4 -0
- package/templates/current/clean/.codex/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/clean/.codex/skills/use-og-dialog/agents/openai.yaml +4 -0
- package/templates/current/clean/.codex/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/clean/.codex/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/clean/.codex/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/clean/.codex/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/clean/.codex/skills/use-og-http/agents/openai.yaml +4 -0
- package/templates/current/clean/.codex/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/clean/.codex/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/clean/.codex/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/clean/.codex/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/clean/.cursor/AGENTS.md +18 -0
- package/templates/current/clean/.cursor/rules/01-feature-architecture.mdc +12 -0
- package/templates/current/clean/.cursor/rules/02-vue-typescript.mdc +12 -0
- package/templates/current/clean/.cursor/rules/03-component-policy.mdc +30 -0
- package/templates/current/clean/.cursor/rules/04-api-auth-router.mdc +12 -0
- package/templates/current/clean/.cursor/rules/05-style.mdc +12 -0
- package/templates/current/clean/.cursor/rules/06-quality.mdc +12 -0
- package/templates/current/clean/.cursor/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/clean/.cursor/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/clean/.cursor/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/clean/.cursor/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/clean/.cursor/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/clean/.cursor/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/clean/.cursor/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/clean/.cursor/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/clean/.cursor/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/clean/.cursor/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/clean/.cursor/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/clean/.env.example +7 -0
- package/templates/current/clean/.env.production.example +31 -0
- package/templates/current/clean/.qoder/AGENTS.md +15 -0
- package/templates/current/clean/.qoder/rules/01-feature-architecture.md +12 -0
- package/templates/current/clean/.qoder/rules/02-vue-typescript.md +12 -0
- package/templates/current/clean/.qoder/rules/03-component-policy.md +30 -0
- package/templates/current/clean/.qoder/rules/04-api-auth-router.md +12 -0
- package/templates/current/clean/.qoder/rules/05-style.md +12 -0
- package/templates/current/clean/.qoder/rules/06-quality.md +12 -0
- package/templates/current/clean/.qoder/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/clean/.qoder/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/clean/.qoder/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/clean/.qoder/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/clean/.qoder/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/clean/.qoder/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/clean/.qoder/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/clean/.qoder/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/clean/.qoder/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/clean/.qoder/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/clean/.qoder/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/clean/AGENTS.md +16 -0
- package/templates/current/clean/README.md +116 -0
- package/templates/current/clean/component-catalog.json +765 -0
- package/templates/current/clean/e2e/admin-shell.spec.ts +150 -0
- package/templates/current/clean/e2e/demo-shell.spec.ts +328 -0
- package/templates/current/clean/evals/component-selection.json +29 -0
- package/templates/current/clean/gitignore +3 -0
- package/templates/current/clean/index.html +13 -0
- package/templates/current/clean/openapi.json +1623 -0
- package/templates/current/clean/package.json +65 -0
- package/templates/current/clean/playwright.config.ts +31 -0
- package/templates/current/clean/playwright.demo.config.ts +25 -0
- package/templates/current/clean/recipes/README.md +7 -0
- package/templates/current/clean/recipes/remote-crud-dialog-form.json +15 -0
- package/templates/current/clean/recipes/remote-crud-dialog-form.vue +66 -0
- package/templates/current/clean/scaffold.lock.json +12 -0
- package/templates/current/clean/scripts/check-admin-bundle.mjs +214 -0
- package/templates/current/clean/scripts/check-admin-scaffold.mjs +168 -0
- package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/Forbidden.vue +26 -0
- package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/NotFound.vue +26 -0
- package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/ServerError.vue +26 -0
- package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/error-pages.spec.ts +32 -0
- package/templates/current/clean/scripts/clean-overlay/src/main.ts +91 -0
- package/templates/current/clean/scripts/clean-overlay/src/router/componentRegistry.ts +25 -0
- package/templates/current/clean/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +47 -0
- package/templates/current/clean/scripts/clean-overlay/src/router/staticRoutes.ts +63 -0
- package/templates/current/clean/scripts/demo-api.ts +797 -0
- package/templates/current/clean/scripts/generate-api.ts +27 -0
- package/templates/current/clean/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +38 -0
- package/templates/current/clean/scripts/remove-examples.mjs +54 -0
- package/templates/current/clean/src/App.vue +67 -0
- package/templates/current/clean/src/api/client.spec.ts +66 -0
- package/templates/current/clean/src/api/client.ts +72 -0
- package/templates/current/clean/src/api/generated/data-contracts.ts +268 -0
- package/templates/current/clean/src/api/generated/http-client.ts +266 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/templates/current/clean/src/api/generated//350/256/244/350/257/201.ts +98 -0
- package/templates/current/clean/src/api/http-adapter.spec.ts +33 -0
- package/templates/current/clean/src/api/http-adapter.ts +83 -0
- package/templates/current/clean/src/api/index.ts +41 -0
- package/templates/current/clean/src/app/createAdminUi.spec.ts +110 -0
- package/templates/current/clean/src/app/createAdminUi.ts +78 -0
- package/templates/current/clean/src/app/menu.spec.ts +255 -0
- package/templates/current/clean/src/app/menu.ts +268 -0
- package/templates/current/clean/src/app/menuTypes.ts +17 -0
- package/templates/current/clean/src/app/origenUiLocale.spec.ts +14 -0
- package/templates/current/clean/src/app/origenUiLocale.ts +65 -0
- package/templates/current/clean/src/app/permission.ts +9 -0
- package/templates/current/clean/src/app/runtimeConfig.ts +77 -0
- package/templates/current/clean/src/demo-api.spec.ts +167 -0
- package/templates/current/clean/src/env.d.ts +14 -0
- package/templates/current/clean/src/features/appearance/components/ThemePanel.vue +200 -0
- package/templates/current/clean/src/features/appearance/composables/useTheme.ts +17 -0
- package/templates/current/clean/src/features/appearance/store/theme.ts +140 -0
- package/templates/current/clean/src/features/auth/pages/Login.vue +159 -0
- package/templates/current/clean/src/features/auth/store/auth.spec.ts +131 -0
- package/templates/current/clean/src/features/auth/store/auth.ts +210 -0
- package/templates/current/clean/src/features/errors/pages/Forbidden.vue +26 -0
- package/templates/current/clean/src/features/errors/pages/NotFound.vue +26 -0
- package/templates/current/clean/src/features/errors/pages/ServerError.vue +26 -0
- package/templates/current/clean/src/features/errors/pages/error-pages.spec.ts +32 -0
- package/templates/current/clean/src/features/security/components/DevtoolsProtectionOverlay.vue +56 -0
- package/templates/current/clean/src/features/security/devtoolsProtection.spec.ts +211 -0
- package/templates/current/clean/src/features/security/devtoolsProtection.ts +242 -0
- package/templates/current/clean/src/features/shell/components/AdminWatermark.spec.ts +90 -0
- package/templates/current/clean/src/features/shell/components/AdminWatermark.vue +47 -0
- package/templates/current/clean/src/features/shell/components/RouteProgress.vue +68 -0
- package/templates/current/clean/src/features/shell/composables/useRouteProgress.spec.ts +95 -0
- package/templates/current/clean/src/features/shell/composables/useRouteProgress.ts +52 -0
- package/templates/current/clean/src/features/shell/store/sidebar.ts +55 -0
- package/templates/current/clean/src/features/system/access/api/admin-repository.ts +279 -0
- package/templates/current/clean/src/features/system/access/api/rbac.spec.ts +72 -0
- package/templates/current/clean/src/features/system/access/api/rbac.ts +272 -0
- package/templates/current/clean/src/features/system/access/composables/useAuthorizationRefresh.ts +15 -0
- package/templates/current/clean/src/features/workspace/pages/Empty.vue +18 -0
- package/templates/current/clean/src/features/workspace/pages/Profile.vue +183 -0
- package/templates/current/clean/src/layouts/AdminLayout.vue +61 -0
- package/templates/current/clean/src/layouts/BreadcrumbBar.vue +27 -0
- package/templates/current/clean/src/layouts/SideMenu.vue +119 -0
- package/templates/current/clean/src/layouts/TopBar.vue +301 -0
- package/templates/current/clean/src/layouts/WorkspaceTabs.vue +44 -0
- package/templates/current/clean/src/layouts/topBarMenuSearch.spec.ts +31 -0
- package/templates/current/clean/src/layouts/topBarMenuSearch.ts +21 -0
- package/templates/current/clean/src/locales/en-US.ts +55 -0
- package/templates/current/clean/src/locales/index.ts +119 -0
- package/templates/current/clean/src/locales/messages.spec.ts +23 -0
- package/templates/current/clean/src/locales/zh-CN.ts +55 -0
- package/templates/current/clean/src/locales/zh-TW.ts +44 -0
- package/templates/current/clean/src/main.ts +91 -0
- package/templates/current/clean/src/router/bootstrap.ts +76 -0
- package/templates/current/clean/src/router/componentRegistry.ts +25 -0
- package/templates/current/clean/src/router/dynamicRoutes.spec.ts +47 -0
- package/templates/current/clean/src/router/dynamicRoutes.ts +162 -0
- package/templates/current/clean/src/router/guards.ts +5 -0
- package/templates/current/clean/src/router/queryEncryption.spec.ts +82 -0
- package/templates/current/clean/src/router/queryEncryption.ts +133 -0
- package/templates/current/clean/src/router/routeQuery.spec.ts +11 -0
- package/templates/current/clean/src/router/routeQuery.ts +3 -0
- package/templates/current/clean/src/router/runtimeErrorRecovery.spec.ts +161 -0
- package/templates/current/clean/src/router/runtimeErrorRecovery.ts +108 -0
- package/templates/current/clean/src/router/staticRoutes.ts +63 -0
- package/templates/current/clean/src/router/useRouteQueryDefaults.spec.ts +90 -0
- package/templates/current/clean/src/router/useRouteQueryDefaults.ts +51 -0
- package/templates/current/clean/src/router/useRouteQueryDefaults.types.ts +19 -0
- package/templates/current/clean/src/store/index.ts +3 -0
- package/templates/current/clean/src/styles/element/index.scss +33 -0
- package/templates/current/clean/src/styles/index.css +39 -0
- package/templates/current/clean/src/styles/layout.css +115 -0
- package/templates/current/clean/src/styles/shell.css +196 -0
- package/templates/current/clean/src/styles/source-package-style-compat.css +1 -0
- package/templates/current/clean/src/templates/og-form.ts +48 -0
- package/templates/current/clean/src/templates/og-table.ts +212 -0
- package/templates/current/clean/src/templates/router.ts +51 -0
- package/templates/current/clean/src/templates/templates.spec.ts +90 -0
- package/templates/current/clean/src/theme/index.ts +7 -0
- package/templates/current/clean/src/utils/__tests__/color-mix.spec.ts +39 -0
- package/templates/current/clean/src/utils/color-mix.ts +76 -0
- package/templates/current/clean/src/utils/permissions.ts +6 -0
- package/templates/current/clean/tsconfig.json +40 -0
- package/templates/current/clean/tsconfig.node.json +9 -0
- package/templates/current/clean/vite.build-policy.ts +405 -0
- package/templates/current/clean/vite.config.ts +37 -0
- package/templates/current/examples/.codebuddy/AGENTS.md +18 -0
- package/templates/current/examples/.codebuddy/rules/01-feature-architecture.md +12 -0
- package/templates/current/examples/.codebuddy/rules/02-vue-typescript.md +12 -0
- package/templates/current/examples/.codebuddy/rules/03-component-policy.md +30 -0
- package/templates/current/examples/.codebuddy/rules/04-api-auth-router.md +12 -0
- package/templates/current/examples/.codebuddy/rules/05-style.md +12 -0
- package/templates/current/examples/.codebuddy/rules/06-quality.md +12 -0
- package/templates/current/examples/.codebuddy/skills/build-admin-feature/SKILL.md +17 -0
- package/templates/current/examples/.codebuddy/skills/style-og-origen-ui/SKILL.md +14 -0
- package/templates/current/examples/.codebuddy/skills/use-og-dialog/SKILL.md +15 -0
- package/templates/current/examples/.codebuddy/skills/use-og-editor/SKILL.md +28 -0
- package/templates/current/examples/.codebuddy/skills/use-og-form/SKILL.md +15 -0
- package/templates/current/examples/.codebuddy/skills/use-og-form-table/SKILL.md +28 -0
- package/templates/current/examples/.codebuddy/skills/use-og-http/SKILL.md +16 -0
- package/templates/current/examples/.codebuddy/skills/use-og-router-tabs/SKILL.md +14 -0
- package/templates/current/examples/.codebuddy/skills/use-og-search/SKILL.md +17 -0
- package/templates/current/examples/.codebuddy/skills/use-og-table/SKILL.md +19 -0
- package/templates/current/examples/.codebuddy/skills/use-og-upload/SKILL.md +28 -0
- package/templates/current/examples/.codex/AGENTS.md +15 -0
- package/templates/current/examples/.codex/rules/01-feature-architecture.md +6 -0
- package/templates/current/examples/.codex/rules/02-vue-typescript.md +6 -0
- package/templates/current/examples/.codex/rules/03-component-policy.md +24 -0
- package/templates/current/examples/.codex/rules/04-api-auth-router.md +6 -0
- package/templates/current/examples/.codex/rules/05-style.md +6 -0
- package/templates/current/examples/.codex/rules/06-quality.md +6 -0
- package/templates/current/examples/.codex/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/examples/.codex/skills/build-admin-feature/references/component-selection.md +25 -0
- package/templates/current/examples/.codex/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/examples/.codex/skills/style-og-origen-ui/agents/openai.yaml +4 -0
- package/templates/current/examples/.codex/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/examples/.codex/skills/use-og-dialog/agents/openai.yaml +4 -0
- package/templates/current/examples/.codex/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/examples/.codex/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/examples/.codex/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/examples/.codex/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/examples/.codex/skills/use-og-http/agents/openai.yaml +4 -0
- package/templates/current/examples/.codex/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/examples/.codex/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/examples/.codex/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/examples/.codex/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/examples/.cursor/AGENTS.md +18 -0
- package/templates/current/examples/.cursor/rules/01-feature-architecture.mdc +12 -0
- package/templates/current/examples/.cursor/rules/02-vue-typescript.mdc +12 -0
- package/templates/current/examples/.cursor/rules/03-component-policy.mdc +30 -0
- package/templates/current/examples/.cursor/rules/04-api-auth-router.mdc +12 -0
- package/templates/current/examples/.cursor/rules/05-style.mdc +12 -0
- package/templates/current/examples/.cursor/rules/06-quality.mdc +12 -0
- package/templates/current/examples/.cursor/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/examples/.cursor/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/examples/.cursor/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/examples/.cursor/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/examples/.cursor/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/examples/.cursor/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/examples/.cursor/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/examples/.cursor/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/examples/.cursor/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/examples/.cursor/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/examples/.cursor/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/examples/.env.example +7 -0
- package/templates/current/examples/.env.production.example +31 -0
- package/templates/current/examples/.qoder/AGENTS.md +15 -0
- package/templates/current/examples/.qoder/rules/01-feature-architecture.md +12 -0
- package/templates/current/examples/.qoder/rules/02-vue-typescript.md +12 -0
- package/templates/current/examples/.qoder/rules/03-component-policy.md +30 -0
- package/templates/current/examples/.qoder/rules/04-api-auth-router.md +12 -0
- package/templates/current/examples/.qoder/rules/05-style.md +12 -0
- package/templates/current/examples/.qoder/rules/06-quality.md +12 -0
- package/templates/current/examples/.qoder/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/examples/.qoder/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/examples/.qoder/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/examples/.qoder/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/examples/.qoder/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/examples/.qoder/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/examples/.qoder/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/examples/.qoder/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/examples/.qoder/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/examples/.qoder/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/examples/.qoder/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/examples/AGENTS.md +16 -0
- package/templates/current/examples/README.md +116 -0
- package/templates/current/examples/component-catalog.json +765 -0
- package/templates/current/examples/e2e/admin-shell.spec.ts +150 -0
- package/templates/current/examples/e2e/demo-shell.spec.ts +328 -0
- package/templates/current/examples/evals/component-selection.json +29 -0
- package/templates/current/examples/gitignore +3 -0
- package/templates/current/examples/index.html +13 -0
- package/templates/current/examples/openapi.json +1623 -0
- package/templates/current/examples/package.json +65 -0
- package/templates/current/examples/playwright.config.ts +31 -0
- package/templates/current/examples/playwright.demo.config.ts +25 -0
- package/templates/current/examples/recipes/README.md +7 -0
- package/templates/current/examples/recipes/remote-crud-dialog-form.json +15 -0
- package/templates/current/examples/recipes/remote-crud-dialog-form.vue +66 -0
- package/templates/current/examples/scaffold.lock.json +12 -0
- package/templates/current/examples/scripts/check-admin-bundle.mjs +214 -0
- package/templates/current/examples/scripts/check-admin-scaffold.mjs +168 -0
- package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/Forbidden.vue +26 -0
- package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/NotFound.vue +26 -0
- package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/ServerError.vue +26 -0
- package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/error-pages.spec.ts +32 -0
- package/templates/current/examples/scripts/clean-overlay/src/main.ts +91 -0
- package/templates/current/examples/scripts/clean-overlay/src/router/componentRegistry.ts +25 -0
- package/templates/current/examples/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +47 -0
- package/templates/current/examples/scripts/clean-overlay/src/router/staticRoutes.ts +63 -0
- package/templates/current/examples/scripts/demo-api.ts +797 -0
- package/templates/current/examples/scripts/generate-api.ts +27 -0
- package/templates/current/examples/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +38 -0
- package/templates/current/examples/scripts/remove-examples.mjs +54 -0
- package/templates/current/examples/src/App.vue +67 -0
- package/templates/current/examples/src/api/client.spec.ts +66 -0
- package/templates/current/examples/src/api/client.ts +72 -0
- package/templates/current/examples/src/api/generated/data-contracts.ts +268 -0
- package/templates/current/examples/src/api/generated/http-client.ts +266 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/templates/current/examples/src/api/generated//350/256/244/350/257/201.ts +98 -0
- package/templates/current/examples/src/api/http-adapter.spec.ts +33 -0
- package/templates/current/examples/src/api/http-adapter.ts +83 -0
- package/templates/current/examples/src/api/index.ts +41 -0
- package/templates/current/examples/src/app/createAdminUi.spec.ts +110 -0
- package/templates/current/examples/src/app/createAdminUi.ts +78 -0
- package/templates/current/examples/src/app/menu.spec.ts +255 -0
- package/templates/current/examples/src/app/menu.ts +268 -0
- package/templates/current/examples/src/app/menuTypes.ts +17 -0
- package/templates/current/examples/src/app/origenUiLocale.spec.ts +14 -0
- package/templates/current/examples/src/app/origenUiLocale.ts +65 -0
- package/templates/current/examples/src/app/permission.ts +9 -0
- package/templates/current/examples/src/app/runtimeConfig.ts +77 -0
- package/templates/current/examples/src/demo-api.spec.ts +167 -0
- package/templates/current/examples/src/env.d.ts +14 -0
- package/templates/current/examples/src/features/appearance/components/ThemePanel.vue +200 -0
- package/templates/current/examples/src/features/appearance/composables/useTheme.ts +17 -0
- package/templates/current/examples/src/features/appearance/store/theme.ts +140 -0
- package/templates/current/examples/src/features/auth/pages/Login.vue +159 -0
- package/templates/current/examples/src/features/auth/store/auth.spec.ts +131 -0
- package/templates/current/examples/src/features/auth/store/auth.ts +210 -0
- package/templates/current/examples/src/features/errors/pages/Forbidden.vue +26 -0
- package/templates/current/examples/src/features/errors/pages/NotFound.vue +26 -0
- package/templates/current/examples/src/features/errors/pages/ServerError.vue +26 -0
- package/templates/current/examples/src/features/errors/pages/error-pages.spec.ts +32 -0
- package/templates/current/examples/src/features/feature-composables.spec.ts +208 -0
- package/templates/current/examples/src/features/security/components/DevtoolsProtectionOverlay.vue +56 -0
- package/templates/current/examples/src/features/security/devtoolsProtection.spec.ts +211 -0
- package/templates/current/examples/src/features/security/devtoolsProtection.ts +242 -0
- package/templates/current/examples/src/features/shell/components/AdminWatermark.spec.ts +90 -0
- package/templates/current/examples/src/features/shell/components/AdminWatermark.vue +47 -0
- package/templates/current/examples/src/features/shell/components/RouteProgress.vue +68 -0
- package/templates/current/examples/src/features/shell/composables/useRouteProgress.spec.ts +95 -0
- package/templates/current/examples/src/features/shell/composables/useRouteProgress.ts +52 -0
- package/templates/current/examples/src/features/shell/store/sidebar.ts +55 -0
- package/templates/current/examples/src/features/system/access/api/admin-repository.ts +279 -0
- package/templates/current/examples/src/features/system/access/api/rbac.spec.ts +72 -0
- package/templates/current/examples/src/features/system/access/api/rbac.ts +272 -0
- package/templates/current/examples/src/features/system/access/composables/useAuthorizationRefresh.ts +15 -0
- package/templates/current/examples/src/features/system/audit/composables/useAuditManagement.ts +117 -0
- package/templates/current/examples/src/features/system/audit/pages/AuditList.vue +20 -0
- package/templates/current/examples/src/features/system/menus/components/MenuEditorForm.vue +189 -0
- package/templates/current/examples/src/features/system/menus/composables/useMenuManagement.ts +327 -0
- package/templates/current/examples/src/features/system/menus/pages/MenuList.vue +49 -0
- package/templates/current/examples/src/features/system/roles/components/RoleEditorForm.vue +112 -0
- package/templates/current/examples/src/features/system/roles/composables/useRoleManagement.ts +198 -0
- package/templates/current/examples/src/features/system/roles/pages/RoleList.vue +45 -0
- package/templates/current/examples/src/features/system/users/components/UserEditorForm.vue +101 -0
- package/templates/current/examples/src/features/system/users/composables/useUserManagement.ts +233 -0
- package/templates/current/examples/src/features/system/users/pages/UserList.vue +49 -0
- package/templates/current/examples/src/features/workspace/pages/Dashboard.spec.ts +32 -0
- package/templates/current/examples/src/features/workspace/pages/Dashboard.vue +297 -0
- package/templates/current/examples/src/features/workspace/pages/Empty.vue +18 -0
- package/templates/current/examples/src/features/workspace/pages/Profile.vue +183 -0
- package/templates/current/examples/src/layouts/AdminLayout.vue +61 -0
- package/templates/current/examples/src/layouts/BreadcrumbBar.vue +27 -0
- package/templates/current/examples/src/layouts/SideMenu.vue +119 -0
- package/templates/current/examples/src/layouts/TopBar.vue +301 -0
- package/templates/current/examples/src/layouts/WorkspaceTabs.vue +44 -0
- package/templates/current/examples/src/layouts/topBarMenuSearch.spec.ts +31 -0
- package/templates/current/examples/src/layouts/topBarMenuSearch.ts +21 -0
- package/templates/current/examples/src/locales/en-US.ts +55 -0
- package/templates/current/examples/src/locales/index.ts +119 -0
- package/templates/current/examples/src/locales/messages.spec.ts +23 -0
- package/templates/current/examples/src/locales/zh-CN.ts +55 -0
- package/templates/current/examples/src/locales/zh-TW.ts +44 -0
- package/templates/current/examples/src/main.ts +91 -0
- package/templates/current/examples/src/router/bootstrap.ts +76 -0
- package/templates/current/examples/src/router/componentRegistry.ts +83 -0
- package/templates/current/examples/src/router/dynamicRoutes.spec.ts +109 -0
- package/templates/current/examples/src/router/dynamicRoutes.ts +162 -0
- package/templates/current/examples/src/router/guards.ts +5 -0
- package/templates/current/examples/src/router/queryEncryption.spec.ts +82 -0
- package/templates/current/examples/src/router/queryEncryption.ts +133 -0
- package/templates/current/examples/src/router/routeQuery.spec.ts +11 -0
- package/templates/current/examples/src/router/routeQuery.ts +3 -0
- package/templates/current/examples/src/router/runtimeErrorRecovery.spec.ts +161 -0
- package/templates/current/examples/src/router/runtimeErrorRecovery.ts +108 -0
- package/templates/current/examples/src/router/staticRoutes.ts +63 -0
- package/templates/current/examples/src/router/useRouteQueryDefaults.spec.ts +90 -0
- package/templates/current/examples/src/router/useRouteQueryDefaults.ts +51 -0
- package/templates/current/examples/src/router/useRouteQueryDefaults.types.ts +19 -0
- package/templates/current/examples/src/store/index.ts +3 -0
- package/templates/current/examples/src/styles/element/index.scss +33 -0
- package/templates/current/examples/src/styles/index.css +39 -0
- package/templates/current/examples/src/styles/layout.css +115 -0
- package/templates/current/examples/src/styles/shell.css +196 -0
- package/templates/current/examples/src/styles/source-package-style-compat.css +1 -0
- package/templates/current/examples/src/templates/og-form.ts +48 -0
- package/templates/current/examples/src/templates/og-table.ts +212 -0
- package/templates/current/examples/src/templates/router.ts +51 -0
- package/templates/current/examples/src/templates/templates.spec.ts +90 -0
- package/templates/current/examples/src/theme/index.ts +7 -0
- package/templates/current/examples/src/utils/__tests__/color-mix.spec.ts +39 -0
- package/templates/current/examples/src/utils/color-mix.ts +76 -0
- package/templates/current/examples/src/utils/permissions.ts +6 -0
- package/templates/current/examples/tsconfig.json +40 -0
- package/templates/current/examples/tsconfig.node.json +9 -0
- package/templates/current/examples/vite.build-policy.ts +405 -0
- package/templates/current/examples/vite.config.ts +37 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { RouterTabs } from '@origen-ui/router/tabs'
|
|
3
|
+
|
|
4
|
+
defineOptions({ name: 'WorkspaceTabs' })
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<RouterTabs class="workspace-tabs" />
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<style scoped>
|
|
12
|
+
.workspace-tabs {
|
|
13
|
+
flex: 0 0 auto;
|
|
14
|
+
min-height: 44px;
|
|
15
|
+
padding: 0 18px 0 0;
|
|
16
|
+
background: var(--el-bg-color);
|
|
17
|
+
border-bottom: 1px solid var(--og-workspace-divider);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.workspace-tabs :deep(.og-tabs__native .el-tabs__item) {
|
|
21
|
+
height: 43px;
|
|
22
|
+
margin-right: 4px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.workspace-tabs :deep(.og-tabs__native .el-tabs__item:nth-child(2)) {
|
|
26
|
+
padding-left: 8px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.workspace-tabs :deep(.og-tabs__actions) {
|
|
30
|
+
height: 43px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@media (max-width: 860px) {
|
|
34
|
+
.workspace-tabs {
|
|
35
|
+
padding: 0 14px 0 0;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@media (max-width: 620px) {
|
|
40
|
+
.workspace-tabs {
|
|
41
|
+
padding: 0 12px 0 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { RouteMenuItem } from '@origen-ui/router'
|
|
2
|
+
import { describe, expect, it } from 'vitest'
|
|
3
|
+
import { flattenMenuSearchOptions } from './topBarMenuSearch'
|
|
4
|
+
|
|
5
|
+
describe('flattenMenuSearchOptions', () => {
|
|
6
|
+
it('returns only navigable leaves with their visible hierarchy', () => {
|
|
7
|
+
const menu: RouteMenuItem[] = [
|
|
8
|
+
{
|
|
9
|
+
id: 'system',
|
|
10
|
+
label: 'System',
|
|
11
|
+
to: { name: 'system' },
|
|
12
|
+
children: [{ id: 'users', label: 'Users', to: { name: 'users' }, children: [] }],
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 'dashboard',
|
|
16
|
+
label: 'Dashboard',
|
|
17
|
+
to: { name: 'dashboard' },
|
|
18
|
+
children: [],
|
|
19
|
+
},
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
expect(flattenMenuSearchOptions(menu)).toEqual([
|
|
23
|
+
{ id: 'users', label: 'System / Users', to: { name: 'users' } },
|
|
24
|
+
{ id: 'dashboard', label: 'Dashboard', to: { name: 'dashboard' } },
|
|
25
|
+
])
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it('omits leaves without a navigation target', () => {
|
|
29
|
+
expect(flattenMenuSearchOptions([{ id: 'group', label: 'Group', children: [] }])).toEqual([])
|
|
30
|
+
})
|
|
31
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RouteMenuItem } from '@origen-ui/router'
|
|
2
|
+
import type { RouteLocationRaw } from 'vue-router'
|
|
3
|
+
|
|
4
|
+
export interface TopBarMenuSearchOption {
|
|
5
|
+
id: string
|
|
6
|
+
label: string
|
|
7
|
+
to: RouteLocationRaw
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Builds searchable destinations from the visible leaf menu items. */
|
|
11
|
+
export function flattenMenuSearchOptions(
|
|
12
|
+
items: readonly RouteMenuItem[],
|
|
13
|
+
ancestors: readonly string[] = [],
|
|
14
|
+
): TopBarMenuSearchOption[] {
|
|
15
|
+
return items.flatMap((item) => {
|
|
16
|
+
const hierarchy = [...ancestors, item.label]
|
|
17
|
+
if (item.children.length) return flattenMenuSearchOptions(item.children, hierarchy)
|
|
18
|
+
if (!item.to) return []
|
|
19
|
+
return [{ id: item.id, label: hierarchy.join(' / '), to: item.to }]
|
|
20
|
+
})
|
|
21
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { OG_DIALOG_LOCALE_EN_US } from '@origen-ui/dialog/locale'
|
|
2
|
+
import { OG_EDITOR_LOCALE_EN_US } from '@origen-ui/editor/locale'
|
|
3
|
+
import { OG_FORM_LOCALE_EN_US } from '@origen-ui/form/locale'
|
|
4
|
+
import { OG_SEARCH_LOCALE_EN_US } from '@origen-ui/search/locale'
|
|
5
|
+
import { OG_TABLE_LOCALE_EN_US } from '@origen-ui/table/locale'
|
|
6
|
+
import { OG_TABS_LOCALE_EN_US } from '@origen-ui/tabs/locale'
|
|
7
|
+
import { OG_UPLOAD_LOCALE_EN_US } from '@origen-ui/upload/locale'
|
|
8
|
+
import enElement from 'element-plus/es/locale/lang/en'
|
|
9
|
+
import { defineOrigenUiLanguage } from 'origen-ui/language'
|
|
10
|
+
|
|
11
|
+
const messages = {
|
|
12
|
+
app: {
|
|
13
|
+
title: 'Origen UI Admin Console',
|
|
14
|
+
},
|
|
15
|
+
menu: {
|
|
16
|
+
dashboard: 'Dashboard',
|
|
17
|
+
profile: 'Profile',
|
|
18
|
+
system: {
|
|
19
|
+
label: 'System',
|
|
20
|
+
userList: 'Users',
|
|
21
|
+
roleList: 'Roles',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
auth: {
|
|
25
|
+
login: 'Sign in',
|
|
26
|
+
logout: 'Sign out',
|
|
27
|
+
username: 'Username',
|
|
28
|
+
password: 'Password',
|
|
29
|
+
},
|
|
30
|
+
shell: {
|
|
31
|
+
applicationNavigation: 'Application navigation',
|
|
32
|
+
collapseNavigation: 'Collapse navigation',
|
|
33
|
+
expandNavigation: 'Expand navigation',
|
|
34
|
+
languageLoadFailed: 'Unable to load language. Please try again.',
|
|
35
|
+
openUserMenu: 'Open user menu',
|
|
36
|
+
preferences: 'Preferences',
|
|
37
|
+
searchMenu: 'Search menus or pages',
|
|
38
|
+
},
|
|
39
|
+
errors: { forbidden: 'Access denied', notFound: 'Page not found', server: 'Server error' },
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default defineOrigenUiLanguage({
|
|
43
|
+
locale: 'en-US',
|
|
44
|
+
messages,
|
|
45
|
+
elementPlus: enElement,
|
|
46
|
+
origenUi: {
|
|
47
|
+
dialog: OG_DIALOG_LOCALE_EN_US,
|
|
48
|
+
editor: OG_EDITOR_LOCALE_EN_US,
|
|
49
|
+
form: OG_FORM_LOCALE_EN_US,
|
|
50
|
+
search: OG_SEARCH_LOCALE_EN_US,
|
|
51
|
+
table: OG_TABLE_LOCALE_EN_US,
|
|
52
|
+
tabs: OG_TABS_LOCALE_EN_US,
|
|
53
|
+
upload: OG_UPLOAD_LOCALE_EN_US,
|
|
54
|
+
},
|
|
55
|
+
})
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { AdapterRouteMeta } from '@origen-ui/router'
|
|
2
|
+
import type { OrigenUiMessages } from 'origen-ui'
|
|
3
|
+
import type { OrigenUiLanguageModule, OrigenUiLanguageRuntime } from 'origen-ui/language'
|
|
4
|
+
import type { App } from 'vue'
|
|
5
|
+
import type { I18n } from 'vue-i18n'
|
|
6
|
+
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
|
7
|
+
import { createOrigenUiLanguageRuntime } from 'origen-ui/language'
|
|
8
|
+
import { watch } from 'vue'
|
|
9
|
+
import { createI18n } from 'vue-i18n'
|
|
10
|
+
import { appRuntimeConfig } from '../app/runtimeConfig'
|
|
11
|
+
import zhCN from './zh-CN'
|
|
12
|
+
|
|
13
|
+
export type AdminLocale = 'zh-CN' | 'en-US' | 'zh-TW'
|
|
14
|
+
export type AdminLanguageModule = OrigenUiLanguageModule<
|
|
15
|
+
Record<string, unknown>,
|
|
16
|
+
unknown,
|
|
17
|
+
OrigenUiMessages
|
|
18
|
+
>
|
|
19
|
+
|
|
20
|
+
export const SUPPORTED_LOCALES: readonly AdminLocale[] = ['zh-CN', 'en-US', 'zh-TW']
|
|
21
|
+
export const LOCALE_STORAGE_KEY = 'og-admin-locale'
|
|
22
|
+
|
|
23
|
+
export function normalizeAdminLocale(value: unknown): AdminLocale | undefined {
|
|
24
|
+
if (typeof value !== 'string') return undefined
|
|
25
|
+
const normalized = value.trim().toLowerCase()
|
|
26
|
+
if (normalized === 'zh' || normalized === 'zh-hans' || normalized === 'zh-cn') return 'zh-CN'
|
|
27
|
+
if (normalized === 'zh-hant' || normalized === 'zh-tw' || normalized === 'zh-hk') return 'zh-TW'
|
|
28
|
+
if (normalized === 'en' || normalized === 'en-us') return 'en-US'
|
|
29
|
+
return undefined
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function readPersistedLocale(): AdminLocale | undefined {
|
|
33
|
+
if (typeof localStorage === 'undefined') return undefined
|
|
34
|
+
try {
|
|
35
|
+
return normalizeAdminLocale(localStorage.getItem(LOCALE_STORAGE_KEY))
|
|
36
|
+
} catch {
|
|
37
|
+
return undefined
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function resolveInitialLocale(): AdminLocale {
|
|
42
|
+
return (
|
|
43
|
+
readPersistedLocale() ??
|
|
44
|
+
normalizeAdminLocale(import.meta.env.VITE_DEFAULT_LOCALE) ??
|
|
45
|
+
(typeof navigator !== 'undefined' ? normalizeAdminLocale(navigator.language) : undefined) ??
|
|
46
|
+
normalizeAdminLocale(appRuntimeConfig.locale.default) ??
|
|
47
|
+
'zh-CN'
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const loaders = {
|
|
52
|
+
'en-US': () => import('./en-US'),
|
|
53
|
+
'zh-TW': () => import('./zh-TW'),
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface AdminI18nRuntime {
|
|
57
|
+
i18n: I18n
|
|
58
|
+
language: OrigenUiLanguageRuntime<Record<string, unknown>, unknown, OrigenUiMessages>
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function createAdminTitleResolver(
|
|
62
|
+
i18n: I18n,
|
|
63
|
+
): (route: RouteLocationNormalizedLoaded, meta: AdapterRouteMeta) => string | undefined {
|
|
64
|
+
return (_route, meta) => {
|
|
65
|
+
if (!meta.titleKey) return meta.title
|
|
66
|
+
const global = i18n.global as { te?: (key: string) => boolean, t: (key: string) => string }
|
|
67
|
+
return global.te?.(meta.titleKey) ? global.t(meta.titleKey) : meta.title
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function createAdminI18n(existing?: I18n): AdminI18nRuntime {
|
|
72
|
+
const initial = resolveInitialLocale()
|
|
73
|
+
const i18n =
|
|
74
|
+
existing ??
|
|
75
|
+
createI18n({
|
|
76
|
+
legacy: false,
|
|
77
|
+
locale: initial,
|
|
78
|
+
fallbackLocale: 'zh-CN',
|
|
79
|
+
messages: { 'zh-CN': zhCN.messages ?? {} },
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const language = createOrigenUiLanguageRuntime<Record<string, unknown>, unknown, OrigenUiMessages>({
|
|
83
|
+
initial,
|
|
84
|
+
loaders: {
|
|
85
|
+
'zh-CN': () => zhCN,
|
|
86
|
+
...loaders,
|
|
87
|
+
},
|
|
88
|
+
bridge: {
|
|
89
|
+
prepare: (module) => {
|
|
90
|
+
if (module.messages) i18n.global.setLocaleMessage(module.locale, module.messages)
|
|
91
|
+
},
|
|
92
|
+
install: (app: App, runtime) => {
|
|
93
|
+
const sync = () => {
|
|
94
|
+
if (typeof i18n.global.locale === 'string') i18n.global.locale = runtime.current.value
|
|
95
|
+
else i18n.global.locale.value = runtime.current.value
|
|
96
|
+
if (typeof document !== 'undefined') {
|
|
97
|
+
document.documentElement.lang = runtime.current.value
|
|
98
|
+
document.documentElement.dir = runtime.active.value.direction ?? 'ltr'
|
|
99
|
+
}
|
|
100
|
+
if (runtime.status.value === 'ready' && typeof localStorage !== 'undefined') {
|
|
101
|
+
try {
|
|
102
|
+
localStorage.setItem(LOCALE_STORAGE_KEY, runtime.current.value)
|
|
103
|
+
} catch {
|
|
104
|
+
// Storage is optional; language switching remains usable when unavailable.
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const stop = watch([runtime.current, runtime.active, runtime.status], sync, {
|
|
109
|
+
immediate: true,
|
|
110
|
+
flush: 'sync',
|
|
111
|
+
})
|
|
112
|
+
const onUnmount = (app as App & { onUnmount?: (fn: () => void) => void }).onUnmount
|
|
113
|
+
onUnmount?.call(app, stop)
|
|
114
|
+
return stop
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
})
|
|
118
|
+
return { i18n, language }
|
|
119
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { I18nOptions } from 'vue-i18n'
|
|
2
|
+
import { describe, expect, it } from 'vitest'
|
|
3
|
+
import { createI18n } from 'vue-i18n'
|
|
4
|
+
import enUS from './en-US'
|
|
5
|
+
import zhCN from './zh-CN'
|
|
6
|
+
import zhTW from './zh-TW'
|
|
7
|
+
|
|
8
|
+
const modules = [zhCN, enUS, zhTW]
|
|
9
|
+
|
|
10
|
+
describe('admin locale messages', () => {
|
|
11
|
+
it.each(modules)('compiles the app title for $locale', (module) => {
|
|
12
|
+
const i18n = createI18n({
|
|
13
|
+
legacy: false,
|
|
14
|
+
locale: module.locale,
|
|
15
|
+
messages: { [module.locale]: module.messages ?? {} },
|
|
16
|
+
} as I18nOptions)
|
|
17
|
+
|
|
18
|
+
const title = i18n.global.t('app.title')
|
|
19
|
+
|
|
20
|
+
expect(title).not.toContain('@')
|
|
21
|
+
expect(title).not.toBe('app.title')
|
|
22
|
+
})
|
|
23
|
+
})
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { OG_DIALOG_LOCALE_ZH_CN } from '@origen-ui/dialog/locale'
|
|
2
|
+
import { OG_EDITOR_LOCALE_ZH_CN } from '@origen-ui/editor/locale'
|
|
3
|
+
import { OG_FORM_LOCALE_ZH_CN } from '@origen-ui/form/locale'
|
|
4
|
+
import { OG_SEARCH_LOCALE_ZH_CN } from '@origen-ui/search/locale'
|
|
5
|
+
import { OG_TABLE_LOCALE_ZH_CN } from '@origen-ui/table/locale'
|
|
6
|
+
import { OG_TABS_LOCALE_ZH_CN } from '@origen-ui/tabs/locale'
|
|
7
|
+
import { OG_UPLOAD_LOCALE_ZH_CN } from '@origen-ui/upload/locale'
|
|
8
|
+
import zhCnElement from 'element-plus/es/locale/lang/zh-cn'
|
|
9
|
+
import { defineOrigenUiLanguage } from 'origen-ui/language'
|
|
10
|
+
|
|
11
|
+
const messages = {
|
|
12
|
+
app: {
|
|
13
|
+
title: 'Origen UI Admin Console',
|
|
14
|
+
},
|
|
15
|
+
menu: {
|
|
16
|
+
dashboard: '仪表盘',
|
|
17
|
+
profile: '个人资料',
|
|
18
|
+
system: {
|
|
19
|
+
label: '系统管理',
|
|
20
|
+
userList: '用户管理',
|
|
21
|
+
roleList: '角色管理',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
auth: {
|
|
25
|
+
login: '登录',
|
|
26
|
+
logout: '退出登录',
|
|
27
|
+
username: '账号',
|
|
28
|
+
password: '密码',
|
|
29
|
+
},
|
|
30
|
+
shell: {
|
|
31
|
+
applicationNavigation: '应用导航',
|
|
32
|
+
collapseNavigation: '折叠侧边栏',
|
|
33
|
+
expandNavigation: '展开侧边栏',
|
|
34
|
+
languageLoadFailed: '语言加载失败,请稍后重试',
|
|
35
|
+
openUserMenu: '打开用户菜单',
|
|
36
|
+
preferences: '偏好设置',
|
|
37
|
+
searchMenu: '搜索菜单或页面',
|
|
38
|
+
},
|
|
39
|
+
errors: { forbidden: '无权访问', notFound: '页面不存在', server: '服务异常' },
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default defineOrigenUiLanguage({
|
|
43
|
+
locale: 'zh-CN',
|
|
44
|
+
messages,
|
|
45
|
+
elementPlus: zhCnElement,
|
|
46
|
+
origenUi: {
|
|
47
|
+
dialog: OG_DIALOG_LOCALE_ZH_CN,
|
|
48
|
+
editor: OG_EDITOR_LOCALE_ZH_CN,
|
|
49
|
+
form: OG_FORM_LOCALE_ZH_CN,
|
|
50
|
+
search: OG_SEARCH_LOCALE_ZH_CN,
|
|
51
|
+
table: OG_TABLE_LOCALE_ZH_CN,
|
|
52
|
+
tabs: OG_TABS_LOCALE_ZH_CN,
|
|
53
|
+
upload: OG_UPLOAD_LOCALE_ZH_CN,
|
|
54
|
+
},
|
|
55
|
+
})
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { OG_DIALOG_LOCALE_ZH_TW } from '@origen-ui/dialog/locale'
|
|
2
|
+
import { OG_EDITOR_LOCALE_ZH_TW } from '@origen-ui/editor/locale'
|
|
3
|
+
import { OG_FORM_LOCALE_ZH_TW } from '@origen-ui/form/locale'
|
|
4
|
+
import { OG_SEARCH_LOCALE_ZH_TW } from '@origen-ui/search/locale'
|
|
5
|
+
import { OG_TABLE_LOCALE_ZH_TW } from '@origen-ui/table/locale'
|
|
6
|
+
import { OG_TABS_LOCALE_ZH_TW } from '@origen-ui/tabs/locale'
|
|
7
|
+
import { OG_UPLOAD_LOCALE_ZH_TW } from '@origen-ui/upload/locale'
|
|
8
|
+
import zhTwElement from 'element-plus/es/locale/lang/zh-tw'
|
|
9
|
+
import { defineOrigenUiLanguage } from 'origen-ui/language'
|
|
10
|
+
|
|
11
|
+
const messages = {
|
|
12
|
+
app: { title: '禾數營運控制台' },
|
|
13
|
+
menu: {
|
|
14
|
+
dashboard: '儀表板',
|
|
15
|
+
profile: '個人資料',
|
|
16
|
+
system: { label: '系統管理', userList: '使用者管理', roleList: '角色管理' },
|
|
17
|
+
},
|
|
18
|
+
auth: { login: '登入', logout: '登出', username: '帳號', password: '密碼' },
|
|
19
|
+
shell: {
|
|
20
|
+
applicationNavigation: '應用程式導覽',
|
|
21
|
+
collapseNavigation: '收合側邊欄',
|
|
22
|
+
expandNavigation: '展開側邊欄',
|
|
23
|
+
languageLoadFailed: '語言載入失敗,請稍後再試。',
|
|
24
|
+
openUserMenu: '開啟使用者選單',
|
|
25
|
+
preferences: '偏好設定',
|
|
26
|
+
searchMenu: '搜尋選單或頁面',
|
|
27
|
+
},
|
|
28
|
+
errors: { forbidden: '沒有存取權限', notFound: '找不到頁面', server: '服務錯誤' },
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default defineOrigenUiLanguage({
|
|
32
|
+
locale: 'zh-TW',
|
|
33
|
+
messages,
|
|
34
|
+
elementPlus: zhTwElement,
|
|
35
|
+
origenUi: {
|
|
36
|
+
dialog: OG_DIALOG_LOCALE_ZH_TW,
|
|
37
|
+
editor: OG_EDITOR_LOCALE_ZH_TW,
|
|
38
|
+
form: OG_FORM_LOCALE_ZH_TW,
|
|
39
|
+
search: OG_SEARCH_LOCALE_ZH_TW,
|
|
40
|
+
table: OG_TABLE_LOCALE_ZH_TW,
|
|
41
|
+
tabs: OG_TABS_LOCALE_ZH_TW,
|
|
42
|
+
upload: OG_UPLOAD_LOCALE_ZH_TW,
|
|
43
|
+
},
|
|
44
|
+
})
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { createApp } from 'vue'
|
|
2
|
+
import App from './App.vue'
|
|
3
|
+
import { permission } from './app/permission'
|
|
4
|
+
import { useAuthStore } from './features/auth/store/auth'
|
|
5
|
+
import { devtoolsProtection } from './features/security/devtoolsProtection'
|
|
6
|
+
import { createRuntimeErrorRecovery, createStaleAssetRecovery } from './router/runtimeErrorRecovery'
|
|
7
|
+
import { pinia } from './store'
|
|
8
|
+
import 'element-plus/theme-chalk/src/tabs.scss'
|
|
9
|
+
import 'origen-ui/tabs.css'
|
|
10
|
+
import '@origen-ui/router/style.css'
|
|
11
|
+
import './styles/index.css'
|
|
12
|
+
import './styles/layout.css'
|
|
13
|
+
import './styles/shell.css'
|
|
14
|
+
|
|
15
|
+
async function notifyRuntimeError(message: string): Promise<void> {
|
|
16
|
+
const { ElMessage } = await import('element-plus/es/components/message/index.mjs')
|
|
17
|
+
ElMessage.error(message)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function bootstrap(): Promise<void> {
|
|
21
|
+
devtoolsProtection.start()
|
|
22
|
+
const { createAdminI18n, createAdminTitleResolver } = await import('./locales')
|
|
23
|
+
const { i18n, language } = createAdminI18n()
|
|
24
|
+
const { initializeRouting } = await import('./router/bootstrap')
|
|
25
|
+
const queryCodecs =
|
|
26
|
+
import.meta.env.VITE_ROUTE_QUERY_ENCRYPTION === 'true'
|
|
27
|
+
? (await import('./router/queryEncryption')).createRouteQueryEncryption({
|
|
28
|
+
enabled: true,
|
|
29
|
+
key: import.meta.env.VITE_ROUTE_QUERY_KEY,
|
|
30
|
+
})
|
|
31
|
+
: undefined
|
|
32
|
+
const routing = initializeRouting(queryCodecs, {
|
|
33
|
+
resolveTitle: createAdminTitleResolver(i18n),
|
|
34
|
+
titleRevision: language.current,
|
|
35
|
+
})
|
|
36
|
+
const app = createApp(App)
|
|
37
|
+
app.use(pinia)
|
|
38
|
+
app.use(permission)
|
|
39
|
+
const recoverRuntimeError = createRuntimeErrorRecovery(routing.router)
|
|
40
|
+
const staleAssetRecovery = createStaleAssetRecovery({
|
|
41
|
+
router: routing.router,
|
|
42
|
+
window,
|
|
43
|
+
recoverRuntimeError,
|
|
44
|
+
})
|
|
45
|
+
app.use(i18n)
|
|
46
|
+
language.install(app)
|
|
47
|
+
const { createAdminUi } = await import('./app/createAdminUi')
|
|
48
|
+
app.use(createAdminUi(language))
|
|
49
|
+
app.config.errorHandler = (error: unknown) => {
|
|
50
|
+
const message = error instanceof Error ? error.message : '页面发生未知错误'
|
|
51
|
+
void notifyRuntimeError(message)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const auth = useAuthStore(pinia)
|
|
55
|
+
const session = await auth.fetchSession()
|
|
56
|
+
app.use(routing)
|
|
57
|
+
await Promise.all([
|
|
58
|
+
language.ready,
|
|
59
|
+
routing.ready(),
|
|
60
|
+
session ? import('./layouts/AdminLayout.vue') : Promise.resolve(),
|
|
61
|
+
])
|
|
62
|
+
const reportRuntimeError = app.config.errorHandler
|
|
63
|
+
const { authorizationRefreshKey } =
|
|
64
|
+
await import('./features/system/access/composables/useAuthorizationRefresh')
|
|
65
|
+
app.config.errorHandler = (error, instance, info) => {
|
|
66
|
+
reportRuntimeError?.(error, instance, info)
|
|
67
|
+
if (!staleAssetRecovery.handle(error)) recoverRuntimeError()
|
|
68
|
+
}
|
|
69
|
+
app.provide(authorizationRefreshKey, async () => {
|
|
70
|
+
await auth.refreshAuthorization()
|
|
71
|
+
await routing.replaceDynamicRoutes(undefined, { fallback: '/workspace' })
|
|
72
|
+
})
|
|
73
|
+
app.mount('#app')
|
|
74
|
+
staleAssetRecovery.clear()
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
void bootstrap().catch((error: unknown) => {
|
|
78
|
+
const message = error instanceof Error ? error.message : '应用启动失败'
|
|
79
|
+
const root = document.querySelector('#app')
|
|
80
|
+
if (root) {
|
|
81
|
+
const panel = document.createElement('main')
|
|
82
|
+
panel.style.padding = '32px'
|
|
83
|
+
panel.style.fontFamily = 'system-ui, sans-serif'
|
|
84
|
+
const heading = document.createElement('h1')
|
|
85
|
+
heading.textContent = '@origen-ui/admin 启动失败'
|
|
86
|
+
const detail = document.createElement('p')
|
|
87
|
+
detail.textContent = message
|
|
88
|
+
panel.append(heading, detail)
|
|
89
|
+
root.replaceChildren(panel)
|
|
90
|
+
}
|
|
91
|
+
})
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { RouterAdapter } from '@origen-ui/router'
|
|
2
|
+
import type { BackendMenuNode } from '../app/menuTypes'
|
|
3
|
+
import {
|
|
4
|
+
createAccessPolicy,
|
|
5
|
+
createRouterAdapter,
|
|
6
|
+
createWebStorageAdapter,
|
|
7
|
+
} from '@origen-ui/router'
|
|
8
|
+
import { createWebHistory } from 'vue-router'
|
|
9
|
+
import { fetchMenus } from '../app/menu'
|
|
10
|
+
import { appRuntimeConfig } from '../app/runtimeConfig'
|
|
11
|
+
import { useAuthStore } from '../features/auth/store/auth'
|
|
12
|
+
import { pinia } from '../store'
|
|
13
|
+
import { hasPermission } from '../utils/permissions'
|
|
14
|
+
import { componentRegistry, routeTransformer } from './dynamicRoutes'
|
|
15
|
+
import { staticRoutes } from './staticRoutes'
|
|
16
|
+
|
|
17
|
+
type QueryCodecs = Pick<
|
|
18
|
+
NonNullable<Parameters<typeof createRouterAdapter<BackendMenuNode>>[0]>,
|
|
19
|
+
'parseQuery' | 'stringifyQuery'
|
|
20
|
+
>
|
|
21
|
+
|
|
22
|
+
type TitleOptions = Pick<
|
|
23
|
+
NonNullable<Parameters<typeof createRouterAdapter<BackendMenuNode>>[0]>,
|
|
24
|
+
'resolveTitle' | 'titleRevision'
|
|
25
|
+
>
|
|
26
|
+
|
|
27
|
+
let routing: RouterAdapter<BackendMenuNode> | undefined
|
|
28
|
+
|
|
29
|
+
export function getRouting(): RouterAdapter<BackendMenuNode> {
|
|
30
|
+
if (!routing) {
|
|
31
|
+
throw new Error('Routing has not been initialized yet')
|
|
32
|
+
}
|
|
33
|
+
return routing
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function initializeRouting(
|
|
37
|
+
queryCodecs?: QueryCodecs,
|
|
38
|
+
titleOptions?: TitleOptions,
|
|
39
|
+
): RouterAdapter<BackendMenuNode> {
|
|
40
|
+
if (routing) return routing
|
|
41
|
+
const workspace = appRuntimeConfig.router.workspace
|
|
42
|
+
routing = createRouterAdapter<BackendMenuNode>({
|
|
43
|
+
history: createWebHistory(),
|
|
44
|
+
staticRoutes,
|
|
45
|
+
...queryCodecs,
|
|
46
|
+
...titleOptions,
|
|
47
|
+
access: createAccessPolicy({
|
|
48
|
+
getSession: () => useAuthStore(pinia).session,
|
|
49
|
+
canAccess: (to, session) => hasPermission(session, to.meta.adapter?.permissions ?? []),
|
|
50
|
+
loginRoute: { name: 'login' },
|
|
51
|
+
forbiddenRoute: { name: '403' },
|
|
52
|
+
}),
|
|
53
|
+
dynamic: {
|
|
54
|
+
load: fetchMenus,
|
|
55
|
+
transform: routeTransformer,
|
|
56
|
+
resolveComponent: (key) => componentRegistry.get(key),
|
|
57
|
+
},
|
|
58
|
+
fallbacks: {
|
|
59
|
+
notFound: { name: '404' },
|
|
60
|
+
error: { name: '500' },
|
|
61
|
+
},
|
|
62
|
+
workspace: {
|
|
63
|
+
enabled: workspace.enabled,
|
|
64
|
+
persistence:
|
|
65
|
+
typeof window === 'undefined'
|
|
66
|
+
? undefined
|
|
67
|
+
: {
|
|
68
|
+
storage: createWebStorageAdapter(window.localStorage),
|
|
69
|
+
key: workspace.key,
|
|
70
|
+
version: workspace.version,
|
|
71
|
+
scope: workspace.scope,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
return routing
|
|
76
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Component } from 'vue'
|
|
2
|
+
import { RouterViewHost } from '@origen-ui/router'
|
|
3
|
+
|
|
4
|
+
type ComponentLoader = () => Promise<Component>
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* componentKey → 页面组件 name 映射,用于生成 KeepAlive 缓存名单。
|
|
8
|
+
*
|
|
9
|
+
* KeepAlive 的 `:include` 匹配的是页面组件渲染后的 name(SFC `defineOptions({ name })`),
|
|
10
|
+
* 因此这里的值必须与各页面组件的 defineOptions name 完全一致,否则缓存失效。
|
|
11
|
+
* 修改组件 name 时必须同步更新此表,并保持 dynamicRoutes.spec.ts 断言一致。
|
|
12
|
+
*/
|
|
13
|
+
export const componentCacheNames: Readonly<Record<string, string>> = {
|
|
14
|
+
workspace: 'EmptyPage',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const fallbackComponentKey = 'workspace'
|
|
18
|
+
|
|
19
|
+
export const componentRegistry: Map<string, ComponentLoader> = new Map([
|
|
20
|
+
[
|
|
21
|
+
'workspace',
|
|
22
|
+
() => import('../features/workspace/pages/Empty.vue').then((module) => module.default),
|
|
23
|
+
],
|
|
24
|
+
['outlet', () => Promise.resolve(RouterViewHost)],
|
|
25
|
+
])
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { componentCacheNames } from './componentRegistry'
|
|
3
|
+
import { componentRegistry, routeTransformer } from './dynamicRoutes'
|
|
4
|
+
import { staticRoutes } from './staticRoutes'
|
|
5
|
+
|
|
6
|
+
describe('clean dynamic component registry', () => {
|
|
7
|
+
it('contains only the workspace shell and nested outlet', () => {
|
|
8
|
+
expect([...componentRegistry.keys()]).toEqual(['workspace', 'outlet'])
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
it('uses the empty workspace for an unspecified leaf component', () => {
|
|
12
|
+
const [route] = routeTransformer([
|
|
13
|
+
{ code: 'workspace', path: '/workspace', title: 'Workspace' },
|
|
14
|
+
])
|
|
15
|
+
|
|
16
|
+
expect(route?.componentKey).toBe('workspace')
|
|
17
|
+
expect(componentRegistry.has('workspace')).toBe(true)
|
|
18
|
+
})
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
describe('clean keep-alive cache names', () => {
|
|
22
|
+
it('maps the workspace componentKey to the EmptyPage component name', () => {
|
|
23
|
+
expect(componentCacheNames).toEqual({ workspace: 'EmptyPage' })
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('generates cache.name from the component name mapping for cached dynamic routes', () => {
|
|
27
|
+
const [workspace] = routeTransformer([
|
|
28
|
+
{ code: 'workspace', path: '/workspace', title: 'Workspace', componentKey: 'workspace', cache: true },
|
|
29
|
+
])
|
|
30
|
+
|
|
31
|
+
expect(workspace?.meta?.cache).toEqual({ enabled: true, name: 'EmptyPage' })
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('omits cache meta when the source disables caching', () => {
|
|
35
|
+
const [workspace] = routeTransformer([
|
|
36
|
+
{ code: 'workspace', path: '/workspace', title: 'Workspace', componentKey: 'workspace', cache: false },
|
|
37
|
+
])
|
|
38
|
+
|
|
39
|
+
expect(workspace?.meta?.cache).toBeUndefined()
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it('keeps the static /profile route cache name in sync with the ProfilePage component', () => {
|
|
43
|
+
const profile = staticRoutes.find((route) => route.name === 'profile')
|
|
44
|
+
|
|
45
|
+
expect(profile?.meta?.adapter?.cache).toEqual({ enabled: true, name: 'ProfilePage' })
|
|
46
|
+
})
|
|
47
|
+
})
|