@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,236 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, Popconfirm, Space } from 'antd';
|
|
3
|
+
import { agentAttrs } from './agentPanel/agentAttributes';
|
|
4
|
+
import { ExportButton } from '@refinedev/antd';
|
|
5
|
+
import { RowAction } from '../hooks/types';
|
|
6
|
+
|
|
7
|
+
export interface BulkActionsRenderContext {
|
|
8
|
+
/** Number of selected items */
|
|
9
|
+
selectedCount: number;
|
|
10
|
+
/** Selected row keys */
|
|
11
|
+
selectedRowKeys: React.Key[];
|
|
12
|
+
/** Handler for update action */
|
|
13
|
+
onUpdate: (values: any) => Promise<void>;
|
|
14
|
+
/** Handler for delete action */
|
|
15
|
+
onDelete: () => Promise<void>;
|
|
16
|
+
/** Handler for export action */
|
|
17
|
+
onExport?: () => void;
|
|
18
|
+
/** Loading states */
|
|
19
|
+
updateLoading: boolean;
|
|
20
|
+
deleteLoading: boolean;
|
|
21
|
+
exportLoading: boolean;
|
|
22
|
+
/** Translation function */
|
|
23
|
+
t: (key: string, defaultValue?: string) => string;
|
|
24
|
+
/** Resource name */
|
|
25
|
+
resourceName: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface BulkActionsProps {
|
|
29
|
+
/** Array of selected row keys */
|
|
30
|
+
selectedRowKeys: React.Key[];
|
|
31
|
+
/** Row selection actions from config */
|
|
32
|
+
actions?: RowAction[];
|
|
33
|
+
/** Handler for status change actions */
|
|
34
|
+
onUpdateSelected?: (values: any) => Promise<void>;
|
|
35
|
+
/** Handler for delete action */
|
|
36
|
+
onDeleteSelected?: () => Promise<void>;
|
|
37
|
+
/** Handler for export action */
|
|
38
|
+
onExportSelected?: () => void;
|
|
39
|
+
/** Loading states */
|
|
40
|
+
updateLoading?: boolean;
|
|
41
|
+
deleteLoading?: boolean;
|
|
42
|
+
exportLoading?: boolean;
|
|
43
|
+
/** Translation function */
|
|
44
|
+
t?: (key: string, defaultValue?: string) => string;
|
|
45
|
+
/** Resource name for i18n keys */
|
|
46
|
+
resourceName?: string;
|
|
47
|
+
/** Show delete button */
|
|
48
|
+
showDelete?: boolean;
|
|
49
|
+
/** Show export button */
|
|
50
|
+
showExport?: boolean;
|
|
51
|
+
/** Custom children - if provided, replaces entire default UI */
|
|
52
|
+
children?: React.ReactNode | ((context: BulkActionsRenderContext) => React.ReactNode);
|
|
53
|
+
|
|
54
|
+
// Render props for fine-grained customization
|
|
55
|
+
/** Custom render for update buttons */
|
|
56
|
+
renderUpdateButton?: (
|
|
57
|
+
action: RowAction,
|
|
58
|
+
onClick: () => void,
|
|
59
|
+
loading: boolean
|
|
60
|
+
) => React.ReactNode;
|
|
61
|
+
/** Custom render for delete button */
|
|
62
|
+
renderDeleteButton?: (onClick: () => void, loading: boolean) => React.ReactNode;
|
|
63
|
+
/** Custom render for export button */
|
|
64
|
+
renderExportButton?: (onClick: () => void, loading: boolean) => React.ReactNode;
|
|
65
|
+
/** Custom render for selection count */
|
|
66
|
+
renderSelectionCount?: (count: number) => React.ReactNode;
|
|
67
|
+
/** Additional actions to render after default actions */
|
|
68
|
+
extraActions?: React.ReactNode;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Bulk actions component for selected rows
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* // Basic usage
|
|
76
|
+
* <BulkActions
|
|
77
|
+
* selectedRowKeys={selectedRowKeys}
|
|
78
|
+
* onUpdateSelected={updateSelectedItems}
|
|
79
|
+
* onDeleteSelected={deleteSelectedItems}
|
|
80
|
+
* t={t}
|
|
81
|
+
* resourceName="audit"
|
|
82
|
+
* />
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* // With custom render props
|
|
86
|
+
* <BulkActions
|
|
87
|
+
* {...props}
|
|
88
|
+
* renderDeleteButton={(onClick, loading) => (
|
|
89
|
+
* <MyCustomDeleteButton onClick={onClick} loading={loading} />
|
|
90
|
+
* )}
|
|
91
|
+
* renderSelectionCount={(count) => (
|
|
92
|
+
* <Badge count={count} />
|
|
93
|
+
* )}
|
|
94
|
+
* />
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* // Completely custom UI using children
|
|
98
|
+
* <BulkActions
|
|
99
|
+
* selectedRowKeys={selectedRowKeys}
|
|
100
|
+
* onUpdateSelected={updateSelectedItems}
|
|
101
|
+
* onDeleteSelected={deleteSelectedItems}
|
|
102
|
+
* >
|
|
103
|
+
* {({ selectedCount, onDelete, updateLoading }) => (
|
|
104
|
+
* <MyCustomBulkActionsUI
|
|
105
|
+
* count={selectedCount}
|
|
106
|
+
* onDelete={onDelete}
|
|
107
|
+
* loading={updateLoading}
|
|
108
|
+
* />
|
|
109
|
+
* )}
|
|
110
|
+
* </BulkActions>
|
|
111
|
+
*/
|
|
112
|
+
export const BulkActions: React.FC<BulkActionsProps> = ({
|
|
113
|
+
selectedRowKeys,
|
|
114
|
+
actions = [],
|
|
115
|
+
onUpdateSelected,
|
|
116
|
+
onDeleteSelected,
|
|
117
|
+
onExportSelected,
|
|
118
|
+
updateLoading = false,
|
|
119
|
+
deleteLoading = false,
|
|
120
|
+
exportLoading = false,
|
|
121
|
+
t = (key, defaultValue) => defaultValue || key,
|
|
122
|
+
resourceName = '',
|
|
123
|
+
showDelete = true,
|
|
124
|
+
showExport = true,
|
|
125
|
+
children,
|
|
126
|
+
renderUpdateButton,
|
|
127
|
+
renderDeleteButton,
|
|
128
|
+
renderExportButton,
|
|
129
|
+
renderSelectionCount,
|
|
130
|
+
extraActions,
|
|
131
|
+
}) => {
|
|
132
|
+
if (selectedRowKeys.length === 0) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const context: BulkActionsRenderContext = {
|
|
137
|
+
selectedCount: selectedRowKeys.length,
|
|
138
|
+
selectedRowKeys,
|
|
139
|
+
onUpdate: onUpdateSelected || (async () => { }),
|
|
140
|
+
onDelete: onDeleteSelected || (async () => { }),
|
|
141
|
+
onExport: onExportSelected,
|
|
142
|
+
updateLoading,
|
|
143
|
+
deleteLoading,
|
|
144
|
+
exportLoading,
|
|
145
|
+
t,
|
|
146
|
+
resourceName,
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// If children is a function, call it with context
|
|
150
|
+
if (typeof children === 'function') {
|
|
151
|
+
return <>{children(context)}</>;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// If children is provided as ReactNode, render it directly
|
|
155
|
+
if (children) {
|
|
156
|
+
return <>{children}</>;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Default rendering
|
|
160
|
+
const statusActions = actions.filter((action) => action.action === 'CHANGE_STATUS');
|
|
161
|
+
|
|
162
|
+
const defaultUpdateButton = (action: RowAction, onClick: () => void, loading: boolean) => (
|
|
163
|
+
<Popconfirm
|
|
164
|
+
key={action.desc}
|
|
165
|
+
placement="top"
|
|
166
|
+
onConfirm={onClick}
|
|
167
|
+
title={t('buttons.confirm', 'Are you sure?')}
|
|
168
|
+
okText={t('buttons.sure', 'Yes')}
|
|
169
|
+
cancelText={t('buttons.cancel', 'No')}
|
|
170
|
+
>
|
|
171
|
+
<Button type="default" loading={loading}>
|
|
172
|
+
{t(`resources.${resourceName}.actions.${action.desc}`, action.desc)}
|
|
173
|
+
</Button>
|
|
174
|
+
</Popconfirm>
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
const defaultDeleteButton = (onClick: () => void, loading: boolean) => (
|
|
178
|
+
<Popconfirm
|
|
179
|
+
placement="top"
|
|
180
|
+
onConfirm={onClick}
|
|
181
|
+
title={t('buttons.confirm', 'Are you sure?')}
|
|
182
|
+
okText={t('buttons.sure', 'Yes')}
|
|
183
|
+
cancelText={t('buttons.cancel', 'No')}
|
|
184
|
+
>
|
|
185
|
+
<Button danger loading={loading}>
|
|
186
|
+
{t('buttons.delete', 'Delete')}
|
|
187
|
+
</Button>
|
|
188
|
+
</Popconfirm>
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
const defaultExportButton = (onClick: () => void, loading: boolean) => (
|
|
192
|
+
<ExportButton onClick={onClick} loading={loading} icon={<></>} />
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
const defaultSelectionCount = (count: number) => (
|
|
196
|
+
<span style={{ marginLeft: 8 }}>
|
|
197
|
+
{t('table.selected', 'Selected') + ' ' + count + ' ' + t('table.items', 'items')}
|
|
198
|
+
</span>
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
return (
|
|
202
|
+
<span {...agentAttrs({ type: 'bulk-actions', resource: resourceName })}>
|
|
203
|
+
<Space>
|
|
204
|
+
{statusActions.map((action) =>
|
|
205
|
+
renderUpdateButton
|
|
206
|
+
? renderUpdateButton(action, () => onUpdateSelected?.(action.values), updateLoading)
|
|
207
|
+
: defaultUpdateButton(action, () => onUpdateSelected?.(action.values), updateLoading)
|
|
208
|
+
)}
|
|
209
|
+
|
|
210
|
+
{/* Export selected */}
|
|
211
|
+
{showExport && onExportSelected && (
|
|
212
|
+
renderExportButton
|
|
213
|
+
? renderExportButton(onExportSelected, exportLoading)
|
|
214
|
+
: defaultExportButton(onExportSelected, exportLoading)
|
|
215
|
+
)}
|
|
216
|
+
|
|
217
|
+
{/* Delete selected */}
|
|
218
|
+
{showDelete && onDeleteSelected && (
|
|
219
|
+
renderDeleteButton
|
|
220
|
+
? renderDeleteButton(onDeleteSelected, deleteLoading)
|
|
221
|
+
: defaultDeleteButton(onDeleteSelected, deleteLoading)
|
|
222
|
+
)}
|
|
223
|
+
|
|
224
|
+
{/* Extra actions */}
|
|
225
|
+
{extraActions}
|
|
226
|
+
|
|
227
|
+
{/* Selection count */}
|
|
228
|
+
{renderSelectionCount
|
|
229
|
+
? renderSelectionCount(selectedRowKeys.length)
|
|
230
|
+
: defaultSelectionCount(selectedRowKeys.length)}
|
|
231
|
+
</Space>
|
|
232
|
+
</span>
|
|
233
|
+
);
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export default BulkActions;
|
package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/ListPageHeader.tsx
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Space } from 'antd';
|
|
3
|
+
import { CreateButton, ExportButton, ImportButton } from '@refinedev/antd';
|
|
4
|
+
import { agentAttrs } from './agentPanel/agentAttributes';
|
|
5
|
+
|
|
6
|
+
export interface ListPageHeaderProps {
|
|
7
|
+
/** Show import button */
|
|
8
|
+
showImport?: boolean;
|
|
9
|
+
/** Show export button */
|
|
10
|
+
showExport?: boolean;
|
|
11
|
+
/** Show create button */
|
|
12
|
+
showCreate?: boolean;
|
|
13
|
+
/** Import button props */
|
|
14
|
+
importProps?: any;
|
|
15
|
+
/** Export handler */
|
|
16
|
+
onExport?: () => void;
|
|
17
|
+
/** Export loading state */
|
|
18
|
+
exportLoading?: boolean;
|
|
19
|
+
/** Custom buttons to render before default buttons */
|
|
20
|
+
extraButtons?: React.ReactNode;
|
|
21
|
+
/** Custom buttons to render after default buttons */
|
|
22
|
+
extraButtonsAfter?: React.ReactNode;
|
|
23
|
+
/** Resource name for agent inspector */
|
|
24
|
+
resourceName?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Default header buttons for list page
|
|
29
|
+
*/
|
|
30
|
+
export const ListPageHeader: React.FC<ListPageHeaderProps> = ({
|
|
31
|
+
showImport = true,
|
|
32
|
+
showExport = true,
|
|
33
|
+
showCreate = true,
|
|
34
|
+
importProps,
|
|
35
|
+
onExport,
|
|
36
|
+
exportLoading = false,
|
|
37
|
+
extraButtons,
|
|
38
|
+
extraButtonsAfter,
|
|
39
|
+
resourceName = '',
|
|
40
|
+
}) => {
|
|
41
|
+
return (
|
|
42
|
+
<div {...agentAttrs({ type: 'list-header', resource: resourceName })}>
|
|
43
|
+
<Space>
|
|
44
|
+
{extraButtons}
|
|
45
|
+
{showImport && importProps && <ImportButton {...importProps} />}
|
|
46
|
+
{showExport && onExport && (
|
|
47
|
+
<ExportButton onClick={onExport} loading={exportLoading} />
|
|
48
|
+
)}
|
|
49
|
+
{showCreate && <CreateButton type="primary" />}
|
|
50
|
+
{extraButtonsAfter}
|
|
51
|
+
</Space>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default ListPageHeader;
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DownOutlined } from '@ant-design/icons';
|
|
3
|
+
import { Button, Dropdown, Popconfirm, Space } from 'antd';
|
|
4
|
+
import {
|
|
5
|
+
CloneButton,
|
|
6
|
+
DeleteButton,
|
|
7
|
+
EditButton,
|
|
8
|
+
ShowButton,
|
|
9
|
+
} from '@refinedev/antd';
|
|
10
|
+
import { RowAction } from '../hooks/types';
|
|
11
|
+
import { whenIsTrue } from '@gadmin2/react-common';
|
|
12
|
+
|
|
13
|
+
export interface RowActionsRenderContext<T = any> {
|
|
14
|
+
/** Current record */
|
|
15
|
+
record: T;
|
|
16
|
+
/** Record ID */
|
|
17
|
+
recordId: number | string;
|
|
18
|
+
/** Translation function */
|
|
19
|
+
t: (key: string, defaultValue?: string) => string;
|
|
20
|
+
/** Resource name */
|
|
21
|
+
resourceName: string;
|
|
22
|
+
/** Update handler */
|
|
23
|
+
onUpdate: (values: any) => void;
|
|
24
|
+
/** Is update loading */
|
|
25
|
+
updateLoading: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface RowActionsProps<T = any> {
|
|
29
|
+
/** Current record */
|
|
30
|
+
record: T;
|
|
31
|
+
/** Record ID field name */
|
|
32
|
+
idField?: keyof T;
|
|
33
|
+
/** Row actions from config */
|
|
34
|
+
actions?: RowAction[];
|
|
35
|
+
/** Handler for row update */
|
|
36
|
+
onUpdate?: (id: number, values: any) => void;
|
|
37
|
+
/** Is update loading */
|
|
38
|
+
updateLoading?: boolean;
|
|
39
|
+
/** Translation function */
|
|
40
|
+
t?: (key: string, defaultValue?: string) => string;
|
|
41
|
+
/** Resource name for i18n keys */
|
|
42
|
+
resourceName?: string;
|
|
43
|
+
/** Show edit button */
|
|
44
|
+
showEdit?: boolean;
|
|
45
|
+
/** Show detail/show button */
|
|
46
|
+
showDetail?: boolean;
|
|
47
|
+
/** Show clone button */
|
|
48
|
+
showClone?: boolean;
|
|
49
|
+
/** Show delete button */
|
|
50
|
+
showDelete?: boolean;
|
|
51
|
+
/** Show history/log button */
|
|
52
|
+
showHistory?: boolean;
|
|
53
|
+
/** Custom children - if provided, replaces entire default UI */
|
|
54
|
+
children?: React.ReactNode | ((context: RowActionsRenderContext<T>) => React.ReactNode);
|
|
55
|
+
|
|
56
|
+
// Render props for fine-grained customization
|
|
57
|
+
/** Custom render for edit button */
|
|
58
|
+
renderEditButton?: (recordId: number | string) => React.ReactNode;
|
|
59
|
+
/** Custom render for detail/show button */
|
|
60
|
+
renderDetailButton?: (recordId: number | string) => React.ReactNode;
|
|
61
|
+
/** Custom render for clone button */
|
|
62
|
+
renderCloneButton?: (recordId: number | string) => React.ReactNode;
|
|
63
|
+
/** Custom render for delete button */
|
|
64
|
+
renderDeleteButton?: (recordId: number | string) => React.ReactNode;
|
|
65
|
+
/** Custom render for history/log button */
|
|
66
|
+
renderHistoryButton?: (recordId: number | string) => React.ReactNode;
|
|
67
|
+
/** Custom render for status action buttons */
|
|
68
|
+
renderStatusAction?: (
|
|
69
|
+
action: RowAction,
|
|
70
|
+
record: T,
|
|
71
|
+
onConfirm: () => void,
|
|
72
|
+
loading: boolean,
|
|
73
|
+
disabled: boolean
|
|
74
|
+
) => React.ReactNode;
|
|
75
|
+
/** Custom render for more dropdown trigger */
|
|
76
|
+
renderMoreTrigger?: () => React.ReactNode;
|
|
77
|
+
/** Extra dropdown items to add */
|
|
78
|
+
extraDropdownItems?: Array<{ key: string; label: React.ReactNode }>;
|
|
79
|
+
/** Extra primary actions (rendered before More dropdown) */
|
|
80
|
+
extraPrimaryActions?: React.ReactNode;
|
|
81
|
+
/** Log button component (optional, for backward compatibility) */
|
|
82
|
+
LogButton?: React.ComponentType<any>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Row actions component with edit, show, and more dropdown
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* // Basic usage
|
|
90
|
+
* <RowActions
|
|
91
|
+
* record={record}
|
|
92
|
+
* actions={tableConfig.rowActions.actions}
|
|
93
|
+
* t={t}
|
|
94
|
+
* resourceName="audit"
|
|
95
|
+
* />
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* // With custom render props
|
|
99
|
+
* <RowActions
|
|
100
|
+
* {...props}
|
|
101
|
+
* renderEditButton={(id) => <MyEditButton id={id} />}
|
|
102
|
+
* renderDeleteButton={(id) => <MyDeleteButton id={id} />}
|
|
103
|
+
* />
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* // Completely custom UI using children
|
|
107
|
+
* <RowActions record={record}>
|
|
108
|
+
* {({ record, recordId, onUpdate }) => (
|
|
109
|
+
* <MyCustomActionsUI
|
|
110
|
+
* record={record}
|
|
111
|
+
* onEdit={() => navigate(`/edit/${recordId}`)}
|
|
112
|
+
* onUpdate={onUpdate}
|
|
113
|
+
* />
|
|
114
|
+
* )}
|
|
115
|
+
* </RowActions>
|
|
116
|
+
*/
|
|
117
|
+
export function RowActions<T extends { id: number | string }>({
|
|
118
|
+
record,
|
|
119
|
+
idField = 'id' as keyof T,
|
|
120
|
+
actions = [],
|
|
121
|
+
onUpdate,
|
|
122
|
+
updateLoading = false,
|
|
123
|
+
t = (key, defaultValue) => defaultValue || key,
|
|
124
|
+
resourceName = '',
|
|
125
|
+
showEdit = true,
|
|
126
|
+
showDetail = true,
|
|
127
|
+
showClone = true,
|
|
128
|
+
showDelete = true,
|
|
129
|
+
showHistory = false,
|
|
130
|
+
children,
|
|
131
|
+
renderEditButton,
|
|
132
|
+
renderDetailButton,
|
|
133
|
+
renderCloneButton,
|
|
134
|
+
renderDeleteButton,
|
|
135
|
+
renderHistoryButton,
|
|
136
|
+
renderStatusAction,
|
|
137
|
+
renderMoreTrigger,
|
|
138
|
+
extraDropdownItems = [],
|
|
139
|
+
extraPrimaryActions,
|
|
140
|
+
LogButton,
|
|
141
|
+
}: RowActionsProps<T>) {
|
|
142
|
+
const recordId = record[idField] as number | string;
|
|
143
|
+
|
|
144
|
+
const context: RowActionsRenderContext<T> = {
|
|
145
|
+
record,
|
|
146
|
+
recordId,
|
|
147
|
+
t,
|
|
148
|
+
resourceName,
|
|
149
|
+
onUpdate: (values) => onUpdate?.(Number(recordId), values),
|
|
150
|
+
updateLoading,
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// If children is a function, call it with context
|
|
154
|
+
if (typeof children === 'function') {
|
|
155
|
+
return <>{children(context)}</>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// If children is provided as ReactNode, render it directly
|
|
159
|
+
if (children) {
|
|
160
|
+
return <>{children}</>;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Default rendering
|
|
164
|
+
const statusActions = actions.filter((action) => action.action === 'CHANGE_STATUS');
|
|
165
|
+
|
|
166
|
+
// Default button renderers
|
|
167
|
+
const defaultEditButton = (id: number | string) => (
|
|
168
|
+
<EditButton icon={false} type="text" size="small" recordItemId={id} />
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
const defaultDetailButton = (id: number | string) => (
|
|
172
|
+
<ShowButton icon={false} type="text" size="small" recordItemId={id}>
|
|
173
|
+
{t('table.detail', 'Detail')}
|
|
174
|
+
</ShowButton>
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
const defaultCloneButton = (id: number | string) => (
|
|
178
|
+
<CloneButton icon={false} type="text" size="small" recordItemId={id} />
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
const defaultDeleteButton = (id: number | string) => (
|
|
182
|
+
<DeleteButton icon={false} type="text" size="small" recordItemId={id} />
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
const defaultHistoryButton = (id: number | string) =>
|
|
186
|
+
LogButton ? (
|
|
187
|
+
<LogButton hideText={false} icon={false} type="text" size="small" recordItemId={id} />
|
|
188
|
+
) : null;
|
|
189
|
+
|
|
190
|
+
const defaultStatusAction = (
|
|
191
|
+
action: RowAction,
|
|
192
|
+
_record: T,
|
|
193
|
+
onConfirm: () => void,
|
|
194
|
+
loading: boolean,
|
|
195
|
+
disabled: boolean
|
|
196
|
+
) => (
|
|
197
|
+
<Popconfirm
|
|
198
|
+
placement="top"
|
|
199
|
+
title={t('buttons.confirm', 'Are you sure?')}
|
|
200
|
+
onConfirm={onConfirm}
|
|
201
|
+
okText={t('buttons.sure', 'Yes')}
|
|
202
|
+
cancelText={t('buttons.cancel', 'No')}
|
|
203
|
+
disabled={disabled}
|
|
204
|
+
>
|
|
205
|
+
<Button loading={loading} size="small" type="text" disabled={disabled}>
|
|
206
|
+
{t(`resources.${resourceName}.actions.${action.desc}`, action.desc)}
|
|
207
|
+
</Button>
|
|
208
|
+
</Popconfirm>
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
const defaultMoreTrigger = () => (
|
|
212
|
+
<Button type="text" size="small">
|
|
213
|
+
{t('table.more', 'More')}
|
|
214
|
+
<DownOutlined />
|
|
215
|
+
</Button>
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
// Build dropdown items
|
|
219
|
+
const dropdownItems = [
|
|
220
|
+
// Status change actions
|
|
221
|
+
...statusActions.map((action) => {
|
|
222
|
+
const disabled = !whenIsTrue(action.when, record);
|
|
223
|
+
const onConfirm = () => onUpdate?.(Number(recordId), action.values);
|
|
224
|
+
|
|
225
|
+
return {
|
|
226
|
+
key: action.desc,
|
|
227
|
+
label: renderStatusAction
|
|
228
|
+
? renderStatusAction(action, record, onConfirm, updateLoading, disabled)
|
|
229
|
+
: defaultStatusAction(action, record, onConfirm, updateLoading, disabled),
|
|
230
|
+
};
|
|
231
|
+
}),
|
|
232
|
+
// Clone button
|
|
233
|
+
...(showClone
|
|
234
|
+
? [
|
|
235
|
+
{
|
|
236
|
+
key: 'clone',
|
|
237
|
+
label: renderCloneButton
|
|
238
|
+
? renderCloneButton(recordId)
|
|
239
|
+
: defaultCloneButton(recordId),
|
|
240
|
+
},
|
|
241
|
+
]
|
|
242
|
+
: []),
|
|
243
|
+
// History/Log button
|
|
244
|
+
...((showHistory || LogButton)
|
|
245
|
+
? [
|
|
246
|
+
{
|
|
247
|
+
key: 'history',
|
|
248
|
+
label: renderHistoryButton
|
|
249
|
+
? renderHistoryButton(recordId)
|
|
250
|
+
: defaultHistoryButton(recordId),
|
|
251
|
+
},
|
|
252
|
+
]
|
|
253
|
+
: []),
|
|
254
|
+
// Delete button
|
|
255
|
+
...(showDelete
|
|
256
|
+
? [
|
|
257
|
+
{
|
|
258
|
+
key: 'delete',
|
|
259
|
+
label: renderDeleteButton
|
|
260
|
+
? renderDeleteButton(recordId)
|
|
261
|
+
: defaultDeleteButton(recordId),
|
|
262
|
+
},
|
|
263
|
+
]
|
|
264
|
+
: []),
|
|
265
|
+
// Extra items
|
|
266
|
+
...extraDropdownItems,
|
|
267
|
+
].filter((item) => item.label != null);
|
|
268
|
+
|
|
269
|
+
return (
|
|
270
|
+
<Space>
|
|
271
|
+
{/* Edit button */}
|
|
272
|
+
{showEdit &&
|
|
273
|
+
(renderEditButton ? renderEditButton(recordId) : defaultEditButton(recordId))}
|
|
274
|
+
|
|
275
|
+
{/* Show/Detail button */}
|
|
276
|
+
{showDetail &&
|
|
277
|
+
(renderDetailButton ? renderDetailButton(recordId) : defaultDetailButton(recordId))}
|
|
278
|
+
|
|
279
|
+
{/* Extra primary actions */}
|
|
280
|
+
{extraPrimaryActions}
|
|
281
|
+
|
|
282
|
+
{/* More dropdown */}
|
|
283
|
+
{dropdownItems.length > 0 && (
|
|
284
|
+
<Dropdown menu={{ items: dropdownItems as any }} trigger={['click']}>
|
|
285
|
+
{renderMoreTrigger ? renderMoreTrigger() : defaultMoreTrigger()}
|
|
286
|
+
</Dropdown>
|
|
287
|
+
)}
|
|
288
|
+
</Space>
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export default RowActions;
|