@gadmin2n/schematics 0.0.55
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 +9 -0
- package/dist/collection.json +122 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -0
- package/dist/lib/application/application.factory.d.ts +3 -0
- package/dist/lib/application/application.factory.js +92 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/.dockerignore +33 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/Dockerfile +14 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/Jenkinsfile +44 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/build.sh +18 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/.types.d.ts +143 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/prisma/sample.prisma +65 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/Game.ts +58 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/Log.ts +56 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/Role.ts +58 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/Source.ts +76 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/Tasklog.ts +76 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/_common.ts +16 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/readme.md +49 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/.env +20 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/.eslintrc.js +25 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/.prettierrc +4 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/README.md +71 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/config/ac.config.ts +24 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/config/index.ts +60 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/gadmin-cli.json +17 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/package.json +106 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/prisma/.generator.prisma +32 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/games.ts +71 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/index.ts +27 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/roles.ts +4 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/app.controller.spec.ts +22 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/app.controller.ts +52 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/app.module.ts +75 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/app.service.ts +50 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/lib/auth.guard.ts +108 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/lib/roles.guard.ts +47 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/lib/utils.ts +54 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/lib/woaAuth.ts +82 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/lib/yufuid.ts +160 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/main.ts +119 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/index.ts +3 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/test/app.e2e-spec.ts +24 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/test/jest-e2e.json +9 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/tsconfig.build.json +4 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/tsconfig.json +21 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/README.MD +48 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/craco.config.js +27 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/package.json +81 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/public/favicon.ico +0 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/public/images/flags/en.svg +1 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/public/images/flags/zh_CN.svg +11 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/public/index.html +53 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/public/locales/en/common.json +128 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/public/locales/zh_CN/common.json +130 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/App.tsx +185 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/auditLogProvider.ts +87 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/authProvider.ts +124 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/BulkActions.tsx +236 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/ListPageHeader.tsx +56 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/RowActions.tsx +292 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/SearchBar.tsx +294 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/VanillaJSONEditor/index.css +10 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/VanillaJSONEditor/index.js +53 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/AgentContext.tsx +201 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/AgentPanel.tsx +497 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/ElementInspector.tsx +282 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/agentAttributes.ts +61 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/index.ts +18 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/inspectorActions.ts +111 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/promptGenerator.ts +75 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/skills.ts +464 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/components/eventList/index.tsx +62 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/components/index.ts +4 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/components/logButton/index.tsx +96 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/components/logList/index.tsx +73 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/components/modalDiffViewer/index.tsx +104 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/index.tsx +2 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/contexts/business/index.tsx +65 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/contexts/color-mode/index.tsx +60 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/index.ts +4 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/header/index.tsx +130 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/index.ts +2 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/sider.tsx +218 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/styles.ts +10 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/offLayoutArea/index.tsx +5 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/form.tsx +419 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/index.tsx +3 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/list.tsx +465 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/login.ts +124 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/show.tsx +182 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/utils.ts +76 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/index.ts +7 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/types.ts +138 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useBatchDelete.ts +191 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useBatchOperations.ts +152 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useBatchOperationsCore.ts +193 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useBatchUpdate.ts +182 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useListPageState.ts +303 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useRowSelection.ts +38 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/i18n.ts +19 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/index.tsx +28 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/meta.json +4 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/react-app-env.d.ts +1 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/reportWebVitals.ts +15 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/setupTests.ts +5 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/styles/antd.less +79 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/tsconfig.json +27 -0
- package/dist/lib/application/schema.json +99 -0
- package/dist/lib/class/class.factory.d.ts +3 -0
- package/dist/lib/class/class.factory.js +42 -0
- package/dist/lib/class/files/js/__name__.js +1 -0
- package/dist/lib/class/files/js/__name__.spec.js +7 -0
- package/dist/lib/class/files/ts/__name__.spec.ts +7 -0
- package/dist/lib/class/files/ts/__name__.ts +1 -0
- package/dist/lib/class/schema.json +45 -0
- package/dist/lib/client-app/angular/angular.factory.d.ts +3 -0
- package/dist/lib/client-app/angular/angular.factory.js +98 -0
- package/dist/lib/client-app/angular/files/angular.constants.ts +4 -0
- package/dist/lib/client-app/angular/files/angular.module.ts +41 -0
- package/dist/lib/client-app/angular/files/angular.providers.ts +27 -0
- package/dist/lib/client-app/angular/files/angular.utils.ts +19 -0
- package/dist/lib/client-app/angular/files/interfaces/angular-options.interface.ts +87 -0
- package/dist/lib/client-app/angular/files/loaders/abstract.loader.ts +16 -0
- package/dist/lib/client-app/angular/files/loaders/express.loader.ts +25 -0
- package/dist/lib/client-app/angular/files/loaders/fastify.loader.ts +34 -0
- package/dist/lib/client-app/angular/files/loaders/noop.loader.ts +12 -0
- package/dist/lib/client-app/angular/schema.json +24 -0
- package/dist/lib/configuration/configuration.factory.d.ts +3 -0
- package/dist/lib/configuration/configuration.factory.js +24 -0
- package/dist/lib/configuration/files/js/nest-cli.json +6 -0
- package/dist/lib/configuration/files/ts/nest-cli.json +5 -0
- package/dist/lib/controller/controller.factory.d.ts +3 -0
- package/dist/lib/controller/controller.factory.js +118 -0
- package/dist/lib/controller/files/js/__name__.controller.js +4 -0
- package/dist/lib/controller/files/js/__name__.controller.spec.js +18 -0
- package/dist/lib/controller/files/ts/__name__.controller.spec.ts +18 -0
- package/dist/lib/controller/files/ts/__name__.controller.ts +137 -0
- package/dist/lib/controller/schema.json +51 -0
- package/dist/lib/decorator/decorator.factory.d.ts +3 -0
- package/dist/lib/decorator/decorator.factory.js +33 -0
- package/dist/lib/decorator/files/js/__name__.decorator.js +3 -0
- package/dist/lib/decorator/files/ts/__name__.decorator.ts +3 -0
- package/dist/lib/decorator/schema.json +36 -0
- package/dist/lib/defaults.d.ts +16 -0
- package/dist/lib/defaults.js +19 -0
- package/dist/lib/filter/files/js/__name__.filter.js +6 -0
- package/dist/lib/filter/files/js/__name__.filter.spec.js +7 -0
- package/dist/lib/filter/files/ts/__name__.filter.spec.ts +7 -0
- package/dist/lib/filter/files/ts/__name__.filter.ts +6 -0
- package/dist/lib/filter/filter.factory.d.ts +3 -0
- package/dist/lib/filter/filter.factory.js +34 -0
- package/dist/lib/filter/schema.json +41 -0
- package/dist/lib/gateway/files/js/__name__.gateway.js +9 -0
- package/dist/lib/gateway/files/js/__name__.gateway.spec.js +18 -0
- package/dist/lib/gateway/files/ts/__name__.gateway.spec.ts +18 -0
- package/dist/lib/gateway/files/ts/__name__.gateway.ts +9 -0
- package/dist/lib/gateway/gateway.factory.d.ts +3 -0
- package/dist/lib/gateway/gateway.factory.js +62 -0
- package/dist/lib/gateway/schema.json +41 -0
- package/dist/lib/guard/files/js/__name__.guard.js +8 -0
- package/dist/lib/guard/files/js/__name__.guard.spec.js +7 -0
- package/dist/lib/guard/files/ts/__name__.guard.spec.ts +7 -0
- package/dist/lib/guard/files/ts/__name__.guard.ts +11 -0
- package/dist/lib/guard/guard.factory.d.ts +3 -0
- package/dist/lib/guard/guard.factory.js +34 -0
- package/dist/lib/guard/schema.json +41 -0
- package/dist/lib/interceptor/files/js/__name__.interceptor.js +8 -0
- package/dist/lib/interceptor/files/js/__name__.interceptor.spec.js +7 -0
- package/dist/lib/interceptor/files/ts/default/__name__.interceptor.spec.ts +7 -0
- package/dist/lib/interceptor/files/ts/default/__name__.interceptor.ts +9 -0
- package/dist/lib/interceptor/files/ts/generated/__name__.interceptor.spec.ts +7 -0
- package/dist/lib/interceptor/files/ts/generated/__name__.interceptor.ts +13 -0
- package/dist/lib/interceptor/interceptor.factory.d.ts +3 -0
- package/dist/lib/interceptor/interceptor.factory.js +116 -0
- package/dist/lib/interceptor/schema.json +50 -0
- package/dist/lib/interface/files/__name__.interface.ts +1 -0
- package/dist/lib/interface/interface.factory.d.ts +3 -0
- package/dist/lib/interface/interface.factory.js +32 -0
- package/dist/lib/interface/schema.json +32 -0
- package/dist/lib/library/files/js/.babelrc +4 -0
- package/dist/lib/library/files/js/jsconfig.json +9 -0
- package/dist/lib/library/files/js/src/__name__.module.js +8 -0
- package/dist/lib/library/files/js/src/__name__.service.js +4 -0
- package/dist/lib/library/files/js/src/__name__.service.spec.js +18 -0
- package/dist/lib/library/files/js/src/index.js +2 -0
- package/dist/lib/library/files/ts/src/__name__.module.ts +8 -0
- package/dist/lib/library/files/ts/src/__name__.service.spec.ts +18 -0
- package/dist/lib/library/files/ts/src/__name__.service.ts +4 -0
- package/dist/lib/library/files/ts/src/index.ts +2 -0
- package/dist/lib/library/files/ts/tsconfig.lib.json +9 -0
- package/dist/lib/library/library.factory.d.ts +3 -0
- package/dist/lib/library/library.factory.js +190 -0
- package/dist/lib/library/schema.json +37 -0
- package/dist/lib/middleware/files/js/__name__.middleware.js +8 -0
- package/dist/lib/middleware/files/js/__name__.middleware.spec.js +7 -0
- package/dist/lib/middleware/files/ts/__name__.middleware.spec.ts +7 -0
- package/dist/lib/middleware/files/ts/__name__.middleware.ts +8 -0
- package/dist/lib/middleware/middleware.factory.d.ts +3 -0
- package/dist/lib/middleware/middleware.factory.js +34 -0
- package/dist/lib/middleware/schema.json +41 -0
- package/dist/lib/module/files/js/__name__.module.js +4 -0
- package/dist/lib/module/files/ts/__name__.module.ts +4 -0
- package/dist/lib/module/module.factory.d.ts +3 -0
- package/dist/lib/module/module.factory.js +58 -0
- package/dist/lib/module/schema.json +46 -0
- package/dist/lib/pipe/files/js/__name__.pipe.js +8 -0
- package/dist/lib/pipe/files/js/__name__.pipe.spec.js +7 -0
- package/dist/lib/pipe/files/ts/__name__.pipe.spec.ts +7 -0
- package/dist/lib/pipe/files/ts/__name__.pipe.ts +8 -0
- package/dist/lib/pipe/pipe.factory.d.ts +3 -0
- package/dist/lib/pipe/pipe.factory.js +34 -0
- package/dist/lib/pipe/schema.json +41 -0
- package/dist/lib/prisma-resource/files/ts/__name__.controller.spec.ts +20 -0
- package/dist/lib/prisma-resource/files/ts/__name__.controller.ts +63 -0
- package/dist/lib/prisma-resource/files/ts/__name__.module.ts +9 -0
- package/dist/lib/prisma-resource/files/ts/__name__.service.spec.ts +18 -0
- package/dist/lib/prisma-resource/files/ts/__name__.service.ts +28 -0
- package/dist/lib/prisma-resource/files/ts/dto/create-__name@singular__.dto.ts +1 -0
- package/dist/lib/prisma-resource/files/ts/dto/create-__name@singular__.input.ts +7 -0
- package/dist/lib/prisma-resource/files/ts/dto/update-__name@singular__.dto.ts +6 -0
- package/dist/lib/prisma-resource/files/ts/dto/update-__name@singular__.input.ts +13 -0
- package/dist/lib/prisma-resource/files/ts/entities/__name@singular@ent__.ts +7 -0
- package/dist/lib/prisma-resource/prisma-resource.factory.d.ts +3 -0
- package/dist/lib/prisma-resource/prisma-resource.factory.js +131 -0
- package/dist/lib/prisma-resource/schema.json +91 -0
- package/dist/lib/provider/files/js/__name__.js +4 -0
- package/dist/lib/provider/files/js/__name__.spec.js +18 -0
- package/dist/lib/provider/files/ts/__name__.spec.ts +18 -0
- package/dist/lib/provider/files/ts/__name__.ts +4 -0
- package/dist/lib/provider/provider.factory.d.ts +3 -0
- package/dist/lib/provider/provider.factory.js +67 -0
- package/dist/lib/provider/schema.json +45 -0
- package/dist/lib/resolver/files/js/__name__.resolver.js +4 -0
- package/dist/lib/resolver/files/js/__name__.resolver.spec.js +18 -0
- package/dist/lib/resolver/files/ts/__name__.resolver.spec.ts +18 -0
- package/dist/lib/resolver/files/ts/__name__.resolver.ts +4 -0
- package/dist/lib/resolver/resolver.factory.d.ts +3 -0
- package/dist/lib/resolver/resolver.factory.js +62 -0
- package/dist/lib/resolver/schema.json +41 -0
- package/dist/lib/resource/files/ts/__name__.controller.spec.ts +20 -0
- package/dist/lib/resource/files/ts/__name__.controller.ts +63 -0
- package/dist/lib/resource/files/ts/__name__.gateway.spec.ts +19 -0
- package/dist/lib/resource/files/ts/__name__.gateway.ts +34 -0
- package/dist/lib/resource/files/ts/__name__.graphql +24 -0
- package/dist/lib/resource/files/ts/__name__.module.ts +9 -0
- package/dist/lib/resource/files/ts/__name__.resolver.spec.ts +19 -0
- package/dist/lib/resource/files/ts/__name__.resolver.ts +60 -0
- package/dist/lib/resource/files/ts/__name__.service.spec.ts +18 -0
- package/dist/lib/resource/files/ts/__name__.service.ts +28 -0
- package/dist/lib/resource/files/ts/dto/create-__name@singular__.dto.ts +1 -0
- package/dist/lib/resource/files/ts/dto/create-__name@singular__.input.ts +7 -0
- package/dist/lib/resource/files/ts/dto/update-__name@singular__.dto.ts +6 -0
- package/dist/lib/resource/files/ts/dto/update-__name@singular__.input.ts +13 -0
- package/dist/lib/resource/files/ts/entities/__name@singular@ent__.ts +7 -0
- package/dist/lib/resource/resource.factory.d.ts +3 -0
- package/dist/lib/resource/resource.factory.js +131 -0
- package/dist/lib/resource/schema.json +90 -0
- package/dist/lib/service/files/js/__name__.service.js +4 -0
- package/dist/lib/service/files/js/__name__.service.spec.js +18 -0
- package/dist/lib/service/files/ts/__name__.service.spec.ts +18 -0
- package/dist/lib/service/files/ts/__name__.service.ts +4 -0
- package/dist/lib/service/schema.json +41 -0
- package/dist/lib/service/service.factory.d.ts +3 -0
- package/dist/lib/service/service.factory.js +63 -0
- package/dist/lib/sub-app/files/js/.babelrc +4 -0
- package/dist/lib/sub-app/files/js/index.js +2 -0
- package/dist/lib/sub-app/files/js/jsconfig.json +10 -0
- package/dist/lib/sub-app/files/js/src/app.controller.js +15 -0
- package/dist/lib/sub-app/files/js/src/app.controller.spec.js +22 -0
- package/dist/lib/sub-app/files/js/src/app.module.js +10 -0
- package/dist/lib/sub-app/files/js/src/app.service.js +8 -0
- package/dist/lib/sub-app/files/js/src/main.js +8 -0
- package/dist/lib/sub-app/files/js/test/app.e2e-spec.js +23 -0
- package/dist/lib/sub-app/files/js/test/jest-e2e.json +5 -0
- package/dist/lib/sub-app/files/ts/src/__name__.controller.spec.ts +22 -0
- package/dist/lib/sub-app/files/ts/src/__name__.controller.ts +12 -0
- package/dist/lib/sub-app/files/ts/src/__name__.module.ts +10 -0
- package/dist/lib/sub-app/files/ts/src/__name__.service.ts +8 -0
- package/dist/lib/sub-app/files/ts/src/main.ts +8 -0
- package/dist/lib/sub-app/files/ts/test/app.e2e-spec.ts +24 -0
- package/dist/lib/sub-app/files/ts/test/jest-e2e.json +9 -0
- package/dist/lib/sub-app/files/ts/tsconfig.app.json +9 -0
- package/dist/lib/sub-app/schema.json +32 -0
- package/dist/lib/sub-app/sub-app.factory.d.ts +3 -0
- package/dist/lib/sub-app/sub-app.factory.js +245 -0
- package/dist/lib/sub-app/workspace/js/.babelrc +4 -0
- package/dist/lib/sub-app/workspace/js/index.js +2 -0
- package/dist/lib/sub-app/workspace/js/jsconfig.json +10 -0
- package/dist/lib/sub-app/workspace/ts/tsconfig.app.json +9 -0
- package/dist/utils/change.d.ts +46 -0
- package/dist/utils/change.js +95 -0
- package/dist/utils/dependencies.utils.d.ts +15 -0
- package/dist/utils/dependencies.utils.js +42 -0
- package/dist/utils/export-from.declarator.d.ts +10 -0
- package/dist/utils/export-from.declarator.js +39 -0
- package/dist/utils/formatting.d.ts +1 -0
- package/dist/utils/formatting.js +12 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.js +25 -0
- package/dist/utils/json-file.util.d.ts +15 -0
- package/dist/utils/json-file.util.js +68 -0
- package/dist/utils/metadata.manager.d.ts +13 -0
- package/dist/utils/metadata.manager.js +162 -0
- package/dist/utils/module-import.declarator.d.ts +10 -0
- package/dist/utils/module-import.declarator.js +39 -0
- package/dist/utils/module-metadata.declarator.d.ts +4 -0
- package/dist/utils/module-metadata.declarator.js +12 -0
- package/dist/utils/module.declarator.d.ts +23 -0
- package/dist/utils/module.declarator.js +32 -0
- package/dist/utils/module.finder.d.ts +13 -0
- package/dist/utils/module.finder.js +24 -0
- package/dist/utils/name.parser.d.ts +12 -0
- package/dist/utils/name.parser.js +17 -0
- package/dist/utils/path.solver.d.ts +4 -0
- package/dist/utils/path.solver.js +14 -0
- package/dist/utils/source-root.helpers.d.ts +8 -0
- package/dist/utils/source-root.helpers.js +35 -0
- package/package.json +99 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Dropdown, Input, Modal } from 'antd';
|
|
3
|
+
import { useAgent } from './AgentContext';
|
|
4
|
+
import { AgentType } from './agentAttributes';
|
|
5
|
+
import {
|
|
6
|
+
getInspectorActions,
|
|
7
|
+
InspectedElementInfo,
|
|
8
|
+
InspectorAction,
|
|
9
|
+
} from './inspectorActions';
|
|
10
|
+
|
|
11
|
+
const TYPE_LABELS: Record<AgentType, string> = {
|
|
12
|
+
'table-column': '表格列',
|
|
13
|
+
'form-field': '表单字段',
|
|
14
|
+
'show-field': '详情字段',
|
|
15
|
+
'search-bar': '搜索栏',
|
|
16
|
+
'list-header': '列表头部',
|
|
17
|
+
'row-actions': '行操作',
|
|
18
|
+
'bulk-actions': '批量操作',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function findAgentElement(x: number, y: number): HTMLElement | null {
|
|
22
|
+
const elements = document.elementsFromPoint(x, y);
|
|
23
|
+
for (const el of elements) {
|
|
24
|
+
if (el instanceof HTMLElement && el.dataset.agentType) {
|
|
25
|
+
return el;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function parseElementInfo(
|
|
32
|
+
el: HTMLElement,
|
|
33
|
+
x: number,
|
|
34
|
+
y: number,
|
|
35
|
+
): InspectedElementInfo {
|
|
36
|
+
return {
|
|
37
|
+
type: el.dataset.agentType as AgentType,
|
|
38
|
+
field: el.dataset.agentField,
|
|
39
|
+
resource: el.dataset.agentResource || '',
|
|
40
|
+
file: el.dataset.agentFile,
|
|
41
|
+
meta: el.dataset.agentMeta ? JSON.parse(el.dataset.agentMeta) : undefined,
|
|
42
|
+
x,
|
|
43
|
+
y,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const ElementInspector: React.FC = () => {
|
|
48
|
+
const agent = useAgent();
|
|
49
|
+
const [highlight, setHighlight] = useState<DOMRect | null>(null);
|
|
50
|
+
const [label, setLabel] = useState('');
|
|
51
|
+
const [menuInfo, setMenuInfo] = useState<InspectedElementInfo | null>(null);
|
|
52
|
+
const [menuRect, setMenuRect] = useState<DOMRect | null>(null);
|
|
53
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
54
|
+
const [freeInputVisible, setFreeInputVisible] = useState(false);
|
|
55
|
+
const [freeInputValue, setFreeInputValue] = useState('');
|
|
56
|
+
const pendingActionRef = useRef<InspectorAction | null>(null);
|
|
57
|
+
|
|
58
|
+
const inspecting = agent?.inspecting ?? false;
|
|
59
|
+
|
|
60
|
+
const handleMouseMove = useCallback(
|
|
61
|
+
(e: MouseEvent) => {
|
|
62
|
+
const el = findAgentElement(e.clientX, e.clientY);
|
|
63
|
+
if (el) {
|
|
64
|
+
const rect = el.getBoundingClientRect();
|
|
65
|
+
setHighlight(rect);
|
|
66
|
+
const type = el.dataset.agentType as AgentType;
|
|
67
|
+
const field = el.dataset.agentField;
|
|
68
|
+
setLabel(
|
|
69
|
+
`${TYPE_LABELS[type] || type}${field ? ': ' + field : ''}`,
|
|
70
|
+
);
|
|
71
|
+
} else {
|
|
72
|
+
setHighlight(null);
|
|
73
|
+
setLabel('');
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
[],
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const handleClick = useCallback(
|
|
80
|
+
(e: MouseEvent) => {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
e.stopPropagation();
|
|
83
|
+
const el = findAgentElement(e.clientX, e.clientY);
|
|
84
|
+
if (!el) return;
|
|
85
|
+
|
|
86
|
+
const rect = el.getBoundingClientRect();
|
|
87
|
+
const info = parseElementInfo(el, e.clientX, e.clientY);
|
|
88
|
+
agent?.stopInspecting();
|
|
89
|
+
// keep highlight visible while menu is open
|
|
90
|
+
setHighlight(rect);
|
|
91
|
+
setMenuRect(rect);
|
|
92
|
+
setMenuInfo(info);
|
|
93
|
+
setMenuOpen(true);
|
|
94
|
+
},
|
|
95
|
+
[agent],
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const handleKeyDown = useCallback(
|
|
99
|
+
(e: KeyboardEvent) => {
|
|
100
|
+
if (e.key === 'Escape') {
|
|
101
|
+
agent?.stopInspecting();
|
|
102
|
+
setHighlight(null);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
[agent],
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (!inspecting) return;
|
|
110
|
+
document.addEventListener('mousemove', handleMouseMove, true);
|
|
111
|
+
document.addEventListener('click', handleClick, true);
|
|
112
|
+
document.addEventListener('keydown', handleKeyDown, true);
|
|
113
|
+
return () => {
|
|
114
|
+
document.removeEventListener('mousemove', handleMouseMove, true);
|
|
115
|
+
document.removeEventListener('click', handleClick, true);
|
|
116
|
+
document.removeEventListener('keydown', handleKeyDown, true);
|
|
117
|
+
};
|
|
118
|
+
}, [inspecting, handleMouseMove, handleClick, handleKeyDown]);
|
|
119
|
+
|
|
120
|
+
const applyAction = useCallback(
|
|
121
|
+
(action: InspectorAction, prompt?: string) => {
|
|
122
|
+
if (!agent || !menuInfo) return;
|
|
123
|
+
agent.setSelectedSkillId(action.skillId);
|
|
124
|
+
agent.setSelectedSubSkillId(action.subSkillId);
|
|
125
|
+
agent.setUserPrompt(prompt || action.promptTemplate || '');
|
|
126
|
+
agent.setInspectedElement(menuInfo);
|
|
127
|
+
agent.open();
|
|
128
|
+
setMenuOpen(false);
|
|
129
|
+
setMenuInfo(null);
|
|
130
|
+
setMenuRect(null);
|
|
131
|
+
setHighlight(null);
|
|
132
|
+
},
|
|
133
|
+
[agent, menuInfo],
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
const handleMenuAction = useCallback(
|
|
137
|
+
(action: InspectorAction) => {
|
|
138
|
+
if (action.freeInput) {
|
|
139
|
+
pendingActionRef.current = action;
|
|
140
|
+
setFreeInputValue('');
|
|
141
|
+
setFreeInputVisible(true);
|
|
142
|
+
setMenuOpen(false);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
applyAction(action);
|
|
146
|
+
},
|
|
147
|
+
[applyAction],
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
const handleFreeInputOk = useCallback(() => {
|
|
151
|
+
const action = pendingActionRef.current;
|
|
152
|
+
if (action) {
|
|
153
|
+
applyAction(action, freeInputValue);
|
|
154
|
+
}
|
|
155
|
+
setFreeInputVisible(false);
|
|
156
|
+
pendingActionRef.current = null;
|
|
157
|
+
}, [applyAction, freeInputValue]);
|
|
158
|
+
|
|
159
|
+
const handleFreeInputCancel = useCallback(() => {
|
|
160
|
+
setFreeInputVisible(false);
|
|
161
|
+
pendingActionRef.current = null;
|
|
162
|
+
setMenuInfo(null);
|
|
163
|
+
setMenuRect(null);
|
|
164
|
+
setHighlight(null);
|
|
165
|
+
}, []);
|
|
166
|
+
|
|
167
|
+
const handleMenuOpenChange = useCallback((open: boolean) => {
|
|
168
|
+
if (!open) {
|
|
169
|
+
setMenuOpen(false);
|
|
170
|
+
setMenuInfo(null);
|
|
171
|
+
setMenuRect(null);
|
|
172
|
+
setHighlight(null);
|
|
173
|
+
}
|
|
174
|
+
}, []);
|
|
175
|
+
|
|
176
|
+
if (!agent) return null;
|
|
177
|
+
|
|
178
|
+
const actions = menuInfo ? getInspectorActions(menuInfo) : [];
|
|
179
|
+
|
|
180
|
+
const menuItems = actions.map((action) => ({
|
|
181
|
+
key: action.label,
|
|
182
|
+
label: action.label,
|
|
183
|
+
onClick: () => handleMenuAction(action),
|
|
184
|
+
}));
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
<>
|
|
188
|
+
{/* Overlay — captures mouse events during inspect mode */}
|
|
189
|
+
{inspecting && (
|
|
190
|
+
<div
|
|
191
|
+
style={{
|
|
192
|
+
position: 'fixed',
|
|
193
|
+
inset: 0,
|
|
194
|
+
zIndex: 10000,
|
|
195
|
+
cursor: 'crosshair',
|
|
196
|
+
}}
|
|
197
|
+
/>
|
|
198
|
+
)}
|
|
199
|
+
|
|
200
|
+
{/* Highlight box — rendered independently so it persists while menu is open */}
|
|
201
|
+
{highlight && (
|
|
202
|
+
<>
|
|
203
|
+
<div
|
|
204
|
+
style={{
|
|
205
|
+
position: 'fixed',
|
|
206
|
+
left: highlight.left,
|
|
207
|
+
top: highlight.top,
|
|
208
|
+
width: highlight.width,
|
|
209
|
+
height: highlight.height,
|
|
210
|
+
border: '2px solid #1890ff',
|
|
211
|
+
background: 'rgba(24,144,255,0.1)',
|
|
212
|
+
pointerEvents: 'none',
|
|
213
|
+
zIndex: 10001,
|
|
214
|
+
borderRadius: 2,
|
|
215
|
+
}}
|
|
216
|
+
/>
|
|
217
|
+
{/* Label */}
|
|
218
|
+
{label && (
|
|
219
|
+
<div
|
|
220
|
+
style={{
|
|
221
|
+
position: 'fixed',
|
|
222
|
+
left: highlight.left,
|
|
223
|
+
top: Math.max(0, highlight.top - 26),
|
|
224
|
+
background: '#1890ff',
|
|
225
|
+
color: '#fff',
|
|
226
|
+
fontSize: 12,
|
|
227
|
+
padding: '2px 8px',
|
|
228
|
+
borderRadius: '4px 4px 0 0',
|
|
229
|
+
pointerEvents: 'none',
|
|
230
|
+
zIndex: 10002,
|
|
231
|
+
whiteSpace: 'nowrap',
|
|
232
|
+
}}
|
|
233
|
+
>
|
|
234
|
+
{label}
|
|
235
|
+
</div>
|
|
236
|
+
)}
|
|
237
|
+
</>
|
|
238
|
+
)}
|
|
239
|
+
|
|
240
|
+
{/* Action menu — anchor positioned at the clicked element's right-bottom */}
|
|
241
|
+
<Dropdown
|
|
242
|
+
menu={{ items: menuItems }}
|
|
243
|
+
open={menuOpen}
|
|
244
|
+
onOpenChange={handleMenuOpenChange}
|
|
245
|
+
placement="bottomRight"
|
|
246
|
+
trigger={['click']}
|
|
247
|
+
>
|
|
248
|
+
<div
|
|
249
|
+
style={{
|
|
250
|
+
position: 'fixed',
|
|
251
|
+
left: menuRect ? menuRect.right : 0,
|
|
252
|
+
top: menuRect ? menuRect.bottom : 0,
|
|
253
|
+
width: 1,
|
|
254
|
+
height: 1,
|
|
255
|
+
zIndex: menuOpen ? 10003 : -1,
|
|
256
|
+
pointerEvents: menuOpen ? 'auto' : 'none',
|
|
257
|
+
}}
|
|
258
|
+
/>
|
|
259
|
+
</Dropdown>
|
|
260
|
+
|
|
261
|
+
{/* Free input modal */}
|
|
262
|
+
<Modal
|
|
263
|
+
title="输入自定义需求"
|
|
264
|
+
open={freeInputVisible}
|
|
265
|
+
onOk={handleFreeInputOk}
|
|
266
|
+
onCancel={handleFreeInputCancel}
|
|
267
|
+
okText="确定"
|
|
268
|
+
cancelText="取消"
|
|
269
|
+
zIndex={10010}
|
|
270
|
+
>
|
|
271
|
+
<Input.TextArea
|
|
272
|
+
rows={3}
|
|
273
|
+
value={freeInputValue}
|
|
274
|
+
onChange={(e) => setFreeInputValue(e.target.value)}
|
|
275
|
+
placeholder="请描述你想要的自定义操作..."
|
|
276
|
+
/>
|
|
277
|
+
</Modal>
|
|
278
|
+
</>
|
|
279
|
+
);
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export default ElementInspector;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type AgentType =
|
|
2
|
+
| 'table-column'
|
|
3
|
+
| 'form-field'
|
|
4
|
+
| 'show-field'
|
|
5
|
+
| 'search-bar'
|
|
6
|
+
| 'list-header'
|
|
7
|
+
| 'row-actions'
|
|
8
|
+
| 'bulk-actions';
|
|
9
|
+
|
|
10
|
+
export interface AgentAttrsOptions {
|
|
11
|
+
type: AgentType;
|
|
12
|
+
field?: string;
|
|
13
|
+
resource: string;
|
|
14
|
+
file?: string;
|
|
15
|
+
meta?: Record<string, any>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Generate data-agent-* attributes for element inspector.
|
|
20
|
+
* Only returns attributes in development mode; returns empty object in production.
|
|
21
|
+
*/
|
|
22
|
+
export function agentAttrs(options: AgentAttrsOptions): Record<string, string> {
|
|
23
|
+
if (process.env.NODE_ENV !== 'development') {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const attrs: Record<string, string> = {
|
|
28
|
+
'data-agent-type': options.type,
|
|
29
|
+
'data-agent-resource': options.resource,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
if (options.field) {
|
|
33
|
+
attrs['data-agent-field'] = options.field;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (options.file) {
|
|
37
|
+
attrs['data-agent-file'] = options.file;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (options.meta) {
|
|
41
|
+
attrs['data-agent-meta'] = JSON.stringify(options.meta);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return attrs;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Returns Table.Column props (onHeaderCell) to inject row-actions agent attributes on the header.
|
|
49
|
+
* Spread onto the actions `<Table.Column>`:
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <Table.Column title="Actions" {...getRowActionsColumnProps(resourceName)} render={...} />
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export function getRowActionsColumnProps(resource: string): Record<string, any> {
|
|
55
|
+
if (process.env.NODE_ENV !== 'development') {
|
|
56
|
+
return {};
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
onHeaderCell: () => agentAttrs({ type: 'row-actions', resource }),
|
|
60
|
+
};
|
|
61
|
+
}
|
package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/index.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { AgentProvider, useAgent } from './AgentContext';
|
|
2
|
+
export type { PageInfo, PageType } from './AgentContext';
|
|
3
|
+
export { AgentPanel } from './AgentPanel';
|
|
4
|
+
export {
|
|
5
|
+
skills,
|
|
6
|
+
getPageSkills,
|
|
7
|
+
getProjectSkills,
|
|
8
|
+
getSubSkills,
|
|
9
|
+
findSkillById,
|
|
10
|
+
getParentSkillId,
|
|
11
|
+
} from './skills';
|
|
12
|
+
export type { Skill, SubSkill } from './skills';
|
|
13
|
+
export { generatePrompt } from './promptGenerator';
|
|
14
|
+
export { agentAttrs, getRowActionsColumnProps } from './agentAttributes';
|
|
15
|
+
export type { AgentType, AgentAttrsOptions } from './agentAttributes';
|
|
16
|
+
export { ElementInspector } from './ElementInspector';
|
|
17
|
+
export { getInspectorActions } from './inspectorActions';
|
|
18
|
+
export type { InspectorAction, InspectedElementInfo } from './inspectorActions';
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { AgentType } from './agentAttributes';
|
|
2
|
+
|
|
3
|
+
export interface InspectorAction {
|
|
4
|
+
label: string;
|
|
5
|
+
/** Sub-skill ID from skills.ts */
|
|
6
|
+
subSkillId: string;
|
|
7
|
+
/** Parent skill ID */
|
|
8
|
+
skillId: string;
|
|
9
|
+
/** Prompt template. Use {resource} and {field} as placeholders. */
|
|
10
|
+
promptTemplate?: string;
|
|
11
|
+
/** If true, show a free-text input instead of pre-filled prompt */
|
|
12
|
+
freeInput?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface InspectedElementInfo {
|
|
16
|
+
type: AgentType;
|
|
17
|
+
field?: string;
|
|
18
|
+
resource: string;
|
|
19
|
+
file?: string;
|
|
20
|
+
meta?: Record<string, any>;
|
|
21
|
+
/** Click position for menu placement */
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function col(resource: string, field: string): string {
|
|
27
|
+
return `${resource} 列表中的 "${field}" 列`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function formF(resource: string, field: string): string {
|
|
31
|
+
return `${resource} 表单中的 "${field}" 字段`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function showF(resource: string, field: string): string {
|
|
35
|
+
return `${resource} 详情页的 "${field}" 字段`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function getInspectorActions(info: InspectedElementInfo): InspectorAction[] {
|
|
39
|
+
const { type, resource, field } = info;
|
|
40
|
+
const r = resource;
|
|
41
|
+
const f = field || '';
|
|
42
|
+
|
|
43
|
+
switch (type) {
|
|
44
|
+
case 'table-column':
|
|
45
|
+
return [
|
|
46
|
+
{ label: '不显示',subSkillId: 'column-visibility', skillId: 'list-customization', promptTemplate: `隐藏 ${col(r, f)}` },
|
|
47
|
+
{ label: '修改样式', subSkillId: 'column-render', skillId: 'list-customization', promptTemplate: `自定义 ${col(r, f)}的渲染样式` },
|
|
48
|
+
{ label: '修改描述', subSkillId: 'page-i18n', skillId: 'i18n', promptTemplate: `修改 ${col(r, f)}的显示名称` },
|
|
49
|
+
{ label: '固定列', subSkillId: 'fixed-column', skillId: 'list-customization', promptTemplate: `将 ${col(r, f)}固定到左侧/右侧` },
|
|
50
|
+
{ label: '行内编辑', subSkillId: 'inline-edit', skillId: 'list-customization', promptTemplate: `为 ${col(r, f)}启用行内编辑` },
|
|
51
|
+
{ label: '排序', subSkillId: 'ui-config', skillId: 'ui-config', promptTemplate: `为 ${col(r, f)}添加排序` },
|
|
52
|
+
{ label: '筛选', subSkillId: 'ui-config', skillId: 'ui-config', promptTemplate: `为 ${col(r, f)}添加筛选` },
|
|
53
|
+
{ label: '其他', subSkillId: 'list-customization', skillId: 'list-customization', freeInput: true },
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
case 'form-field':
|
|
57
|
+
return [
|
|
58
|
+
{ label: '不显示',subSkillId: 'form-field-dependencies', skillId: 'form-customization', promptTemplate: `隐藏 ${formF(r, f)}` },
|
|
59
|
+
{ label: '修改样式', subSkillId: 'form-customization', skillId: 'form-customization', promptTemplate: `自定义 ${formF(r, f)}的组件` },
|
|
60
|
+
{ label: '添加提示', subSkillId: 'field-tooltip', skillId: 'form-customization', promptTemplate: `为 ${formF(r, f)}添加 Tooltip` },
|
|
61
|
+
{ label: '添加校验', subSkillId: 'custom-validator', skillId: 'form-customization', promptTemplate: `为 ${formF(r, f)}添加校验规则` },
|
|
62
|
+
{ label: '字段联动', subSkillId: 'form-field-dependencies', skillId: 'form-customization', promptTemplate: `为 ${formF(r, f)}添加联动依赖` },
|
|
63
|
+
{ label: '其他', subSkillId: 'form-customization', skillId: 'form-customization', freeInput: true },
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
case 'show-field':
|
|
67
|
+
return [
|
|
68
|
+
{ label: '不显示',subSkillId: 'field-render', skillId: 'show-customization', promptTemplate: `隐藏 ${showF(r, f)}` },
|
|
69
|
+
{ label: '修改样式', subSkillId: 'field-render', skillId: 'show-customization', promptTemplate: `自定义 ${showF(r, f)}的显示方式` },
|
|
70
|
+
{ label: '修改描述', subSkillId: 'page-i18n', skillId: 'i18n', promptTemplate: `修改 ${showF(r, f)}的标签` },
|
|
71
|
+
{ label: '其他', subSkillId: 'show-customization', skillId: 'show-customization', freeInput: true },
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
case 'search-bar':
|
|
75
|
+
return [
|
|
76
|
+
{ label: '不显示',subSkillId: 'list-customization', skillId: 'list-customization', promptTemplate: `隐藏 ${r} 列表的搜索栏` },
|
|
77
|
+
{ label: '自定义搜索', subSkillId: 'list-customization', skillId: 'list-customization', promptTemplate: `自定义 ${r} 列表的搜索栏` },
|
|
78
|
+
{ label: '其他', subSkillId: 'list-customization', skillId: 'list-customization', freeInput: true },
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
case 'list-header':
|
|
82
|
+
return [
|
|
83
|
+
{ label: '不显示',subSkillId: 'conditional-create-button', skillId: 'list-customization', promptTemplate: `隐藏 ${r} 列表的头部按钮` },
|
|
84
|
+
{ label: '自定义按钮', subSkillId: 'list-customization', skillId: 'list-customization', promptTemplate: `自定义 ${r} 列表的头部按钮` },
|
|
85
|
+
{ label: '自定义导出', subSkillId: 'export-customization', skillId: 'list-customization', promptTemplate: `自定义 ${r} 列表的导出功能` },
|
|
86
|
+
{ label: '自定义导入', subSkillId: 'import-customization', skillId: 'list-customization', promptTemplate: `自定义 ${r} 列表的导入功能` },
|
|
87
|
+
{ label: '其他', subSkillId: 'list-customization', skillId: 'list-customization', freeInput: true },
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
case 'row-actions':
|
|
91
|
+
return [
|
|
92
|
+
{ label: '不显示',subSkillId: 'readonly-mode', skillId: 'list-customization', promptTemplate: `隐藏 ${r} 列表的行操作按钮` },
|
|
93
|
+
{ label: '自定义操作', subSkillId: 'custom-row-actions', skillId: 'list-customization', promptTemplate: `自定义 ${r} 列表的行操作` },
|
|
94
|
+
{ label: '添加链接跳转', subSkillId: 'row-action-link', skillId: 'list-customization', promptTemplate: `为 ${r} 列表添加行操作链接跳转` },
|
|
95
|
+
{ label: '添加外部链接', subSkillId: 'row-action-external', skillId: 'list-customization', promptTemplate: `为 ${r} 列表添加行操作外部链接` },
|
|
96
|
+
{ label: '添加弹窗+API', subSkillId: 'row-action-modal-api', skillId: 'list-customization', promptTemplate: `为 ${r} 列表添加行操作弹窗和 API 调用` },
|
|
97
|
+
{ label: '其他', subSkillId: 'list-customization', skillId: 'list-customization', freeInput: true },
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
case 'bulk-actions':
|
|
101
|
+
return [
|
|
102
|
+
{ label: '不显示',subSkillId: 'list-customization', skillId: 'list-customization', promptTemplate: `隐藏 ${r} 列表的批量操作` },
|
|
103
|
+
{ label: '批量修改弹窗', subSkillId: 'batch-modify-modal', skillId: 'list-customization', promptTemplate: `为 ${r} 列表添加批量修改弹窗` },
|
|
104
|
+
{ label: '批量删除', subSkillId: 'batch-delete-promise', skillId: 'list-customization', promptTemplate: `为 ${r} 列表自定义批量删除` },
|
|
105
|
+
{ label: '其他', subSkillId: 'list-customization', skillId: 'list-customization', freeInput: true },
|
|
106
|
+
];
|
|
107
|
+
|
|
108
|
+
default:
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Skill, SubSkill } from './skills';
|
|
2
|
+
import { PageInfo } from './AgentContext';
|
|
3
|
+
|
|
4
|
+
export interface PromptOptions {
|
|
5
|
+
skill: Skill;
|
|
6
|
+
subSkill?: SubSkill;
|
|
7
|
+
pageInfo: PageInfo;
|
|
8
|
+
userPrompt: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Generate a structured prompt for Claude Code
|
|
13
|
+
*/
|
|
14
|
+
export function generatePrompt(options: PromptOptions): string {
|
|
15
|
+
const { skill, subSkill, pageInfo, userPrompt } = options;
|
|
16
|
+
|
|
17
|
+
const parts: string[] = [];
|
|
18
|
+
|
|
19
|
+
// 1. Skill invocation
|
|
20
|
+
parts.push(`/${skill.name}`);
|
|
21
|
+
parts.push('');
|
|
22
|
+
|
|
23
|
+
// 2. Sub-skill specification (if selected)
|
|
24
|
+
if (subSkill) {
|
|
25
|
+
parts.push(`## Sub-skill: ${subSkill.name}`);
|
|
26
|
+
parts.push(subSkill.description);
|
|
27
|
+
parts.push('');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 3. Context information
|
|
31
|
+
if (skill.category === 'page' && pageInfo.resourceName) {
|
|
32
|
+
parts.push('## Context');
|
|
33
|
+
parts.push(`- Resource: ${pageInfo.resourceName}`);
|
|
34
|
+
parts.push(`- Page Type: ${pageInfo.pageType}`);
|
|
35
|
+
parts.push(`- File: web/src/pages/${pageInfo.resourceName}/${getFileName(pageInfo.pageType)}`);
|
|
36
|
+
parts.push('');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 4. User's request
|
|
40
|
+
if (userPrompt.trim()) {
|
|
41
|
+
parts.push('## Request');
|
|
42
|
+
parts.push(userPrompt.trim());
|
|
43
|
+
parts.push('');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return parts.join('\n');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get the file name based on page type
|
|
51
|
+
*/
|
|
52
|
+
function getFileName(pageType: string): string {
|
|
53
|
+
switch (pageType) {
|
|
54
|
+
case 'list':
|
|
55
|
+
return 'list.tsx';
|
|
56
|
+
case 'create':
|
|
57
|
+
return 'create.tsx';
|
|
58
|
+
case 'edit':
|
|
59
|
+
return 'edit.tsx';
|
|
60
|
+
case 'show':
|
|
61
|
+
return 'show.tsx';
|
|
62
|
+
default:
|
|
63
|
+
return '';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Generate a preview of the prompt (shorter version)
|
|
69
|
+
*/
|
|
70
|
+
export function generatePromptPreview(options: PromptOptions): string {
|
|
71
|
+
const { skill, subSkill, userPrompt } = options;
|
|
72
|
+
const preview = userPrompt.trim().slice(0, 50);
|
|
73
|
+
const subSkillPart = subSkill ? ` > ${subSkill.name}` : '';
|
|
74
|
+
return `/${skill.name}${subSkillPart}${preview ? `: ${preview}...` : ''}`;
|
|
75
|
+
}
|