@team-codeme/crud-forge 0.0.0-stage → 1.0.1
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/.cursor/agents/generator-engineer.md +31 -0
- package/.cursor/agents/keycloak-engineer.md +33 -0
- package/.cursor/agents/qa-engineer.md +32 -0
- package/.cursor/agents/security-reviewer.md +30 -0
- package/.cursor/mcp.json +13 -0
- package/.cursor/rules/crudforge-precautions.mdc +16 -0
- package/.cursor/rules/playwright-browser.mdc +30 -0
- package/.cursor/rules/readme-todo-sync.mdc +13 -0
- package/.env.qa.example +19 -0
- package/.github/workflows/qa-live.yml +32 -0
- package/.github/workflows/qa.yml +27 -0
- package/.vscode/settings.json +32 -0
- package/QA/IAM-PLAN.md +25 -0
- package/QA/IAM-RESULTS.md +39 -0
- package/QA/IAM-TESTCASES.md +36 -0
- package/QA/IAM-TODO.md +7 -0
- package/QA/KEYCLOAK-BOOTSTRAP.md +105 -0
- package/QA/PLAN.md +43 -0
- package/QA/RESULTS.md +59 -0
- package/QA/TESTCASES.md +65 -0
- package/QA/TODO.md +14 -0
- package/QA/pmb-dev/README.md +49 -0
- package/QA/pmb-dev/config/config.yml +152 -0
- package/QA/pmb-dev/gdl/i.gdl +17 -0
- package/README.md +851 -2
- package/Todo.md +207 -0
- package/assets/branding/crudforge-logo.png +0 -0
- package/assets/branding/crudforge-mark.png +0 -0
- package/branding/poster-crudforge.jpg +0 -0
- package/chat/last-chat/Investigating Mock Data Configuration.md +428 -0
- package/cli.js +167 -0
- package/config/default-config.yml +245 -0
- package/docs/performance/README.md +217 -0
- package/docs/performance/after.json +111 -0
- package/docs/performance/before.json +111 -0
- package/docs/quality/README.md +276 -0
- package/e2e/crudforge.e2e.yml +47 -0
- package/e2e/crudforge.field-profile.yml +33 -0
- package/e2e/crudforge.iam-live.yml +124 -0
- package/e2e/crudforge.iam.yml +62 -0
- package/e2e/tests/field-profile.spec.js +152 -0
- package/e2e/tests/generated-crud.spec.js +251 -0
- package/e2e/tests/iam-live.spec.js +149 -0
- package/e2e/tests/iam-pack.spec.js +151 -0
- package/e2e/tests/list-state.spec.js +73 -0
- package/features.csv +27 -0
- package/fuse-starter-pack/branding/crudforge-mark-source.jpg +0 -0
- package/fuse-starter-pack/branding/crudforge-mark-source.png +0 -0
- package/fuse-starter-pack/branding/crudforge-mark.png +0 -0
- package/fuse-starter-pack/branding/crudforge-wordmark-source.jpg +0 -0
- package/fuse-starter-pack/branding/crudforge-wordmark-source.png +0 -0
- package/fuse-starter-pack/branding/crudforge-wordmark.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/Dockerfile +14 -0
- package/fuse-starter-pack/fuse-v21.1/LICENSE.md +6 -0
- package/fuse-starter-pack/fuse-v21.1/README.md +59 -0
- package/fuse-starter-pack/fuse-v21.1/angular.json +113 -0
- package/fuse-starter-pack/fuse-v21.1/eslint.config.ts +150 -0
- package/fuse-starter-pack/fuse-v21.1/nginx.conf +23 -0
- package/fuse-starter-pack/fuse-v21.1/nginx.dev.conf +18 -0
- package/fuse-starter-pack/fuse-v21.1/package-lock.json +11513 -0
- package/fuse-starter-pack/fuse-v21.1/package.json +69 -0
- package/fuse-starter-pack/fuse-v21.1/postcss.config.json +5 -0
- package/fuse-starter-pack/fuse-v21.1/prettier.config.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/proxy.conf.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/proxy.dev.conf.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/public/favicon.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/Geist-Italic.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/Geist.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/GeistMono-Italic.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/GeistMono.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/i18n/en.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/public/i18n/es.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/flags/ES.svg +79 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/flags/US.svg +14 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/flags/where-to-find-other-flags.txt +5 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/logo/logo-mark.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/logo/logo.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/push.sh +27 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.config.server.ts +10 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.config.ts +64 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.routes.server.ts +8 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.routes.ts +39 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.ts +22 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/icons/index.ts +1 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/icons/lucide.ts +1 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/icons/provider.ts +23 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/local-storage/index.ts +2 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/local-storage/local-storage.ts +109 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/local-storage/provider.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/media/index.ts +2 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/media/media.ts +64 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/media/provider.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/index.ts +3 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/models/theming.ts +13 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/palette.ts +209 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/provider.ts +24 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/theming.ts +129 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/transloco/transloco-http-loader.ts +12 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/data/navigation.ts +176 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/layout.ts +77 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/language-switcher.ts +91 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/navigation.ts +238 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/notifications.ts +252 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/scheme-switcher.ts +58 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/sidebar.ts +31 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/user.ts +132 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/data/academy.ts +753 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/data/model.ts +27 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/features/course.ts +318 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/features/courses.ts +228 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/routes.ts +14 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/data/contacts.ts +4372 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/data/model.ts +34 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/features/contact.ts +239 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/features/contacts.ts +185 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/data/file-manager.ts +261 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/data/model.ts +12 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/features/file-manager.ts +131 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/routes.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/ui/list.ts +164 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/faq.ts +288 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/guide.ts +134 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/home.ts +219 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/support.ts +161 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/routes.ts +33 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/data/model.ts +18 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/data/notes.ts +324 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/features/note.ts +152 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/features/notes.ts +118 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/data/model.ts +17 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/data/tasks.ts +562 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/features/task.ts +195 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/features/tasks.ts +271 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/data/analytics.ts +1620 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/data/finance.ts +1065 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/data/project.ts +376 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/analytics/analytics.ts +1096 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/finance/finance.ts +658 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/project/budget-table.ts +188 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/project/project.ts +565 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/routes.ts +23 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/changelog/changelog.ts +932 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/getting-started/building.ts +33 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/getting-started/development.ts +42 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/getting-started/installation.ts +47 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/routes.ts +45 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/error/features/error-page.ts +70 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/error/routes.ts +21 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/notifications/features/notifications.ts +262 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/notifications/routes.ts +10 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/account.ts +238 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/notifications.ts +134 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/plan-and-billing.ts +238 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/security.ts +211 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/team.ts +188 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/layout.ts +109 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/routes.ts +37 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/welcome/welcome.component.ts +22 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/routes.ts +95 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/forgot-password/forgot-password.html +54 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/forgot-password/forgot-password.ts +51 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/reset-password/reset-password.html +82 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/reset-password/reset-password.ts +69 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-in/sign-in.html +132 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-in/sign-in.ts +54 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-up/sign-up.html +183 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-up/sign-up.ts +56 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/routes.ts +34 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/coming-soon/features/coming-soon.ts +156 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/coming-soon/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/coming-soon/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/layout/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/modules/home/features/home.ts +23 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/modules/home/routes.ts +10 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/routes.ts +30 -0
- package/fuse-starter-pack/fuse-v21.1/src/environments/environment.mock.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/environments/environment.prod.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/environments/environment.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/index.html +66 -0
- package/fuse-starter-pack/fuse-v21.1/src/main.server.ts +11 -0
- package/fuse-starter-pack/fuse-v21.1/src/main.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/server.ts +70 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/base/base.css +63 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/base/typography.css +54 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/a.css +18 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/input.css +22 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/kbd.css +55 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/material.css +1149 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/styles.css +31 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/tailwind/theme.css +147 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/tailwind/utilities.css +563 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/tailwind/variants.css +4 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/third-party/lucide-icons.css +12 -0
- package/fuse-starter-pack/fuse-v21.1/tsconfig.app.json +16 -0
- package/fuse-starter-pack/fuse-v21.1/tsconfig.json +37 -0
- package/fuse-starter-pack/fuse-v21.1/tsconfig.spec.json +10 -0
- package/generator/README.md +12 -0
- package/generator/issues/.gitkeep +0 -0
- package/package.json +56 -4
- package/playwright.config.js +29 -0
- package/playwright.field-profile.config.js +6 -0
- package/playwright.iam-live.config.js +31 -0
- package/playwright.iam.config.js +29 -0
- package/playwright.list-state.config.js +6 -0
- package/playwright.performance.config.js +1 -0
- package/run-config-tests.sh +5 -0
- package/scripts/e2e-paths.js +89 -0
- package/scripts/e2e-prepare-field-profile.js +17 -0
- package/scripts/e2e-prepare-iam-live.js +135 -0
- package/scripts/e2e-prepare-iam.js +65 -0
- package/scripts/e2e-prepare.js +72 -0
- package/scripts/e2e-serve-iam-live.js +28 -0
- package/scripts/e2e-serve-iam.js +28 -0
- package/scripts/e2e-serve.js +28 -0
- package/scripts/performance/generate.js +17 -0
- package/scripts/performance/measure.js +55 -0
- package/scripts/postinstall.js +9 -0
- package/scripts/prepare-quality-apps.js +34 -0
- package/scripts/run-config-tests.js +63 -0
- package/src/assets/logo-with-lable.jpeg +0 -0
- package/src/assets/logo.jpeg +0 -0
- package/src/commands/bootstrap.js +92 -0
- package/src/commands/doctor.js +403 -0
- package/src/commands/generate.js +301 -0
- package/src/commands/init-config.js +310 -0
- package/src/commands/keycloak-options.js +182 -0
- package/src/commands/validate.js +52 -0
- package/src/config/auth-config.js +183 -0
- package/src/config/default-values.js +235 -0
- package/src/config/env-refs.js +71 -0
- package/src/config/field-preferences.js +99 -0
- package/src/config/input-sources.js +104 -0
- package/src/config/load-config.js +166 -0
- package/src/config/proxy-routes.js +44 -0
- package/src/generator/access-control-tools.js +334 -0
- package/src/generator/ai-docs.js +691 -0
- package/src/generator/application-tests.js +252 -0
- package/src/generator/auth-pack.js +965 -0
- package/src/generator/embed-config.js +431 -0
- package/src/generator/entity-layout.js +30 -0
- package/src/generator/fuse-build.js +57 -0
- package/src/generator/fuse-runtime.js +344 -0
- package/src/generator/generated-banner.js +137 -0
- package/src/generator/index.js +874 -0
- package/src/generator/project-output.js +126 -0
- package/src/generator/team-pack.js +220 -0
- package/src/index.js +68 -0
- package/src/parser/gdl-parser.js +169 -0
- package/src/parser/jdl-parser.js +171 -0
- package/src/presets/pmb-test.js +139 -0
- package/src/presets/static-source.js +73 -0
- package/src/presets/store.js +96 -0
- package/src/provision/admin-service.js +148 -0
- package/src/provision/bootstrap.js +147 -0
- package/src/provision/http.js +123 -0
- package/src/provision/keycloak-admin-rest.js +335 -0
- package/src/provision/state.js +51 -0
- package/src/provision/token.js +52 -0
- package/src/templates/angular/auth/access-control.service.ts.ejs +179 -0
- package/src/templates/angular/auth/access-ctrl.pipe.ts.ejs +20 -0
- package/src/templates/angular/auth/auth.guard.ts.ejs +27 -0
- package/src/templates/angular/auth/auth.interceptor.ts.ejs +53 -0
- package/src/templates/angular/auth/auth.service.ts.ejs +594 -0
- package/src/templates/angular/auth/auth.utils.ts.ejs +28 -0
- package/src/templates/angular/auth/current-user.ts.ejs +24 -0
- package/src/templates/angular/auth/disabled-account-overlay.component.css.ejs +95 -0
- package/src/templates/angular/auth/disabled-account-overlay.component.html.ejs +33 -0
- package/src/templates/angular/auth/disabled-account-overlay.component.ts.ejs +23 -0
- package/src/templates/angular/auth/fuse-account.ts.ejs +234 -0
- package/src/templates/angular/auth/fuse-user.ts.ejs +264 -0
- package/src/templates/angular/auth/has-permission.directive.ts.ejs +51 -0
- package/src/templates/angular/auth/index.ts.ejs +24 -0
- package/src/templates/angular/auth/keycloak-admin.service.ts.ejs +670 -0
- package/src/templates/angular/auth/landing.guard.ts.ejs +61 -0
- package/src/templates/angular/auth/no-auth.guard.ts.ejs +19 -0
- package/src/templates/angular/auth/permission-attribute.util.ts.ejs +182 -0
- package/src/templates/angular/auth/sign-in.ts.ejs +60 -0
- package/src/templates/angular/entity/_entity_.model.ts.ejs +64 -0
- package/src/templates/angular/entity/_entity_.routes.ts.ejs +9 -0
- package/src/templates/angular/entity/components/forms/form/_entity_-form.component.html.ejs +168 -0
- package/src/templates/angular/entity/components/forms/form/_entity_-form.component.ts.ejs +175 -0
- package/src/templates/angular/entity/components/forms/form-page/_entity_-form-page.component.html.ejs +10 -0
- package/src/templates/angular/entity/components/forms/form-page/_entity_-form-page.component.ts.ejs +86 -0
- package/src/templates/angular/entity/components/forms/update/_entity_-form.service.ts.ejs +136 -0
- package/src/templates/angular/entity/components/interaction/actions/_entity_-actions.component.html.ejs +68 -0
- package/src/templates/angular/entity/components/interaction/actions/_entity_-actions.component.ts.ejs +69 -0
- package/src/templates/angular/entity/components/interaction/filter/_entity_-filter.component.html.ejs +111 -0
- package/src/templates/angular/entity/components/interaction/filter/_entity_-filter.component.ts.ejs +102 -0
- package/src/templates/angular/entity/components/presentation/card/_entity_-card.component.css.ejs +33 -0
- package/src/templates/angular/entity/components/presentation/card/_entity_-card.component.html.ejs +29 -0
- package/src/templates/angular/entity/components/presentation/card/_entity_-card.component.ts.ejs +93 -0
- package/src/templates/angular/entity/components/presentation/detail/_entity_-detail.component.css.ejs +54 -0
- package/src/templates/angular/entity/components/presentation/detail/_entity_-detail.component.html.ejs +58 -0
- package/src/templates/angular/entity/components/presentation/detail/_entity_-detail.component.ts.ejs +47 -0
- package/src/templates/angular/entity/components/presentation/list/_entity_-list.component.html.ejs +419 -0
- package/src/templates/angular/entity/components/presentation/list/_entity_-list.component.scss.ejs +48 -0
- package/src/templates/angular/entity/components/presentation/list/_entity_-list.component.ts.ejs +592 -0
- package/src/templates/angular/entity/service/_entity_.service.ts.ejs +153 -0
- package/src/templates/angular/entity/settings/_entity_.settings.ts.ejs +49 -0
- package/src/templates/angular/enums/_enum_.model.ts.ejs +11 -0
- package/src/templates/angular/iam/change-password.component.html.ejs +39 -0
- package/src/templates/angular/iam/change-password.component.ts.ejs +44 -0
- package/src/templates/angular/iam/no-access.component.ts.ejs +17 -0
- package/src/templates/angular/iam/role-list.component.html.ejs +331 -0
- package/src/templates/angular/iam/role-list.component.scss.ejs +107 -0
- package/src/templates/angular/iam/role-list.component.ts.ejs +597 -0
- package/src/templates/angular/iam/role-management/role-header.component.html.ejs +51 -0
- package/src/templates/angular/iam/role-management/role-header.component.ts.ejs +45 -0
- package/src/templates/angular/iam/role-management/role-inheritance.component.html.ejs +15 -0
- package/src/templates/angular/iam/role-management/role-inheritance.component.ts.ejs +19 -0
- package/src/templates/angular/iam/role-management/role-permissions-panel.component.css.ejs +24 -0
- package/src/templates/angular/iam/role-management/role-permissions-panel.component.html.ejs +108 -0
- package/src/templates/angular/iam/role-management/role-permissions-panel.component.ts.ejs +122 -0
- package/src/templates/angular/iam/role-management/role-users.component.html.ejs +104 -0
- package/src/templates/angular/iam/role-management/role-users.component.ts.ejs +53 -0
- package/src/templates/angular/iam/role-management/user-select-dialog.component.html.ejs +113 -0
- package/src/templates/angular/iam/role-management/user-select-dialog.component.ts.ejs +157 -0
- package/src/templates/angular/iam/role-permission-matrix.component.html.ejs +355 -0
- package/src/templates/angular/iam/role-permission-matrix.component.scss.ejs +217 -0
- package/src/templates/angular/iam/role-permission-matrix.component.ts.ejs +800 -0
- package/src/templates/angular/iam/screen-catalog.ts.ejs +147 -0
- package/src/templates/angular/iam/shared/confirm-dialog.component.ts.ejs +83 -0
- package/src/templates/angular/iam/shared/matrix-hierarchy.util.ts.ejs +196 -0
- package/src/templates/angular/iam/shared/permission-matrix-sound.ts.ejs +59 -0
- package/src/templates/angular/iam/shared/role-display.util.ts.ejs +43 -0
- package/src/templates/angular/iam/shared/role-permission-skeleton.component.ts.ejs +54 -0
- package/src/templates/angular/iam/shared/screen-matrix.util.ts.ejs +554 -0
- package/src/templates/angular/iam/shared/screen-navigation-map.ts.ejs +187 -0
- package/src/templates/angular/iam/shared/screen-navigation.registry.ts.ejs +64 -0
- package/src/templates/angular/iam/shared/text-highlight.pipe.ts.ejs +39 -0
- package/src/templates/angular/iam/user-access-matrix.component.html.ejs +212 -0
- package/src/templates/angular/iam/user-access-matrix.component.scss.ejs +34 -0
- package/src/templates/angular/iam/user-access-matrix.component.ts.ejs +239 -0
- package/src/templates/angular/iam/user-detail.component.html.ejs +143 -0
- package/src/templates/angular/iam/user-detail.component.ts.ejs +108 -0
- package/src/templates/angular/iam/user-form.component.html.ejs +63 -0
- package/src/templates/angular/iam/user-form.component.ts.ejs +100 -0
- package/src/templates/angular/iam/user-list.component.html.ejs +369 -0
- package/src/templates/angular/iam/user-list.component.scss.ejs +242 -0
- package/src/templates/angular/iam/user-list.component.ts.ejs +446 -0
- package/src/templates/angular/iam/user-management.routes.ts.ejs +47 -0
- package/src/templates/angular/iam/user-permission-matrix.component.html.ejs +231 -0
- package/src/templates/angular/iam/user-permission-matrix.component.scss.ejs +216 -0
- package/src/templates/angular/iam/user-permission-matrix.component.ts.ejs +516 -0
- package/src/templates/angular/shared/base/audit-user-name.pipe.ts.ejs +69 -0
- package/src/templates/angular/shared/base/base-filter.component.ts.ejs +245 -0
- package/src/templates/angular/shared/base/base-form.component.ts.ejs +109 -0
- package/src/templates/angular/shared/base/base-list.component.ts.ejs +507 -0
- package/src/templates/angular/shared/base/filter-types.ts.ejs +55 -0
- package/src/templates/angular/shared/base/input-format.directive.ts.ejs +47 -0
- package/src/templates/angular/shared/base/input-format.ts.ejs +15 -0
- package/src/templates/angular/shared/confirm-with-input-dialog.component.ts.ejs +91 -0
- package/src/templates/angular/shared/confirmation-dialog.component.ts.ejs +80 -0
- package/src/templates/angular/shared/list-styles.css.ejs +103 -0
- package/src/templates/angular/shared/loading-overlay.component.ts.ejs +24 -0
- package/src/templates/angular/shared/resizable.directive.ts.ejs +115 -0
- package/src/templates/angular/shared/snackbar-styles.css.ejs +11 -0
- package/src/templates/fuse-packs/access-control-tools/access-control-sync.js +819 -0
- package/src/templates/fuse-packs/access-control-tools/build-rename-map.js +67 -0
- package/src/templates/fuse-packs/access-control-tools/inject-qa-ids.js +14 -0
- package/src/templates/fuse-packs/access-control-tools/lib/hierarchy-scanner.js +628 -0
- package/src/templates/fuse-packs/access-control-tools/lib/hierarchy-scanner.test.js +323 -0
- package/src/templates/fuse-packs/access-control-tools/lib/html-scanner.js +362 -0
- package/src/templates/fuse-packs/access-control-tools/lib/id-rules.duplicate.test.js +136 -0
- package/src/templates/fuse-packs/access-control-tools/lib/id-rules.js +1095 -0
- package/src/templates/fuse-packs/access-control-tools/lib/ts-component-index.js +482 -0
- package/src/templates/fuse-packs/access-control-tools/output/.gitkeep +0 -0
- package/src/templates/fuse-packs/access-control-tools/run.sh +223 -0
- package/src/templates/fuse-packs/access-control-tools/scan-access-control.js +14 -0
- package/src/templates/fuse-packs/iam-assets/sound/apple-play.mp3 +0 -0
- package/src/templates/fuse-packs/iam-assets/sound/remove.mp3 +0 -0
- package/src/templates/generator/README.md +12 -0
- package/src/templates/testing/ci.cjs +45 -0
- package/src/templates/testing/mock.cjs +149 -0
- package/src/templates/testing/playwright.config.cjs +25 -0
- package/src/templates/testing/serve.cjs +22 -0
- package/src/templates/testing/smoke.spec.cjs +180 -0
- package/src/utils/branding.js +39 -0
- package/src/utils/colors.js +18 -0
- package/src/utils/diff.js +109 -0
- package/src/utils/merger.js +115 -0
- package/src/validator/backend-diagnostics.js +30 -0
- package/src/validator/blueprint-validator.js +276 -0
- package/src/validator/diagnostics.js +608 -0
- package/src/validator/pattern.js +28 -0
- package/test/auth-interceptor.js +84 -0
- package/test/auth-provision-checks.js +297 -0
- package/test/field-preferences.js +145 -0
- package/test/fixtures/field-profile.gdl +7 -0
- package/test/fixtures/mock.jdl +17 -0
- package/test/fixtures/mock.png +0 -0
- package/test/fixtures/performance/config.yml +33 -0
- package/test/fixtures/performance/large.gdl +199 -0
- package/test/fixtures/performance/small.gdl +7 -0
- package/test/fixtures/quality/custom.yml +22 -0
- package/test/fixtures/quality/go-duck.yml +22 -0
- package/test/fixtures/quality/jhipster.yml +30 -0
- package/test/fixtures/quality/representative.gdl +14 -0
- package/test/list-state.js +138 -0
- package/test/micro-functions-layout.js +95 -0
- package/test/performance-generation.js +32 -0
- package/test/pmb-preset.js +127 -0
- package/test/project-workflow.js +111 -0
- package/test/quality-features.js +250 -0
- package/test/verify-commands.js +83 -0
- package/test/verify.js +959 -0
- package/test-files/GDL/example.gdl +15 -0
- package/test-files/JDL/example.jdl +15 -0
- package/test-files/config/crudforge.config.yml +127 -0
- package/test-run.sh +272 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
3
|
+
import { Component, OnChanges, OnInit, SimpleChanges, inject, ChangeDetectionStrategy } from '@angular/core';
|
|
4
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
5
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
6
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
7
|
+
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
8
|
+
import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|
9
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
10
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
11
|
+
import { MatInputModule } from '@angular/material/input';
|
|
12
|
+
import { MatNativeDateModule } from '@angular/material/core';
|
|
13
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
14
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
15
|
+
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
|
16
|
+
import { Observable } from 'rxjs';
|
|
17
|
+
import { HttpResponse } from '@angular/common/http';
|
|
18
|
+
|
|
19
|
+
import { <%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %>, New<%= entity.name %> } from '../../../<%= toKebabCase(entity.name) %>.model';
|
|
20
|
+
import { <%= entity.name %>Service } from '../../../service/<%= toKebabCase(entity.name) %>.service';
|
|
21
|
+
import { <%= entity.name %>FormGroup, <%= entity.name %>FormService } from '../update/<%= toKebabCase(entity.name) %>-form.service';
|
|
22
|
+
import { <%= toCamelCase(entity.name) %>Settings } from '../../../settings/settings.config';
|
|
23
|
+
|
|
24
|
+
<%
|
|
25
|
+
const fuseShared = !!preferences.fuse?.enabled;
|
|
26
|
+
const importsBase = fuseShared
|
|
27
|
+
? `import { BaseFormComponent, BaseFormDialogData } from '@/app/domains/admin/modules/apps/shared/base/base-form.component';`
|
|
28
|
+
: preferences.architecture?.centralizedSharedFolder
|
|
29
|
+
? `import { BaseFormComponent, BaseFormDialogData } from '../../../../../shared/base/base-form.component';`
|
|
30
|
+
: `import { BaseFormComponent, BaseFormDialogData } from '../../../shared/base/base-form.component';`;
|
|
31
|
+
%>
|
|
32
|
+
<%- importsBase %>
|
|
33
|
+
|
|
34
|
+
<%
|
|
35
|
+
const uniqueRelImports = new Map();
|
|
36
|
+
relationships.filter(rel => preferences.generate?.relationships !== false && rel.from.name === entity.name).forEach(rel => {
|
|
37
|
+
if (rel.to.name !== entity.name && !uniqueRelImports.has(rel.to.name)) {
|
|
38
|
+
const prefix = preferences.namingConventions?.modelInterfacePrefix || 'I';
|
|
39
|
+
const folder = toKebabCase(rel.to.name);
|
|
40
|
+
uniqueRelImports.set(rel.to.name, {
|
|
41
|
+
service: `import { ${rel.to.name}Service } from '../../../${entityImportPath(rel.to.name)}/service/${folder}.service';`,
|
|
42
|
+
model: `import { ${prefix}${rel.to.name} } from '../../../${entityImportPath(rel.to.name)}/${folder}.model';`
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
%>
|
|
47
|
+
<%- Array.from(uniqueRelImports.values()).map(x => x.model).join('\n') %>
|
|
48
|
+
<%- Array.from(uniqueRelImports.values()).map(x => x.service).join('\n') %>
|
|
49
|
+
|
|
50
|
+
<%
|
|
51
|
+
const enumImports = new Map();
|
|
52
|
+
entity.fields.forEach(field => {
|
|
53
|
+
if (field.fieldTypeIsEnum && !enumImports.has(field.fieldType)) {
|
|
54
|
+
enumImports.set(field.fieldType, `import { ${field.fieldType} } from '${preferences.fuse?.enabled ? '../../../../../enum/' : '../../../../../enums/'}${toKebabCase(field.fieldType)}.model';`);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
%>
|
|
58
|
+
<%- Array.from(enumImports.values()).join('\n') %>
|
|
59
|
+
|
|
60
|
+
import { InputFormatDirective } from '<%= preferences.fuse?.enabled ? '@/app/domains/admin/modules/apps/shared/base' : preferences.architecture?.centralizedSharedFolder ? '../../../../../shared/base' : '../../../shared/base' %>/input-format.directive';
|
|
61
|
+
|
|
62
|
+
@Component({
|
|
63
|
+
selector: 'app-<%= toKebabCase(entity.name) %>-form',
|
|
64
|
+
standalone: true,
|
|
65
|
+
host: {
|
|
66
|
+
class: 'block h-full w-full min-w-0 flex-1',
|
|
67
|
+
},
|
|
68
|
+
imports: [
|
|
69
|
+
CommonModule,
|
|
70
|
+
ReactiveFormsModule,
|
|
71
|
+
MatButtonModule,
|
|
72
|
+
MatCheckboxModule,
|
|
73
|
+
MatDatepickerModule,
|
|
74
|
+
MatDialogModule,
|
|
75
|
+
MatFormFieldModule,
|
|
76
|
+
MatIconModule,
|
|
77
|
+
InputFormatDirective,
|
|
78
|
+
MatInputModule,
|
|
79
|
+
MatNativeDateModule,
|
|
80
|
+
MatProgressSpinnerModule,
|
|
81
|
+
MatSelectModule,
|
|
82
|
+
MatSnackBarModule,
|
|
83
|
+
],
|
|
84
|
+
templateUrl: './<%= toKebabCase(entity.name) %>-form.component.html',
|
|
85
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
86
|
+
})
|
|
87
|
+
export class <%= entity.name %>FormComponent extends BaseFormComponent<<%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %>> implements OnInit, OnChanges {
|
|
88
|
+
readonly fieldSettings = <%= toCamelCase(entity.name) %>Settings.fields;
|
|
89
|
+
preferences: any = <%- JSON.stringify(preferences) %>;
|
|
90
|
+
private readonly <%= toCamelCase(entity.name) %>Service = inject(<%= entity.name %>Service);
|
|
91
|
+
private readonly formService = inject(<%= entity.name %>FormService);
|
|
92
|
+
<% relationships.filter(rel => preferences.generate?.relationships !== false && rel.from.name === entity.name).forEach(rel => { %>
|
|
93
|
+
private readonly <%= toCamelCase(rel.to.name) %>Service = inject(<%= rel.to.name %>Service);
|
|
94
|
+
<% }); %>
|
|
95
|
+
private readonly dialogRef = inject(MatDialogRef<<%= entity.name %>FormComponent>, { optional: true });
|
|
96
|
+
private readonly dialogData = inject(MAT_DIALOG_DATA, { optional: true }) as BaseFormDialogData<<%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %>> | null;
|
|
97
|
+
|
|
98
|
+
override form: <%= entity.name %>FormGroup = this.formService.create<%= entity.name %>FormGroup();
|
|
99
|
+
override entityName = '<%= entity.name %>';
|
|
100
|
+
override snackbarPositionTop = <%= toCamelCase(entity.name) %>Settings.snackbarPositionTop;
|
|
101
|
+
|
|
102
|
+
<% entity.fields.forEach(field => { if (field.fieldTypeIsEnum) { %>
|
|
103
|
+
readonly <%= toCamelCase(field.fieldType) %>Options = Object.keys(<%= field.fieldType %>);
|
|
104
|
+
<% }}); %>
|
|
105
|
+
|
|
106
|
+
<% relationships.filter(rel => preferences.generate?.relationships !== false && rel.from.name === entity.name).forEach(rel => {
|
|
107
|
+
const prefix = preferences.namingConventions?.modelInterfacePrefix || 'I';
|
|
108
|
+
%>
|
|
109
|
+
<%= toCamelCase(rel.to.name) %>sSharedCollection: <%= prefix %><%= rel.to.name %>[] = [];
|
|
110
|
+
<% }); %>
|
|
111
|
+
|
|
112
|
+
ngOnInit(): void {
|
|
113
|
+
if (typeof document !== 'undefined') {
|
|
114
|
+
document.documentElement.style.setProperty('--cforge-snackbar-success', <%= toCamelCase(entity.name) %>Settings.snackbarSuccessColor);
|
|
115
|
+
document.documentElement.style.setProperty('--cforge-snackbar-error', <%= toCamelCase(entity.name) %>Settings.snackbarErrorColor);
|
|
116
|
+
}
|
|
117
|
+
this.initializeFormFromInputs();
|
|
118
|
+
this.loadRelationshipsOptions();
|
|
119
|
+
this.isInitialized = true;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private loadRelationshipsOptions(): void {
|
|
123
|
+
<% relationships.filter(rel => preferences.generate?.relationships !== false && rel.from.name === entity.name).forEach(rel => { %>
|
|
124
|
+
this.<%= toCamelCase(rel.to.name) %>Service.query({ page: 0, size: 50 }).pipe(takeUntilDestroyed(this.formDestroyRef)).subscribe(res => {
|
|
125
|
+
this.<%= toCamelCase(rel.to.name) %>sSharedCollection = res.body || [];
|
|
126
|
+
this.cdr.markForCheck();
|
|
127
|
+
});
|
|
128
|
+
<% }); %>
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
132
|
+
if (!this.isInitialized) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (changes['entity']) {
|
|
136
|
+
this.errorMessage = null;
|
|
137
|
+
if (changes['entity'].currentValue) {
|
|
138
|
+
this.formService.resetForm(this.form, { ...changes['entity'].currentValue });
|
|
139
|
+
} else {
|
|
140
|
+
this.resetToDefaults();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
protected override save(payload: any): Observable<HttpResponse<<%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %>>> {
|
|
146
|
+
const isUpdate = payload.id != null;
|
|
147
|
+
return isUpdate
|
|
148
|
+
? this.<%= toCamelCase(entity.name) %>Service.update(payload as <%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %>)
|
|
149
|
+
: this.<%= toCamelCase(entity.name) %>Service.create(payload as New<%= entity.name %>);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
protected override getPayload(): any {
|
|
153
|
+
return this.formService.get<%= entity.name %>(this.form);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
protected override resetForm(entity: Partial<<%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %>>): void {
|
|
157
|
+
this.formService.resetForm(this.form, entity);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
protected override getDialogData(): BaseFormDialogData<<%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %>> | null {
|
|
161
|
+
return this.dialogData;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
protected override getDialogRef(): MatDialogRef<any> | null {
|
|
165
|
+
return this.dialogRef;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
<% relationships.filter(rel => preferences.generate?.relationships !== false && rel.from.name === entity.name).forEach(rel => {
|
|
169
|
+
const prefix = preferences.namingConventions?.modelInterfacePrefix || 'I';
|
|
170
|
+
%>
|
|
171
|
+
compare<%= rel.to.name %>(o1: <%= prefix %><%= rel.to.name %> | null, o2: <%= prefix %><%= rel.to.name %> | null): boolean {
|
|
172
|
+
return o1 && o2 ? o1.id === o2.id : o1 === o2;
|
|
173
|
+
}
|
|
174
|
+
<% }); %>
|
|
175
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!-- Form Page component for <%= entity.name %> -->
|
|
2
|
+
<div class="form-page-container p-6">
|
|
3
|
+
<h2 class="text-2xl font-bold mb-4">{{ isEdit ? 'Edit' : 'Create' }} <%= entity.name %></h2>
|
|
4
|
+
<app-<%= toKebabCase(entity.name) %>-form
|
|
5
|
+
[entity]="entity"
|
|
6
|
+
[heading]="isEdit ? 'Edit <%= entity.name %>' : 'New <%= entity.name %>'"
|
|
7
|
+
(saved)="onSaved($event)"
|
|
8
|
+
(cancelled)="onCancelled()"
|
|
9
|
+
></app-<%= toKebabCase(entity.name) %>-form>
|
|
10
|
+
</div>
|
package/src/templates/angular/entity/components/forms/form-page/_entity_-form-page.component.ts.ejs
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Component, OnInit, inject, ChangeDetectionStrategy, ChangeDetectorRef, DestroyRef } from '@angular/core';
|
|
2
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
5
|
+
import { MatCardModule } from '@angular/material/card';
|
|
6
|
+
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
|
7
|
+
import { <%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %> } from '../../../<%= toKebabCase(entity.name) %>.model';
|
|
8
|
+
import { <%= entity.name %>Service } from '../../../service/<%= toKebabCase(entity.name) %>.service';
|
|
9
|
+
import { <%= entity.name %>FormComponent } from '../form/<%= toKebabCase(entity.name) %>-form.component';
|
|
10
|
+
import { <%= toCamelCase(entity.name) %>Settings } from '../../../settings/settings.config';
|
|
11
|
+
|
|
12
|
+
@Component({
|
|
13
|
+
selector: 'app-<%= toKebabCase(entity.name) %>-form-page',
|
|
14
|
+
standalone: true,
|
|
15
|
+
imports: [
|
|
16
|
+
CommonModule,
|
|
17
|
+
MatCardModule,
|
|
18
|
+
MatSnackBarModule,
|
|
19
|
+
<%= entity.name %>FormComponent
|
|
20
|
+
],
|
|
21
|
+
templateUrl: './<%= toKebabCase(entity.name) %>-form-page.component.html',
|
|
22
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
23
|
+
})
|
|
24
|
+
export class <%= entity.name %>FormPageComponent implements OnInit {
|
|
25
|
+
private readonly componentDestroyRef = inject(DestroyRef);
|
|
26
|
+
private readonly route = inject(ActivatedRoute);
|
|
27
|
+
private readonly router = inject(Router);
|
|
28
|
+
private readonly service = inject(<%= entity.name %>Service);
|
|
29
|
+
private readonly snackBar = inject(MatSnackBar);
|
|
30
|
+
private readonly cdr = inject(ChangeDetectorRef);
|
|
31
|
+
|
|
32
|
+
isEdit = false;
|
|
33
|
+
entity: <%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %> | null = null;
|
|
34
|
+
|
|
35
|
+
ngOnInit(): void {
|
|
36
|
+
if (typeof document !== 'undefined') {
|
|
37
|
+
document.documentElement.style.setProperty('--cforge-snackbar-success', <%= toCamelCase(entity.name) %>Settings.snackbarSuccessColor);
|
|
38
|
+
document.documentElement.style.setProperty('--cforge-snackbar-error', <%= toCamelCase(entity.name) %>Settings.snackbarErrorColor);
|
|
39
|
+
}
|
|
40
|
+
const id = this.route.snapshot.paramMap.get('id');
|
|
41
|
+
if (<%= toCamelCase(entity.name) %>Settings.formMode !== 'page') {
|
|
42
|
+
this.router.navigate([id ? '../../' : '../'], {
|
|
43
|
+
relativeTo: this.route,
|
|
44
|
+
queryParams: id ? { form: 'edit', id } : { form: 'new' },
|
|
45
|
+
replaceUrl: true,
|
|
46
|
+
});
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (id) {
|
|
50
|
+
this.isEdit = true;
|
|
51
|
+
this.loadEntity(id);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private loadEntity(id: string): void {
|
|
56
|
+
this.service.find(Number(id)).pipe(takeUntilDestroyed(this.componentDestroyRef)).subscribe({
|
|
57
|
+
next: (res) => {
|
|
58
|
+
if (res.body) {
|
|
59
|
+
this.entity = res.body;
|
|
60
|
+
this.cdr.markForCheck();
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
error: () =>
|
|
64
|
+
this.snackBar.open('Failed to load <%= entity.name %>', 'Close', {
|
|
65
|
+
duration: 3000,
|
|
66
|
+
horizontalPosition: 'center',
|
|
67
|
+
verticalPosition: <%= toCamelCase(entity.name) %>Settings.snackbarPositionTop ? 'top' : 'bottom',
|
|
68
|
+
panelClass: ['error-snackbar'],
|
|
69
|
+
}),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
onSaved(savedEntity: <%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %>): void {
|
|
74
|
+
this.snackBar.open('<%= entity.name %> saved successfully', 'Close', {
|
|
75
|
+
duration: 2000,
|
|
76
|
+
horizontalPosition: 'center',
|
|
77
|
+
verticalPosition: <%= toCamelCase(entity.name) %>Settings.snackbarPositionTop ? 'top' : 'bottom',
|
|
78
|
+
panelClass: ['success-snackbar'],
|
|
79
|
+
});
|
|
80
|
+
this.router.navigate([this.isEdit ? '../../' : '../'], { relativeTo: this.route });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
onCancelled(): void {
|
|
84
|
+
this.router.navigate([this.isEdit ? '../../' : '../'], { relativeTo: this.route });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { <%= toCamelCase(entity.name) %>Settings } from '../../../settings/settings.config';
|
|
2
|
+
import { Injectable } from '@angular/core';
|
|
3
|
+
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
|
4
|
+
import dayjs from 'dayjs/esm';
|
|
5
|
+
import { normalizeInputFields } from '<%= preferences.fuse?.enabled ? '@/app/domains/admin/modules/apps/shared/base' : preferences.architecture?.centralizedSharedFolder ? '../../../../../shared/base' : '../../../shared/base' %>/input-format';
|
|
6
|
+
import { <%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %>, New<%= entity.name %> } from '../../../<%= toKebabCase(entity.name) %>.model';
|
|
7
|
+
|
|
8
|
+
<%
|
|
9
|
+
const uniqueModelImports = new Map();
|
|
10
|
+
relationships.filter(rel => preferences.generate?.relationships !== false && rel.from.name === entity.name).forEach(rel => {
|
|
11
|
+
if (rel.to.name !== entity.name && !uniqueModelImports.has(rel.to.name)) {
|
|
12
|
+
const prefix = preferences.namingConventions?.modelInterfacePrefix || 'I';
|
|
13
|
+
uniqueModelImports.set(rel.to.name, `import { ${prefix}${rel.to.name} } from '../../../${entityImportPath(rel.to.name)}/${toKebabCase(rel.to.name)}.model';`);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
%>
|
|
17
|
+
<%- Array.from(uniqueModelImports.values()).join('\n') %>
|
|
18
|
+
|
|
19
|
+
<%
|
|
20
|
+
const dateFields = entity.fields.filter(f => ['LocalDate', 'Instant', 'ZonedDateTime'].includes(f.fieldType));
|
|
21
|
+
|
|
22
|
+
function getControlValidators(field) {
|
|
23
|
+
const validators = [];
|
|
24
|
+
field.fieldValidateRules.forEach(rule => {
|
|
25
|
+
if (rule === 'required') {
|
|
26
|
+
validators.push('Validators.required');
|
|
27
|
+
} else if (rule.startsWith('minlength(')) {
|
|
28
|
+
const match = [Number(rule.slice(rule.indexOf('(') + 1, -1))];
|
|
29
|
+
if (match) validators.push(`Validators.minLength(${match[0]})`);
|
|
30
|
+
} else if (rule.startsWith('maxlength(')) {
|
|
31
|
+
const match = [Number(rule.slice(rule.indexOf('(') + 1, -1))];
|
|
32
|
+
if (match) validators.push(`Validators.maxLength(${match[0]})`);
|
|
33
|
+
} else if (rule.startsWith('min(')) {
|
|
34
|
+
const match = [Number(rule.slice(rule.indexOf('(') + 1, -1))];
|
|
35
|
+
if (match) validators.push(`Validators.min(${match[0]})`);
|
|
36
|
+
} else if (rule.startsWith('max(')) {
|
|
37
|
+
const match = [Number(rule.slice(rule.indexOf('(') + 1, -1))];
|
|
38
|
+
if (match) validators.push(`Validators.max(${match[0]})`);
|
|
39
|
+
} else if (rule.startsWith('pattern(')) {
|
|
40
|
+
const pat = rule.substring(8, rule.length - 1);
|
|
41
|
+
validators.push(`Validators.pattern(${patternExpression(pat)})`);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return validators;
|
|
45
|
+
}
|
|
46
|
+
%>
|
|
47
|
+
|
|
48
|
+
type <%= entity.name %>FormGroupInput = <%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %> | Partial<New<%= entity.name %>>;
|
|
49
|
+
type <%= entity.name %>FormRawValue = Omit<<%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %>, <%- dateFields.length ? dateFields.map(f => `'${f.fieldName}'`).join(' | ') : 'never' %>> & {
|
|
50
|
+
<% dateFields.forEach(field => { %>
|
|
51
|
+
<%= field.fieldName %>?: Date | null;
|
|
52
|
+
<% }); %>
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type <%= entity.name %>FormGroup = FormGroup<{
|
|
56
|
+
id: FormControl<<%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %>['id'] | New<%= entity.name %>['id']>;
|
|
57
|
+
<% entity.fields.forEach(field => { %>
|
|
58
|
+
<%= field.fieldName %>: FormControl<<% if (['LocalDate', 'Instant', 'ZonedDateTime'].includes(field.fieldType)) { %>Date | null<% } else { %><%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %>['<%= field.fieldName %>']<% } %>>;
|
|
59
|
+
<% }); %>
|
|
60
|
+
<% relationships.filter(rel => preferences.generate?.relationships !== false && rel.from.name === entity.name).forEach(rel => {
|
|
61
|
+
const relFieldName = rel.from.fieldName || toCamelCase(rel.to.name);
|
|
62
|
+
const isCollection = ['OneToMany', 'ManyToMany'].includes(rel.type);
|
|
63
|
+
const prefix = preferences.namingConventions?.modelInterfacePrefix || 'I';
|
|
64
|
+
const relTypeStr = prefix + rel.to.name + (isCollection ? '[]' : '');
|
|
65
|
+
%>
|
|
66
|
+
<%= relFieldName %>: FormControl<<%= relTypeStr %> | null>;
|
|
67
|
+
<% }); %>
|
|
68
|
+
}>;
|
|
69
|
+
|
|
70
|
+
@Injectable({ providedIn: 'root' })
|
|
71
|
+
export class <%= entity.name %>FormService {
|
|
72
|
+
create<%= entity.name %>FormGroup(entity: <%= entity.name %>FormGroupInput = { id: null }): <%= entity.name %>FormGroup {
|
|
73
|
+
entity = normalizeInputFields(entity, <%= toCamelCase(entity.name) %>Settings.fields);
|
|
74
|
+
const form = new FormGroup({
|
|
75
|
+
id: new FormControl(
|
|
76
|
+
{ value: entity.id, disabled: true },
|
|
77
|
+
{ nonNullable: true, validators: [Validators.required] }
|
|
78
|
+
),
|
|
79
|
+
<% entity.fields.forEach(field => { %>
|
|
80
|
+
<%
|
|
81
|
+
const controlVals = getControlValidators(field);
|
|
82
|
+
const valString = controlVals.length > 0 ? `, [${controlVals.join(', ')}]` : '';
|
|
83
|
+
%>
|
|
84
|
+
<%= field.fieldName %>: new FormControl(<% if (['LocalDate', 'Instant', 'ZonedDateTime'].includes(field.fieldType)) { %>this.convertDateForForm(entity.<%= field.fieldName %>)<% } else { %>entity.<%= field.fieldName %><% } %><%- valString %>),
|
|
85
|
+
<% }); %>
|
|
86
|
+
<% relationships.filter(rel => preferences.generate?.relationships !== false && rel.from.name === entity.name).forEach(rel => {
|
|
87
|
+
const relFieldName = rel.from.fieldName || toCamelCase(rel.to.name);
|
|
88
|
+
const isCollection = ['OneToMany', 'ManyToMany'].includes(rel.type);
|
|
89
|
+
%>
|
|
90
|
+
<%= relFieldName %>: new FormControl(entity.<%= relFieldName %> || <%- isCollection ? '[]' : 'null' %>),
|
|
91
|
+
<% }); %>
|
|
92
|
+
});
|
|
93
|
+
return form;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
get<%= entity.name %>(form: <%= entity.name %>FormGroup): <%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %> | New<%= entity.name %> {
|
|
97
|
+
const rawValue = normalizeInputFields(form.getRawValue(), <%= toCamelCase(entity.name) %>Settings.fields) as <%= entity.name %>FormRawValue;
|
|
98
|
+
return {
|
|
99
|
+
...rawValue,
|
|
100
|
+
<% dateFields.forEach(field => { %>
|
|
101
|
+
<%= field.fieldName %>: rawValue.<%= field.fieldName %> ? dayjs(rawValue.<%= field.fieldName %>) : null,
|
|
102
|
+
<% }); %>
|
|
103
|
+
} as <%= preferences.namingConventions?.modelInterfacePrefix || 'I' %><%= entity.name %> | New<%= entity.name %>;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
resetForm(form: <%= entity.name %>FormGroup, entity: <%= entity.name %>FormGroupInput): void {
|
|
107
|
+
entity = normalizeInputFields(entity, <%= toCamelCase(entity.name) %>Settings.fields);
|
|
108
|
+
form.reset({
|
|
109
|
+
...entity,
|
|
110
|
+
<% dateFields.forEach(field => { %>
|
|
111
|
+
<%= field.fieldName %>: this.convertDateForForm(entity.<%= field.fieldName %>),
|
|
112
|
+
<% }); %>
|
|
113
|
+
<% relationships.filter(rel => preferences.generate?.relationships !== false && rel.from.name === entity.name).forEach(rel => {
|
|
114
|
+
const relFieldName = rel.from.fieldName || toCamelCase(rel.to.name);
|
|
115
|
+
const isCollection = ['OneToMany', 'ManyToMany'].includes(rel.type);
|
|
116
|
+
%>
|
|
117
|
+
<%= relFieldName %>: entity.<%= relFieldName %> || <%- isCollection ? '[]' : 'null' %>,
|
|
118
|
+
<% }); %>
|
|
119
|
+
} as any);
|
|
120
|
+
form.controls.id.setValue(entity.id ?? null);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private convertDateForForm(value: unknown): Date | null {
|
|
124
|
+
if (!value) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
if (value instanceof Date) {
|
|
128
|
+
return value;
|
|
129
|
+
}
|
|
130
|
+
if (dayjs.isDayjs(value)) {
|
|
131
|
+
return value.toDate();
|
|
132
|
+
}
|
|
133
|
+
const parsed = new Date(value as string);
|
|
134
|
+
return Number.isNaN(parsed.getTime()) ? null : parsed;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<%
|
|
2
|
+
const screenId = typeof entityScreenId !== 'undefined' && entityScreenId ? entityScreenId : toKebabCase(entity.name);
|
|
3
|
+
const aclAttrs = (componentId) => `data-screen-id="${screenId}" data-component-id="${componentId}"`;
|
|
4
|
+
%>
|
|
5
|
+
<div class="mt-6 grid w-full grid-cols-2 gap-3 md:ml-4 md:mt-0 md:flex md:w-auto md:shrink-0 md:items-center">
|
|
6
|
+
@if (searchMode === 'field') {
|
|
7
|
+
<mat-form-field appearance="outline" subscriptSizing="dynamic" class="col-span-2 w-full sm:col-span-1 md:w-40">
|
|
8
|
+
<mat-select [ngModel]="searchBy" (ngModelChange)="onSearchByChange($event)" aria-label="Search by field">
|
|
9
|
+
@for (col of searchableColumns; track col) {
|
|
10
|
+
<mat-option [value]="col">
|
|
11
|
+
{{ getColumnLabel(col) }}
|
|
12
|
+
</mat-option>
|
|
13
|
+
}
|
|
14
|
+
</mat-select>
|
|
15
|
+
</mat-form-field>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
<mat-form-field appearance="outline" subscriptSizing="dynamic" class="col-span-2 w-full sm:col-span-1 md:w-64">
|
|
19
|
+
<mat-icon matPrefix svgIcon="search" class="mr-2 text-neutral-500"></mat-icon>
|
|
20
|
+
<input matInput [placeholder]="searchMode === 'global' ? 'Search all fields…' : 'Search…'" [ngModel]="searchTerm" (ngModelChange)="onSearchTermChange($event)" />
|
|
21
|
+
@if (searchTerm) {
|
|
22
|
+
<button mat-icon-button matSuffix type="button" (click)="onSearchTermChange('')" class="flex h-8 w-8 min-w-0 items-center justify-center p-0" aria-label="Clear search">
|
|
23
|
+
<mat-icon svgIcon="x" class="text-neutral-500"></mat-icon>
|
|
24
|
+
</button>
|
|
25
|
+
}
|
|
26
|
+
</mat-form-field>
|
|
27
|
+
|
|
28
|
+
<div class="search-bar col-span-2 flex items-center justify-start gap-3">
|
|
29
|
+
<% if (iamAcl) { %>@if (SCREEN | accessCtrl: 'open-columns') {<% } %>
|
|
30
|
+
<button mat-stroked-button type="button" [matMenuTriggerFor]="columnMenu" class="h-10 w-12 min-w-0 p-0" matTooltip="Columns" aria-label="Column preferences" <%- aclAttrs('open-columns') %>>
|
|
31
|
+
<span class="flex items-center justify-center">
|
|
32
|
+
<mat-icon svgIcon="menu" class="m-0"></mat-icon>
|
|
33
|
+
</span>
|
|
34
|
+
</button>
|
|
35
|
+
<% if (iamAcl) { %>}<% } %>
|
|
36
|
+
|
|
37
|
+
<% if (iamAcl) { %>@if (SCREEN | accessCtrl: 'toggle-view') {<% } %>
|
|
38
|
+
<button mat-stroked-button type="button" (click)="toggleViewMode()" [attr.aria-label]="viewMode === 'table' ? 'Switch to Card View' : 'Switch to Table View'" [matTooltip]="viewMode === 'table' ? 'Switch to Card View' : 'Switch to Table View'" class="h-10 w-12 min-w-0 p-0" <%- aclAttrs('toggle-view') %>>
|
|
39
|
+
<span class="flex items-center justify-center">
|
|
40
|
+
@if (viewMode === 'table') {
|
|
41
|
+
<mat-icon svgIcon="credit-card" class="m-0"></mat-icon>
|
|
42
|
+
} @else {
|
|
43
|
+
<mat-icon svgIcon="table" class="m-0"></mat-icon>
|
|
44
|
+
}
|
|
45
|
+
</span>
|
|
46
|
+
</button>
|
|
47
|
+
<% if (iamAcl) { %>}<% } %>
|
|
48
|
+
|
|
49
|
+
@if (filterFieldsLength) {
|
|
50
|
+
<% if (iamAcl) { %>@if (SCREEN | accessCtrl: 'open-filter') {<% } %>
|
|
51
|
+
<button mat-stroked-button type="button" aria-label="Open filters" matTooltip="Filters" class="h-10 w-12 min-w-0 p-0" (click)="filterClick.emit()" <%- aclAttrs('open-filter') %>>
|
|
52
|
+
<span class="flex items-center justify-center">
|
|
53
|
+
<mat-icon svgIcon="funnel" class="m-0"></mat-icon>
|
|
54
|
+
</span>
|
|
55
|
+
</button>
|
|
56
|
+
<% if (iamAcl) { %>}<% } %>
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
<% if (iamAcl) { %>@if (SCREEN | accessCtrl: 'create') {<% } %>
|
|
60
|
+
<button mat-flat-button color="primary" type="button" class="h-10" (click)="newClick.emit()" <%- aclAttrs('create') %>>
|
|
61
|
+
<span class="flex items-center justify-center">
|
|
62
|
+
<mat-icon svgIcon="plus" class="m-0 mr-2"></mat-icon>
|
|
63
|
+
<span>New</span>
|
|
64
|
+
</span>
|
|
65
|
+
</button>
|
|
66
|
+
<% if (iamAcl) { %>}<% } %>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, Output, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { FormsModule } from '@angular/forms';
|
|
4
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
5
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
6
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
7
|
+
import { MatInputModule } from '@angular/material/input';
|
|
8
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
9
|
+
import { MatMenu, MatMenuModule } from '@angular/material/menu';
|
|
10
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
11
|
+
<% if (iamAcl) { %>
|
|
12
|
+
import { AccessCtrlPipe } from '@/app/core/auth';
|
|
13
|
+
<% } %>
|
|
14
|
+
|
|
15
|
+
@Component({
|
|
16
|
+
selector: 'app-<%= toKebabCase(entity.name) %>-actions',
|
|
17
|
+
templateUrl: './<%= toKebabCase(entity.name) %>-actions.component.html',
|
|
18
|
+
host: {
|
|
19
|
+
class: 'block w-full xl:w-auto',
|
|
20
|
+
},
|
|
21
|
+
standalone: true,
|
|
22
|
+
imports: [
|
|
23
|
+
CommonModule,
|
|
24
|
+
FormsModule,
|
|
25
|
+
MatButtonModule,
|
|
26
|
+
MatIconModule,
|
|
27
|
+
MatFormFieldModule,
|
|
28
|
+
MatInputModule,
|
|
29
|
+
MatSelectModule,
|
|
30
|
+
MatMenuModule,
|
|
31
|
+
MatTooltipModule<% if (iamAcl) { %>,
|
|
32
|
+
AccessCtrlPipe<% } %>
|
|
33
|
+
],
|
|
34
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
35
|
+
})
|
|
36
|
+
export class <%= entity.name %>ActionsComponent {
|
|
37
|
+
readonly SCREEN = '<%= typeof entityScreenId !== "undefined" && entityScreenId ? entityScreenId : toKebabCase(entity.name) %>';
|
|
38
|
+
@Input() searchableColumns: string[] = [];
|
|
39
|
+
@Input() searchBy: string = '';
|
|
40
|
+
@Input() searchTerm: string = '';
|
|
41
|
+
@Input() searchMode: 'field' | 'global' = 'field';
|
|
42
|
+
@Input() viewMode: 'table' | 'card' = 'table';
|
|
43
|
+
@Input() filterFieldsLength = 0;
|
|
44
|
+
@Input() columnMenu!: MatMenu;
|
|
45
|
+
@Input() allColumnPreferences: { key: string; label: string }[] = [];
|
|
46
|
+
|
|
47
|
+
@Output() searchChange = new EventEmitter<{ searchBy: string; searchTerm: string }>();
|
|
48
|
+
@Output() filterClick = new EventEmitter<void>();
|
|
49
|
+
@Output() viewModeChange = new EventEmitter<'table' | 'card'>();
|
|
50
|
+
@Output() newClick = new EventEmitter<void>();
|
|
51
|
+
|
|
52
|
+
onSearchByChange(value: string): void {
|
|
53
|
+
this.searchChange.emit({ searchBy: value, searchTerm: this.searchTerm });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
onSearchTermChange(value: string): void {
|
|
57
|
+
this.searchChange.emit({ searchBy: this.searchBy, searchTerm: value });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
toggleViewMode(): void {
|
|
61
|
+
const nextMode = this.viewMode === 'table' ? 'card' : 'table';
|
|
62
|
+
this.viewModeChange.emit(nextMode);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
getColumnLabel(key: string): string {
|
|
66
|
+
const col = this.allColumnPreferences.find(item => item.key === key);
|
|
67
|
+
return col ? col.label : key;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<form class="flex h-full w-full min-w-0 flex-col bg-card" [formGroup]="filtersForm" (ngSubmit)="applyFilters()">
|
|
2
|
+
<div class="border-b px-6 py-5">
|
|
3
|
+
<div class="flex items-start justify-between gap-4">
|
|
4
|
+
<div class="min-w-0">
|
|
5
|
+
<h2 class="text-2xl font-bold tracking-tight">Advanced Filters</h2>
|
|
6
|
+
@if (getSelectedFilterChips().length) {
|
|
7
|
+
<div class="mt-3 flex flex-wrap gap-2">
|
|
8
|
+
@for (chip of getSelectedFilterChips(); track chip.key) {
|
|
9
|
+
<span class="inline-flex max-w-full items-center rounded-full px-3 py-1 text-xs font-medium ring-1" [class]="chip.colorClass">
|
|
10
|
+
<span class="truncate">{{ chip.label }}</span>
|
|
11
|
+
</span>
|
|
12
|
+
}
|
|
13
|
+
</div>
|
|
14
|
+
}
|
|
15
|
+
</div>
|
|
16
|
+
<button mat-icon-button type="button" (click)="closeFilterDrawer()">
|
|
17
|
+
<mat-icon svgIcon="x"></mat-icon>
|
|
18
|
+
</button>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div class="flex-auto overflow-y-auto px-6 py-6">
|
|
23
|
+
<div class="flex flex-col gap-4">
|
|
24
|
+
@for (field of filterFields; track field.key) {
|
|
25
|
+
<div
|
|
26
|
+
class="w-full rounded-2xl border border-neutral-200 bg-neutral-50/60 p-4"
|
|
27
|
+
[formGroup]="fieldGroup(field.key)"
|
|
28
|
+
>
|
|
29
|
+
<div class="mb-4 flex items-center justify-between gap-3">
|
|
30
|
+
<div class="min-w-0">
|
|
31
|
+
<h3 class="truncate text-base font-semibold text-neutral-900">{{ field.label }}</h3>
|
|
32
|
+
<p class="mt-1 text-xs uppercase tracking-wide text-neutral-500">
|
|
33
|
+
{{ field.valueType }} filter
|
|
34
|
+
</p>
|
|
35
|
+
</div>
|
|
36
|
+
<button mat-button type="button" (click)="clearField(field.key)">
|
|
37
|
+
Clear
|
|
38
|
+
</button>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div class="mb-2 text-sm font-medium text-neutral-700">Operator</div>
|
|
42
|
+
<mat-form-field appearance="outline" class="block w-full" subscriptSizing="dynamic">
|
|
43
|
+
<mat-select formControlName="operator">
|
|
44
|
+
<mat-option value="">None</mat-option>
|
|
45
|
+
@for (operator of field.operators; track operator.key) {
|
|
46
|
+
<mat-option [value]="operator.key">
|
|
47
|
+
{{ operator.label }}
|
|
48
|
+
</mat-option>
|
|
49
|
+
}
|
|
50
|
+
</mat-select>
|
|
51
|
+
</mat-form-field>
|
|
52
|
+
|
|
53
|
+
@if (operatorRequiresInput(field)) {
|
|
54
|
+
@switch (currentOperatorValueType(field)) {
|
|
55
|
+
@case ('string') {
|
|
56
|
+
<div class="mt-1 mb-2 text-sm font-medium text-neutral-700">Value</div>
|
|
57
|
+
<mat-form-field appearance="outline" class="mt-1 block w-full" subscriptSizing="dynamic">
|
|
58
|
+
<input matInput formControlName="value" />
|
|
59
|
+
</mat-form-field>
|
|
60
|
+
}
|
|
61
|
+
@case ('number') {
|
|
62
|
+
<div class="mt-1 mb-2 text-sm font-medium text-neutral-700">Value</div>
|
|
63
|
+
<mat-form-field appearance="outline" class="mt-1 block w-full" subscriptSizing="dynamic">
|
|
64
|
+
<input matInput type="number" formControlName="value" />
|
|
65
|
+
</mat-form-field>
|
|
66
|
+
}
|
|
67
|
+
@case ('date') {
|
|
68
|
+
<div class="mt-1 mb-2 text-sm font-medium text-neutral-700">Value</div>
|
|
69
|
+
<mat-form-field appearance="outline" class="mt-1 block w-full" subscriptSizing="dynamic">
|
|
70
|
+
<input matInput [matDatepicker]="datePicker" formControlName="value" />
|
|
71
|
+
<mat-datepicker-toggle matSuffix [for]="datePicker"></mat-datepicker-toggle>
|
|
72
|
+
<mat-datepicker #datePicker></mat-datepicker>
|
|
73
|
+
</mat-form-field>
|
|
74
|
+
}
|
|
75
|
+
@case ('boolean') {
|
|
76
|
+
<div class="mt-1 mb-2 text-sm font-medium text-neutral-700">Value</div>
|
|
77
|
+
<mat-form-field appearance="outline" class="mt-1 block w-full" subscriptSizing="dynamic">
|
|
78
|
+
<mat-select formControlName="value">
|
|
79
|
+
<mat-option [value]="true">True</mat-option>
|
|
80
|
+
<mat-option [value]="false">False</mat-option>
|
|
81
|
+
</mat-select>
|
|
82
|
+
</mat-form-field>
|
|
83
|
+
}
|
|
84
|
+
@case ('enum') {
|
|
85
|
+
<div class="mt-1 mb-2 text-sm font-medium text-neutral-700">Value</div>
|
|
86
|
+
<mat-form-field appearance="outline" class="mt-1 block w-full" subscriptSizing="dynamic">
|
|
87
|
+
<mat-select formControlName="value">
|
|
88
|
+
@for (option of getEnumOptions(field); track option) {
|
|
89
|
+
<mat-option [value]="option">
|
|
90
|
+
{{ option }}
|
|
91
|
+
</mat-option>
|
|
92
|
+
}
|
|
93
|
+
</mat-select>
|
|
94
|
+
</mat-form-field>
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
</div>
|
|
99
|
+
} @empty {
|
|
100
|
+
<div class="rounded-2xl border border-dashed border-outline px-4 py-8 text-center text-sm text-disabled">
|
|
101
|
+
No filterable fields are available for this entity.
|
|
102
|
+
</div>
|
|
103
|
+
}
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<div class="flex flex-col-reverse gap-3 border-t px-6 py-4 sm:flex-row sm:items-center sm:justify-end">
|
|
108
|
+
<button mat-button type="button" (click)="clearFilters()">Clear All</button>
|
|
109
|
+
<button mat-flat-button color="primary" type="submit">Apply Filters</button>
|
|
110
|
+
</div>
|
|
111
|
+
</form>
|