@gadmin2n/schematics 0.0.70 → 0.0.71
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/dist/lib/application/files/gadmin2-game-angle-demo/web/.npmrc +1 -0
- package/package.json +1 -1
- package/src/lib/application/application.schema.d.ts +59 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/.dockerignore +33 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/.gitignore +46 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/.husky/_/.gitignore +1 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/.husky/_/husky.sh +36 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/.husky/pre-commit +10 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/Dockerfile +63 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/Jenkinsfile +70 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/.types.d.ts +143 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/prisma/canvas.prisma +45 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/prisma/example.prisma +34 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/prisma/system.prisma +173 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/ui/Audit.ts +70 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/ui/Event.ts +70 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/ui/Game.ts +58 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/ui/ITActivityDay.ts +70 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/ui/Log.ts +56 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/ui/Page.ts +70 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/ui/PageResource.ts +70 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/ui/Resource.ts +70 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/ui/Role.ts +58 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/ui/RolePages.ts +70 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/ui/RoleResource.ts +70 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/ui/SavedQuery.ts +70 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/ui/User.ts +70 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/config/ui/_common.ts +16 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/readme.md +142 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/.env +31 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/.env.local +1 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/.eslintrc.js +28 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/.prettierignore +7 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/.prettierrc +4 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/README.md +55 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/config/ac.config.ts +24 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/config/index.ts +58 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/gadmin-cli.json +25 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/migrate-between-pg-schemas.js +1232 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/package.json +143 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/prisma/.generator.prisma +34 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/prisma.config.ts +16 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/scripts/lib/page-helpers.ts +157 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/scripts/page-manage.ts +290 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/scripts/permission-manage.ts +184 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/scripts/prismaModels.ts +143 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/scripts/sync-resources.ts +100 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/scripts/syncDataMngtPages.ts +119 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/seed/games.ts +1 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/seed/index.ts +21 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/seed/permissions.ts +244 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/seed/users.ts +7 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/alias.config.ts +7 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/app.controller.spec.ts +22 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/app.controller.ts +192 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/app.module.ts +91 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/app.service.ts +189 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/lib/auth.guard.ts +154 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/lib/http-cache.interceptor.ts +21 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/lib/logger.ts +19 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/lib/roles.guard.ts +47 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/lib/safe-log.util.ts +176 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/lib/taihu.ts +175 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/lib/tracing.ts +174 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/lib/trim.pipe.ts +51 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/lib/utils.ts +145 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/lib/woaAuth.ts +95 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/main.ts +132 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/audit/audit.controller.spec.ts +20 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/audit/audit.controller.ts +190 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/audit/audit.module.ts +10 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/audit/audit.service.spec.ts +338 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/audit/audit.service.ts +83 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/canvas/canvas.controller.spec.ts +20 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/canvas/canvas.controller.ts +81 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/canvas/canvas.dto.ts +49 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/canvas/canvas.module.ts +11 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/canvas/canvas.service.spec.ts +334 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/canvas/canvas.service.ts +249 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/game/game.controller.spec.ts +20 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/game/game.controller.ts +188 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/game/game.module.ts +10 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/game/game.service.spec.ts +18 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/game/game.service.ts +83 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/index.ts +4 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/page/page.controller.spec.ts +20 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/page/page.controller.ts +250 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/page/page.module.ts +10 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/page/page.service.spec.ts +18 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/page/page.service.ts +1051 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/pageResource/pageResource.controller.spec.ts +20 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/pageResource/pageResource.controller.ts +196 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/pageResource/pageResource.module.ts +13 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/pageResource/pageResource.service.spec.ts +18 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/pageResource/pageResource.service.ts +219 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/resource/resource.controller.spec.ts +20 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/resource/resource.controller.ts +196 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/resource/resource.module.ts +10 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/resource/resource.service.spec.ts +18 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/resource/resource.service.ts +199 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/role/role.controller.spec.ts +20 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/role/role.controller.ts +210 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/role/role.module.ts +12 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/role/role.service.spec.ts +18 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/role/role.service.ts +862 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/role/roles-refresher.service.ts +133 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/rolePages/rolePages.controller.spec.ts +20 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/rolePages/rolePages.controller.ts +196 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/rolePages/rolePages.module.ts +10 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/rolePages/rolePages.service.spec.ts +18 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/rolePages/rolePages.service.ts +201 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/roleResource/roleResource.controller.spec.ts +20 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/roleResource/roleResource.controller.ts +196 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/roleResource/roleResource.module.ts +10 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/roleResource/roleResource.service.spec.ts +18 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/roleResource/roleResource.service.ts +216 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/user/user.controller.spec.ts +20 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/user/user.controller.ts +198 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/user/user.module.ts +10 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/user/user.service.spec.ts +18 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/src/modules/user/user.service.ts +104 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/start-prod.sh +130 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/test/app.e2e-spec.ts +24 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/test/jest-e2e.json +9 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/tsconfig.build.json +4 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/tsconfig.json +36 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/server/yarn.lock +7737 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/.env +2 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/.eslintrc.json +38 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/.npmrc +1 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/.prettierignore +2 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/.prettierrc +4 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/README.MD +48 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/dev-shell-entry.html +49 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/index.html +19 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/package.json +92 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/postcss.config.cjs +6 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/public/favicon.ico +0 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/public/images/flags/en.svg +1 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/public/images/flags/zh_CN.svg +11 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/App.tsx +137 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/auditLogProvider.ts +89 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/authProvider.ts +144 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/BulkActions.tsx +287 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/ListPageHeader.tsx +56 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/RowActions.tsx +318 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/SearchBar.tsx +323 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/SqlModal.tsx +495 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/VanillaJSONEditor/index.css +10 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/VanillaJSONEditor/index.jsx +53 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/AgentContext.tsx +375 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/ElementInspector.tsx +1133 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/agentAttributes.ts +70 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/index.ts +8 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/inspectorActions.ts +1034 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/pagePathUtils.ts +66 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/promptGenerator.ts +135 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/propPatcher.ts +84 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/components/eventList/index.tsx +58 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/components/index.ts +4 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/components/logButton/index.tsx +96 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/components/logList/index.tsx +72 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/components/modalDiffViewer/index.tsx +104 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/index.tsx +2 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/BarChart/index.tsx +896 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/ChartSwitcher/index.tsx +219 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/ChartViewer/index.tsx +159 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/Filter/index.tsx +192 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/LineChart/index.tsx +1034 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/NumCard/NumCard.module.css +8 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/NumCard/index.tsx +509 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/NumLineCard/index.tsx +66 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/PieChart/index.tsx +552 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/RadarChart/index.tsx +263 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/Section/index.tsx +35 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/Table/index.tsx +207 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/TreemapChart/index.tsx +382 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/WorldMap/index.tsx +135 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/chart-constants.ts +53 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/icon/InfoIcon.tsx +8 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/icon/index.ts +1 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/map/config.ts +31 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/map/nameMap.json +9 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/map/world.geo.json +39349 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/canvas/metric-info-tooltip/index.tsx +19 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/contexts/business/index.tsx +65 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/contexts/color-mode/index.tsx +54 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/custom-avatar.tsx +42 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/index.ts +8 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/header.tsx +106 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/index.ts +4 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/layout.tsx +32 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/logo.tsx +19 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/sider.tsx +431 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/title.tsx +61 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/offLayoutArea/index.tsx +5 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/pagination-total.tsx +21 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/tags/index.ts +1 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/tags/role-tag.tsx +44 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/components/text.tsx +78 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/config/http.ts +49 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/config/routeRegistry.tsx +428 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/constants/layout.ts +16 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/dev-shell/AddDataModal.tsx +199 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/dev-shell/AddPageModal.tsx +335 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/dev-shell/DeleteDataConfirm.tsx +56 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/dev-shell/DevShell.tsx +401 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/dev-shell/EditDataModal.tsx +129 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/dev-shell/SkillMenu.tsx +202 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/dev-shell/UndoConfirm.tsx +36 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/dev-shell/index.tsx +8 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/dev-shell/style.css +835 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/enums/audit-log.enum.ts +13 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/enums/index.ts +1 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/form.tsx +471 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/get-name-initials.ts +8 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/get-random-color.ts +27 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/http.ts +84 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/index.tsx +8 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/list.tsx +491 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/login.ts +82 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/page-tree.ts +74 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/show.tsx +226 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/utils.tsx +9 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/index.ts +7 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/types.ts +138 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useBatchDelete.ts +191 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useBatchOperations.ts +153 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useBatchOperationsCore.ts +193 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useBatchUpdate.ts +182 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useDynamicResources.tsx +220 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useECharts.tsx +144 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useFetchData.ts +33 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useListPageState.ts +303 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useRoles.ts +34 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useRowSelection.ts +38 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useUserPageAccess.ts +353 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/i18n.ts +23 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/index.tsx +27 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/locales/en/common.json +321 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/locales/zh_CN/common.json +324 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/meta.json +4 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/plugins/devShellPlugin.ts +81 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/audit/components/action-cell.css +3 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/audit/components/action-cell.tsx +134 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/audit/create.tsx +105 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/audit/edit.tsx +121 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/audit/index.ts +8 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/audit/index.tsx +4 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/audit/list.tsx +220 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/audit/show.tsx +74 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/CanvasCell.tsx +87 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/CanvasEditPage.tsx +192 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/CanvasListPage.tsx +409 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/CanvasPage.tsx +1372 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/CanvasToolbar.tsx +384 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/CodeFloatWindow.tsx +476 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/ComponentThumbnail.tsx +137 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/IsolatedLivePreview.tsx +101 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/LivePreview.tsx +236 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/PublishModal.tsx +200 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/canvasApi.ts +92 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/canvasConfigRegistry.tsx +25 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/canvasContextMenuRegistry.tsx +875 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/canvasDefaults.ts +126 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/canvasI18n.ts +11 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/BarChartDataSourceModal.tsx +115 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/ChartViewerConfigModal.tsx +217 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/LineChartDataSourceModal.tsx +153 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/NumCardDataSourceModal.tsx +211 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/PromptModal.tsx +90 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/RadarChartDataSourceModal.tsx +87 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/TableDataSourceModal.tsx +204 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/demos.ts +1153 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/index.tsx +2 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/sectionCompactor.ts +45 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/types.ts +45 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas-page/index.tsx +108 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/game/create.tsx +105 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/game/edit.tsx +121 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/game/index.tsx +4 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/game/list.tsx +237 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/game/show.tsx +74 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/Components/AssignRolesModal.tsx +177 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/Components/CreatePageModal.tsx +42 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/Components/EditPageModal.tsx +46 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/Components/PageDetailDrawer.tsx +136 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/Components/PageFormModal.tsx +815 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/hooks/usePageManagement.ts +40 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/index.ts +1 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/list.tsx +1370 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/queries.ts +17 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/types.ts +45 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/permissionReadme/index.tsx +1090 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/resource/Components/CreateModal.tsx +25 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/resource/Components/EditModal.tsx +28 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/resource/Components/ResourceDetailDrawer.tsx +177 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/resource/Components/modal.tsx +230 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/resource/index.ts +2 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/resource/list.tsx +250 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/resource/queries.ts +10 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/resource/types.ts +9 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/role/Components/CreateModal.tsx +30 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/role/Components/EditModal.tsx +47 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/role/Components/RoleDetailDrawer.tsx +66 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/role/Components/modal.tsx +300 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/role/hooks/useRolePage.ts +35 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/role/index.ts +1 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/role/list.tsx +405 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/role/queries.ts +8 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/role/types.ts +8 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/user/components/create-modal.tsx +17 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/user/components/edit-modal.tsx +19 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/user/components/form-modal.tsx +194 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/user/components/index.ts +5 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/user/components/role-tag.tsx +48 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/user/components/show-drawer.tsx +145 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/user/index.ts +1 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/user/list.tsx +377 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/routes/user/queries.ts +14 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/setupTests.ts +5 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/styles/antd.css +132 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/styles/fc.css +58 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/styles/index.css +128 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/styles/show-drawer.module.css +18 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/styles/show-page.module.css +21 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/types/audit-log.ts +1 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/types/index.ts +3 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/types/role.ts +7 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/types/user.ts +1 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/src/vite-env.d.ts +13 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/tsconfig.json +28 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/vite.config.ts +48 -0
- package/src/lib/application/files/gadmin2-game-angle-demo/web/yarn.lock +9482 -0
- package/src/lib/class/class.schema.d.ts +32 -0
- package/src/lib/class/files/js/__name__.js +1 -0
- package/src/lib/class/files/js/__name__.spec.js +7 -0
- package/src/lib/class/files/ts/__name__.spec.ts +7 -0
- package/src/lib/class/files/ts/__name__.ts +1 -0
- package/src/lib/client-app/angular/angular.schema.d.ts +32 -0
- package/src/lib/client-app/angular/files/angular.constants.ts +4 -0
- package/src/lib/client-app/angular/files/angular.module.ts +41 -0
- package/src/lib/client-app/angular/files/angular.providers.ts +27 -0
- package/src/lib/client-app/angular/files/angular.utils.ts +19 -0
- package/src/lib/client-app/angular/files/interfaces/angular-options.interface.ts +87 -0
- package/src/lib/client-app/angular/files/loaders/abstract.loader.ts +16 -0
- package/src/lib/client-app/angular/files/loaders/express.loader.ts +25 -0
- package/src/lib/client-app/angular/files/loaders/fastify.loader.ts +34 -0
- package/src/lib/client-app/angular/files/loaders/noop.loader.ts +12 -0
- package/src/lib/configuration/configuration.schema.d.ts +18 -0
- package/src/lib/configuration/files/js/nest-cli.json +6 -0
- package/src/lib/configuration/files/ts/nest-cli.json +5 -0
- package/src/lib/controller/controller.schema.d.ts +45 -0
- package/src/lib/controller/files/js/__name__.controller.js +4 -0
- package/src/lib/controller/files/js/__name__.controller.spec.js +18 -0
- package/src/lib/controller/files/ts/__name__.controller.spec.ts +18 -0
- package/src/lib/controller/files/ts/__name__.controller.ts +137 -0
- package/src/lib/decorator/decorator.schema.d.ts +24 -0
- package/src/lib/decorator/files/js/__name__.decorator.js +3 -0
- package/src/lib/decorator/files/ts/__name__.decorator.ts +3 -0
- package/src/lib/filter/files/js/__name__.filter.js +6 -0
- package/src/lib/filter/files/js/__name__.filter.spec.js +7 -0
- package/src/lib/filter/files/ts/__name__.filter.spec.ts +7 -0
- package/src/lib/filter/files/ts/__name__.filter.ts +6 -0
- package/src/lib/filter/filter.schema.d.ts +28 -0
- package/src/lib/gateway/files/js/__name__.gateway.js +9 -0
- package/src/lib/gateway/files/js/__name__.gateway.spec.js +18 -0
- package/src/lib/gateway/files/ts/__name__.gateway.spec.ts +18 -0
- package/src/lib/gateway/files/ts/__name__.gateway.ts +9 -0
- package/src/lib/gateway/gateway.schema.d.ts +36 -0
- package/src/lib/guard/files/js/__name__.guard.js +8 -0
- package/src/lib/guard/files/js/__name__.guard.spec.js +7 -0
- package/src/lib/guard/files/ts/__name__.guard.spec.ts +7 -0
- package/src/lib/guard/files/ts/__name__.guard.ts +11 -0
- package/src/lib/guard/guard.schema.d.ts +28 -0
- package/src/lib/interceptor/files/js/__name__.interceptor.js +8 -0
- package/src/lib/interceptor/files/js/__name__.interceptor.spec.js +7 -0
- package/src/lib/interceptor/files/ts/default/__name__.interceptor.spec.ts +7 -0
- package/src/lib/interceptor/files/ts/default/__name__.interceptor.ts +9 -0
- package/src/lib/interceptor/files/ts/generated/__name__.interceptor.spec.ts +7 -0
- package/src/lib/interceptor/files/ts/generated/__name__.interceptor.ts +13 -0
- package/src/lib/interceptor/interceptor.schema.d.ts +35 -0
- package/src/lib/interface/files/__name__.interface.ts +1 -0
- package/src/lib/interface/interface.schema.d.ts +20 -0
- package/src/lib/library/files/js/.babelrc +4 -0
- package/src/lib/library/files/js/jsconfig.json +9 -0
- package/src/lib/library/files/js/src/__name__.module.js +8 -0
- package/src/lib/library/files/js/src/__name__.service.js +4 -0
- package/src/lib/library/files/js/src/__name__.service.spec.js +18 -0
- package/src/lib/library/files/js/src/index.js +2 -0
- package/src/lib/library/files/ts/src/__name__.module.ts +8 -0
- package/src/lib/library/files/ts/src/__name__.service.spec.ts +18 -0
- package/src/lib/library/files/ts/src/__name__.service.ts +4 -0
- package/src/lib/library/files/ts/src/index.ts +2 -0
- package/src/lib/library/files/ts/tsconfig.lib.json +9 -0
- package/src/lib/library/library.schema.d.ts +24 -0
- package/src/lib/middleware/files/js/__name__.middleware.js +8 -0
- package/src/lib/middleware/files/js/__name__.middleware.spec.js +7 -0
- package/src/lib/middleware/files/ts/__name__.middleware.spec.ts +7 -0
- package/src/lib/middleware/files/ts/__name__.middleware.ts +8 -0
- package/src/lib/middleware/middleware.schema.d.ts +28 -0
- package/src/lib/module/files/js/__name__.module.js +4 -0
- package/src/lib/module/files/ts/__name__.module.ts +4 -0
- package/src/lib/module/module.schema.d.ts +40 -0
- package/src/lib/pipe/files/js/__name__.pipe.js +8 -0
- package/src/lib/pipe/files/js/__name__.pipe.spec.js +7 -0
- package/src/lib/pipe/files/ts/__name__.pipe.spec.ts +7 -0
- package/src/lib/pipe/files/ts/__name__.pipe.ts +8 -0
- package/src/lib/pipe/pipe.schema.d.ts +28 -0
- package/src/lib/prisma-resource/files/ts/__name__.controller.spec.ts +20 -0
- package/src/lib/prisma-resource/files/ts/__name__.controller.ts +63 -0
- package/src/lib/prisma-resource/files/ts/__name__.module.ts +9 -0
- package/src/lib/prisma-resource/files/ts/__name__.service.spec.ts +18 -0
- package/src/lib/prisma-resource/files/ts/__name__.service.ts +28 -0
- package/src/lib/prisma-resource/files/ts/dto/create-__name@singular__.dto.ts +1 -0
- package/src/lib/prisma-resource/files/ts/dto/create-__name@singular__.input.ts +7 -0
- package/src/lib/prisma-resource/files/ts/dto/update-__name@singular__.dto.ts +6 -0
- package/src/lib/prisma-resource/files/ts/dto/update-__name@singular__.input.ts +13 -0
- package/src/lib/prisma-resource/files/ts/entities/__name@singular@ent__.ts +7 -0
- package/src/lib/prisma-resource/prisma-resource.schema.d.ts +57 -0
- package/src/lib/provider/files/js/__name__.js +4 -0
- package/src/lib/provider/files/js/__name__.spec.js +18 -0
- package/src/lib/provider/files/ts/__name__.spec.ts +18 -0
- package/src/lib/provider/files/ts/__name__.ts +4 -0
- package/src/lib/provider/provider.schema.d.ts +48 -0
- package/src/lib/resolver/files/js/__name__.resolver.js +4 -0
- package/src/lib/resolver/files/js/__name__.resolver.spec.js +18 -0
- package/src/lib/resolver/files/ts/__name__.resolver.spec.ts +18 -0
- package/src/lib/resolver/files/ts/__name__.resolver.ts +4 -0
- package/src/lib/resolver/resolver.schema.d.ts +36 -0
- package/src/lib/resource/files/ts/__name__.controller.spec.ts +20 -0
- package/src/lib/resource/files/ts/__name__.controller.ts +63 -0
- package/src/lib/resource/files/ts/__name__.gateway.spec.ts +19 -0
- package/src/lib/resource/files/ts/__name__.gateway.ts +34 -0
- package/src/lib/resource/files/ts/__name__.graphql +24 -0
- package/src/lib/resource/files/ts/__name__.module.ts +9 -0
- package/src/lib/resource/files/ts/__name__.resolver.spec.ts +19 -0
- package/src/lib/resource/files/ts/__name__.resolver.ts +60 -0
- package/src/lib/resource/files/ts/__name__.service.spec.ts +18 -0
- package/src/lib/resource/files/ts/__name__.service.ts +28 -0
- package/src/lib/resource/files/ts/dto/create-__name@singular__.dto.ts +1 -0
- package/src/lib/resource/files/ts/dto/create-__name@singular__.input.ts +7 -0
- package/src/lib/resource/files/ts/dto/update-__name@singular__.dto.ts +6 -0
- package/src/lib/resource/files/ts/dto/update-__name@singular__.input.ts +13 -0
- package/src/lib/resource/files/ts/entities/__name@singular@ent__.ts +7 -0
- package/src/lib/resource/resource.schema.d.ts +57 -0
- package/src/lib/service/files/js/__name__.service.js +4 -0
- package/src/lib/service/files/js/__name__.service.spec.js +18 -0
- package/src/lib/service/files/ts/__name__.service.spec.ts +18 -0
- package/src/lib/service/files/ts/__name__.service.ts +4 -0
- package/src/lib/service/service.schema.d.ts +44 -0
- package/src/lib/sub-app/files/js/.babelrc +4 -0
- package/src/lib/sub-app/files/js/index.js +2 -0
- package/src/lib/sub-app/files/js/jsconfig.json +10 -0
- package/src/lib/sub-app/files/js/src/app.controller.js +15 -0
- package/src/lib/sub-app/files/js/src/app.controller.spec.js +22 -0
- package/src/lib/sub-app/files/js/src/app.module.js +10 -0
- package/src/lib/sub-app/files/js/src/app.service.js +8 -0
- package/src/lib/sub-app/files/js/src/main.js +8 -0
- package/src/lib/sub-app/files/js/test/app.e2e-spec.js +23 -0
- package/src/lib/sub-app/files/js/test/jest-e2e.json +5 -0
- package/src/lib/sub-app/files/ts/src/__name__.controller.spec.ts +22 -0
- package/src/lib/sub-app/files/ts/src/__name__.controller.ts +12 -0
- package/src/lib/sub-app/files/ts/src/__name__.module.ts +10 -0
- package/src/lib/sub-app/files/ts/src/__name__.service.ts +8 -0
- package/src/lib/sub-app/files/ts/src/main.ts +8 -0
- package/src/lib/sub-app/files/ts/test/app.e2e-spec.ts +24 -0
- package/src/lib/sub-app/files/ts/test/jest-e2e.json +9 -0
- package/src/lib/sub-app/files/ts/tsconfig.app.json +9 -0
- package/src/lib/sub-app/sub-app.schema.d.ts +21 -0
- package/src/lib/sub-app/workspace/js/.babelrc +4 -0
- package/src/lib/sub-app/workspace/js/index.js +2 -0
- package/src/lib/sub-app/workspace/js/jsconfig.json +10 -0
- package/src/lib/sub-app/workspace/ts/tsconfig.app.json +9 -0
|
@@ -0,0 +1,896 @@
|
|
|
1
|
+
import React, { useMemo, useEffect } from 'react';
|
|
2
|
+
import { Spin, Empty } from 'antd';
|
|
3
|
+
import type * as echarts from 'echarts';
|
|
4
|
+
import { useECharts } from '@/hooks/useECharts';
|
|
5
|
+
import {
|
|
6
|
+
LEGEND_BASE,
|
|
7
|
+
GRID_VERTICAL,
|
|
8
|
+
GRID_HORIZONTAL,
|
|
9
|
+
} from '../chart-constants';
|
|
10
|
+
|
|
11
|
+
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* bar 单系列数据(direction=vertical 时 name=X轴标签,direction=horizontal 时 name=Y轴标签)
|
|
15
|
+
* value = 数值
|
|
16
|
+
*/
|
|
17
|
+
export type BarDataSingle = {
|
|
18
|
+
name: string;
|
|
19
|
+
value: number | null;
|
|
20
|
+
/** 额外描述,显示在 tooltip 或 label 括号内 */
|
|
21
|
+
extraTxt?: string;
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}[];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* stackBar 多系列数据
|
|
27
|
+
* xData = 分类轴标签数组(纵向时为X轴,横向时为Y轴)
|
|
28
|
+
* series[].data 与 xData 等长
|
|
29
|
+
*/
|
|
30
|
+
export interface BarDataMulti {
|
|
31
|
+
xData: string[];
|
|
32
|
+
series: {
|
|
33
|
+
name: string;
|
|
34
|
+
data: (number | null)[];
|
|
35
|
+
/** 可附加 stack、color、itemStyle 等原生 ECharts 字段 */
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* stackBarPercent 百分比堆叠柱状图数据
|
|
42
|
+
* series[].data 为百分比值(0–100);originalData 存原始计数,用于 tooltip/label 展示
|
|
43
|
+
* xData 格式为 "YYYYMMDD",展示时自动转 "MM/DD"
|
|
44
|
+
*/
|
|
45
|
+
export interface BarDataPercent {
|
|
46
|
+
xData: string[];
|
|
47
|
+
series: { name: string; data: number[] }[];
|
|
48
|
+
allTypes: string[];
|
|
49
|
+
originalData: Record<
|
|
50
|
+
string,
|
|
51
|
+
Array<{ key: string; active_device_cnt: number; [key: string]: any }>
|
|
52
|
+
>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type BarChartVariant =
|
|
56
|
+
| 'bar' // 单系列柱状图
|
|
57
|
+
| 'stackBar' // 多系列堆叠柱状图
|
|
58
|
+
| 'stackBarPercent'; // 百分比堆叠柱状图(Y 轴 0–100%,label 在 bar 内显示原始计数)
|
|
59
|
+
|
|
60
|
+
export type BarChartDirection = 'vertical' | 'horizontal';
|
|
61
|
+
|
|
62
|
+
export type BarChartData = BarDataSingle | BarDataMulti | BarDataPercent;
|
|
63
|
+
|
|
64
|
+
export interface BarChartProps {
|
|
65
|
+
// ── 核心 ──────────────────────────────────────────────────────────────────
|
|
66
|
+
/** 图表数据。bar 用 BarDataSingle;stackBar 用 BarDataMulti;stackBarPercent 用 BarDataPercent */
|
|
67
|
+
data: BarChartData;
|
|
68
|
+
/** 视觉变体 */
|
|
69
|
+
variant?: BarChartVariant;
|
|
70
|
+
/** 方向:纵向(默认)或横向 */
|
|
71
|
+
direction?: BarChartDirection;
|
|
72
|
+
/** Y 轴(纵向)或 X 轴(横向)单位,显示在 tooltip 和 label */
|
|
73
|
+
unit?: string;
|
|
74
|
+
|
|
75
|
+
// ── 布局 ──────────────────────────────────────────────────────────────────
|
|
76
|
+
/**
|
|
77
|
+
* 图表标题,渲染在图表上方。
|
|
78
|
+
* - 字符串:套默认样式(居中、12px、bold、#515151)
|
|
79
|
+
* - ReactNode:直接渲染,样式由调用方控制
|
|
80
|
+
* height 只指图表区域高度,标题额外占空间。
|
|
81
|
+
*/
|
|
82
|
+
title?: React.ReactNode;
|
|
83
|
+
/** 图表容器高度,默认 300 */
|
|
84
|
+
height?: number | string;
|
|
85
|
+
|
|
86
|
+
// ── 显示控制 ──────────────────────────────────────────────────────────────
|
|
87
|
+
/**
|
|
88
|
+
* 是否在 bar 顶部(或横向时右侧)显示 label。
|
|
89
|
+
* - bar:默认 true(显示数值 + unit)
|
|
90
|
+
* - stackBar:默认 true(仅最后一段显示总量)
|
|
91
|
+
*/
|
|
92
|
+
showLabel?: boolean;
|
|
93
|
+
/** 是否显示网格线,默认 true */
|
|
94
|
+
showGrid?: boolean;
|
|
95
|
+
/** 是否显示图例(多系列默认 true,单系列默认 false) */
|
|
96
|
+
legendShow?: boolean;
|
|
97
|
+
|
|
98
|
+
// ── 配置覆盖 ──────────────────────────────────────────────────────────────
|
|
99
|
+
/**
|
|
100
|
+
* 透传至 ECharts option 的配置(yAxis、xAxis、grid 等),与基准配置浅合并。
|
|
101
|
+
* 支持:yAxis、xAxis、grid、seriesProps(透传到每条 series)、reverseTooltip(tooltip 反向排序)
|
|
102
|
+
*/
|
|
103
|
+
chartProps?: Record<string, any>;
|
|
104
|
+
/** 完全自定义 option,与组件生成的 option 浅合并(优先级最高) */
|
|
105
|
+
option?: echarts.EChartsCoreOption;
|
|
106
|
+
|
|
107
|
+
// ── 交互 ──────────────────────────────────────────────────────────────────
|
|
108
|
+
/**
|
|
109
|
+
* 图表实例就绪回调,回传 ECharts 实例(销毁时传 null)。
|
|
110
|
+
* 用于 chart linking(如 BarChart ↔ PieChart 联动)。
|
|
111
|
+
*/
|
|
112
|
+
onChartReady?: (instance: echarts.ECharts | null) => void;
|
|
113
|
+
|
|
114
|
+
// ── 状态 ──────────────────────────────────────────────────────────────────
|
|
115
|
+
/** 显示 Spin 加载态 */
|
|
116
|
+
loading?: boolean;
|
|
117
|
+
/** 强制显示空态。未传时根据数据是否为空自动判断 */
|
|
118
|
+
empty?: boolean;
|
|
119
|
+
|
|
120
|
+
// ── 样式 / 测试 ──────────────────────────────────────────────────────────
|
|
121
|
+
style?: React.CSSProperties;
|
|
122
|
+
className?: string;
|
|
123
|
+
/** data-testid,必须填写 */
|
|
124
|
+
testId: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// ─── 共享常量 ─────────────────────────────────────────────────────────────────
|
|
128
|
+
|
|
129
|
+
// LEGEND_BASE, GRID_VERTICAL, GRID_HORIZONTAL 来自 ../chart-constants
|
|
130
|
+
|
|
131
|
+
// ─── 工具函数 ─────────────────────────────────────────────────────────────────
|
|
132
|
+
|
|
133
|
+
function isMulti(data: BarChartData): data is BarDataMulti {
|
|
134
|
+
return !Array.isArray(data) && 'xData' in data && !('allTypes' in data);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function isPercent(data: BarChartData): data is BarDataPercent {
|
|
138
|
+
return !Array.isArray(data) && 'allTypes' in data;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function isEmpty(data: BarChartData): boolean {
|
|
142
|
+
if (Array.isArray(data)) return data.length === 0;
|
|
143
|
+
return (data as BarDataMulti).xData?.length === 0;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// 构建 dateMap:每个 x 轴点上各系列值(用于计算堆叠总量)
|
|
147
|
+
function buildDateMap(data: BarDataMulti): Record<string, (number | null)[]> {
|
|
148
|
+
const { xData, series } = data;
|
|
149
|
+
const map: Record<string, (number | null)[]> = {};
|
|
150
|
+
for (let xIdx = 0; xIdx < xData.length; xIdx++) {
|
|
151
|
+
const key = xData[xIdx];
|
|
152
|
+
for (let sIdx = 0; sIdx < series.length; sIdx++) {
|
|
153
|
+
const val = series[sIdx].data[xIdx];
|
|
154
|
+
map[key] ? map[key].push(val) : (map[key] = [val]);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return map;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// ─── Variant 配置构建 ─────────────────────────────────────────────────────────
|
|
161
|
+
|
|
162
|
+
function buildBarOption(
|
|
163
|
+
data: BarDataSingle,
|
|
164
|
+
unit: string,
|
|
165
|
+
showLabel: boolean,
|
|
166
|
+
chartProps: Record<string, any>,
|
|
167
|
+
): echarts.EChartsCoreOption {
|
|
168
|
+
const {
|
|
169
|
+
yAxis = {},
|
|
170
|
+
xAxis = {},
|
|
171
|
+
grid = {},
|
|
172
|
+
seriesName = '',
|
|
173
|
+
seriesProps = {},
|
|
174
|
+
} = chartProps;
|
|
175
|
+
return {
|
|
176
|
+
legend: { ...LEGEND_BASE, data: [seriesName], show: false },
|
|
177
|
+
tooltip: {
|
|
178
|
+
trigger: 'item' as const,
|
|
179
|
+
formatter: (ctx: any) => {
|
|
180
|
+
const { marker, value, name } = ctx || {};
|
|
181
|
+
const extraTxt =
|
|
182
|
+
data.find((item) => item?.name === name)?.extraTxt || '';
|
|
183
|
+
return `${marker}${name}: ${value ?? 0} ${unit}${extraTxt ? `\n(${extraTxt})` : ''}`;
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
xAxis: {
|
|
187
|
+
type: 'category' as const,
|
|
188
|
+
axisTick: { show: false },
|
|
189
|
+
data: data.map((item) => item?.name),
|
|
190
|
+
axisLabel: {
|
|
191
|
+
fontSize: 10,
|
|
192
|
+
interval: 0,
|
|
193
|
+
hideOverlap: true,
|
|
194
|
+
margin: 15,
|
|
195
|
+
...xAxis?.axisLabel,
|
|
196
|
+
},
|
|
197
|
+
...xAxis,
|
|
198
|
+
},
|
|
199
|
+
yAxis: {
|
|
200
|
+
type: 'value' as const,
|
|
201
|
+
axisLabel: {
|
|
202
|
+
fontSize: 10,
|
|
203
|
+
formatter: (v: number) => `${v}${unit}`,
|
|
204
|
+
...yAxis?.axisLabel,
|
|
205
|
+
},
|
|
206
|
+
...yAxis,
|
|
207
|
+
},
|
|
208
|
+
grid: { ...GRID_VERTICAL, ...grid },
|
|
209
|
+
series: [
|
|
210
|
+
{
|
|
211
|
+
name: seriesName,
|
|
212
|
+
type: 'bar' as const,
|
|
213
|
+
barMaxWidth: 50,
|
|
214
|
+
data: data.map((item) => item?.value),
|
|
215
|
+
label: showLabel
|
|
216
|
+
? {
|
|
217
|
+
show: true,
|
|
218
|
+
position: 'top' as const,
|
|
219
|
+
fontSize: 10,
|
|
220
|
+
formatter: (ctx: any) => {
|
|
221
|
+
const { dataIndex, value, name } = ctx;
|
|
222
|
+
const extraTxt =
|
|
223
|
+
data.find((item) => item?.name === name)?.extraTxt || '';
|
|
224
|
+
if (
|
|
225
|
+
(data.length > 8 && dataIndex % 3 !== 0) ||
|
|
226
|
+
(data.length > 6 && data.length < 8 && dataIndex % 2 !== 0)
|
|
227
|
+
) {
|
|
228
|
+
return '';
|
|
229
|
+
}
|
|
230
|
+
return `${value ?? ''}${value !== null ? unit : ''}${extraTxt ? `\n(${extraTxt})` : ''}`;
|
|
231
|
+
},
|
|
232
|
+
}
|
|
233
|
+
: { show: false },
|
|
234
|
+
...seriesProps,
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function buildHorizontalBarOption(
|
|
241
|
+
data: BarDataSingle,
|
|
242
|
+
unit: string,
|
|
243
|
+
showLabel: boolean,
|
|
244
|
+
chartProps: Record<string, any>,
|
|
245
|
+
): echarts.EChartsCoreOption {
|
|
246
|
+
const {
|
|
247
|
+
yAxis = {},
|
|
248
|
+
xAxis = {},
|
|
249
|
+
grid = {},
|
|
250
|
+
seriesName = '',
|
|
251
|
+
seriesProps = {},
|
|
252
|
+
} = chartProps;
|
|
253
|
+
return {
|
|
254
|
+
legend: { ...LEGEND_BASE, data: [seriesName], show: false },
|
|
255
|
+
tooltip: {
|
|
256
|
+
trigger: 'item' as const,
|
|
257
|
+
formatter: (ctx: any) => {
|
|
258
|
+
const { marker, value, name } = ctx || {};
|
|
259
|
+
const extraTxt =
|
|
260
|
+
data.find((item) => item?.name === name)?.extraTxt || '';
|
|
261
|
+
return `${marker}${name}: ${(value ?? 0)?.toLocaleString()} ${unit}${extraTxt ? `\n(${extraTxt})` : ''}`;
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
yAxis: {
|
|
265
|
+
type: 'category' as const,
|
|
266
|
+
axisTick: { show: false },
|
|
267
|
+
axisLabel: {
|
|
268
|
+
fontSize: 10,
|
|
269
|
+
width: 120,
|
|
270
|
+
overflow: 'truncate' as const,
|
|
271
|
+
ellipsis: '...',
|
|
272
|
+
...yAxis?.axisLabel,
|
|
273
|
+
},
|
|
274
|
+
data: data.map((item) => item?.name),
|
|
275
|
+
...yAxis,
|
|
276
|
+
},
|
|
277
|
+
xAxis: {
|
|
278
|
+
type: 'value' as const,
|
|
279
|
+
axisTick: { show: false },
|
|
280
|
+
axisLabel: {
|
|
281
|
+
fontSize: 10,
|
|
282
|
+
formatter: (v: number) => `${v?.toLocaleString()}${unit}`,
|
|
283
|
+
...xAxis?.axisLabel,
|
|
284
|
+
},
|
|
285
|
+
...xAxis,
|
|
286
|
+
},
|
|
287
|
+
grid: { ...GRID_HORIZONTAL, ...grid },
|
|
288
|
+
series: [
|
|
289
|
+
{
|
|
290
|
+
name: seriesName,
|
|
291
|
+
type: 'bar' as const,
|
|
292
|
+
barMaxWidth: 30,
|
|
293
|
+
data: data.map((item) => ({ ...item })),
|
|
294
|
+
label: showLabel
|
|
295
|
+
? {
|
|
296
|
+
show: true,
|
|
297
|
+
position: 'right' as const,
|
|
298
|
+
fontSize: 10,
|
|
299
|
+
color: '#666',
|
|
300
|
+
formatter: (ctx: any) => {
|
|
301
|
+
const { value, name } = ctx;
|
|
302
|
+
const extraTxt =
|
|
303
|
+
data.find((item) => item?.name === name)?.extraTxt || '';
|
|
304
|
+
return `${(value ?? 0)?.toLocaleString()}${value !== null ? ` ${unit}` : ''}${extraTxt ? `\n(${extraTxt})` : ''}`;
|
|
305
|
+
},
|
|
306
|
+
}
|
|
307
|
+
: { show: false },
|
|
308
|
+
...seriesProps,
|
|
309
|
+
},
|
|
310
|
+
],
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function buildStackBarOption(
|
|
315
|
+
data: BarDataMulti,
|
|
316
|
+
unit: string,
|
|
317
|
+
showLabel: boolean,
|
|
318
|
+
chartProps: Record<string, any>,
|
|
319
|
+
): echarts.EChartsCoreOption {
|
|
320
|
+
const {
|
|
321
|
+
yAxis = {},
|
|
322
|
+
xAxis = {},
|
|
323
|
+
grid = {},
|
|
324
|
+
reverseTooltip = false,
|
|
325
|
+
seriesProps = {},
|
|
326
|
+
} = chartProps;
|
|
327
|
+
const { series = [], xData = [] } = data;
|
|
328
|
+
const dateMap = buildDateMap(data);
|
|
329
|
+
|
|
330
|
+
return {
|
|
331
|
+
tooltip: {
|
|
332
|
+
trigger: 'axis' as const,
|
|
333
|
+
formatter: (arr: any) => {
|
|
334
|
+
const xName = arr[0]?.name;
|
|
335
|
+
const sortArr = reverseTooltip ? [...arr].reverse() : arr;
|
|
336
|
+
const str = sortArr
|
|
337
|
+
.map((item: any) => {
|
|
338
|
+
const fData = item?.data ?? item?.value;
|
|
339
|
+
return fData !== null && fData !== undefined && fData !== 0
|
|
340
|
+
? `<div>${item?.marker} ${item?.seriesName}: ${fData?.toLocaleString()}${unit}</div>`
|
|
341
|
+
: '';
|
|
342
|
+
})
|
|
343
|
+
.join('');
|
|
344
|
+
return `<div>${xName}</div>${str}`;
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
legend: {
|
|
348
|
+
...LEGEND_BASE,
|
|
349
|
+
data: series.map((item: any) => item?.name),
|
|
350
|
+
},
|
|
351
|
+
grid: { ...GRID_VERTICAL, ...grid },
|
|
352
|
+
xAxis: {
|
|
353
|
+
type: 'category' as const,
|
|
354
|
+
boundaryGap: true,
|
|
355
|
+
data: xData,
|
|
356
|
+
axisTick: { show: false },
|
|
357
|
+
axisLine: { show: false },
|
|
358
|
+
axisLabel: {
|
|
359
|
+
fontSize: 10,
|
|
360
|
+
interval: 0,
|
|
361
|
+
hideOverlap: true,
|
|
362
|
+
margin: 15,
|
|
363
|
+
...xAxis?.axisLabel,
|
|
364
|
+
},
|
|
365
|
+
...xAxis,
|
|
366
|
+
},
|
|
367
|
+
yAxis: {
|
|
368
|
+
type: 'value' as const,
|
|
369
|
+
axisLabel: {
|
|
370
|
+
fontSize: 10,
|
|
371
|
+
formatter: (v: number) => `${v?.toLocaleString()}${unit}`,
|
|
372
|
+
...yAxis?.axisLabel,
|
|
373
|
+
},
|
|
374
|
+
axisTick: { show: false },
|
|
375
|
+
axisLine: { show: false },
|
|
376
|
+
splitNumber: 3,
|
|
377
|
+
...yAxis,
|
|
378
|
+
},
|
|
379
|
+
series: series.map((item: any, sIdx: number) => {
|
|
380
|
+
return {
|
|
381
|
+
name: item?.name,
|
|
382
|
+
type: 'bar' as const,
|
|
383
|
+
barMaxWidth: 50,
|
|
384
|
+
stack: item?.stack || 'stackKey',
|
|
385
|
+
data: item?.data,
|
|
386
|
+
label: showLabel
|
|
387
|
+
? {
|
|
388
|
+
show: true,
|
|
389
|
+
position: 'top' as const,
|
|
390
|
+
fontSize: 10,
|
|
391
|
+
formatter: (params: any) => {
|
|
392
|
+
const { dataIndex, name } = params;
|
|
393
|
+
const validLen =
|
|
394
|
+
dateMap[name]?.filter((v: any) => v !== null)?.length ?? 0;
|
|
395
|
+
// 只在最后一段显示总量
|
|
396
|
+
if (sIdx !== validLen - 1) return '';
|
|
397
|
+
const total = series.reduce(
|
|
398
|
+
(sum: number, s: any) =>
|
|
399
|
+
sum + (Number(s.data[dataIndex]) || 0),
|
|
400
|
+
0,
|
|
401
|
+
);
|
|
402
|
+
return total ? `${total?.toLocaleString()}${unit}` : '';
|
|
403
|
+
},
|
|
404
|
+
}
|
|
405
|
+
: { show: false },
|
|
406
|
+
...seriesProps,
|
|
407
|
+
...item,
|
|
408
|
+
// item 字段不覆盖 label(让我们的 label 生效,除非 item 明确传了 label)
|
|
409
|
+
...(item?.label ? { label: item.label } : showLabel ? {} : {}),
|
|
410
|
+
};
|
|
411
|
+
}),
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function buildInversionStackBarOption(
|
|
416
|
+
data: BarDataMulti,
|
|
417
|
+
unit: string,
|
|
418
|
+
showLabel: boolean,
|
|
419
|
+
chartProps: Record<string, any>,
|
|
420
|
+
): echarts.EChartsCoreOption {
|
|
421
|
+
const {
|
|
422
|
+
yAxis = {},
|
|
423
|
+
xAxis = {},
|
|
424
|
+
grid = {},
|
|
425
|
+
seriesProps = {},
|
|
426
|
+
reverseTooltip = false,
|
|
427
|
+
} = chartProps;
|
|
428
|
+
const { series = [], xData = [] } = data;
|
|
429
|
+
const dateMap = buildDateMap(data);
|
|
430
|
+
|
|
431
|
+
return {
|
|
432
|
+
tooltip: {
|
|
433
|
+
trigger: 'axis' as const,
|
|
434
|
+
formatter: (arr: any) => {
|
|
435
|
+
const xName = arr[0]?.name;
|
|
436
|
+
const sortArr = reverseTooltip ? [...arr].reverse() : arr;
|
|
437
|
+
const str = sortArr
|
|
438
|
+
.map((item: any) => {
|
|
439
|
+
const val = item?.data ?? item?.value;
|
|
440
|
+
return val !== null && val !== undefined
|
|
441
|
+
? `<div>${item?.marker} ${item?.seriesName}: ${val?.toLocaleString()}${unit}</div>`
|
|
442
|
+
: '';
|
|
443
|
+
})
|
|
444
|
+
.join('');
|
|
445
|
+
return `<div>${xName}</div>${str}`;
|
|
446
|
+
},
|
|
447
|
+
},
|
|
448
|
+
legend: {
|
|
449
|
+
...LEGEND_BASE,
|
|
450
|
+
data: series.map((item: any) => item?.name),
|
|
451
|
+
},
|
|
452
|
+
grid: { ...GRID_HORIZONTAL, ...grid },
|
|
453
|
+
yAxis: {
|
|
454
|
+
type: 'category' as const,
|
|
455
|
+
axisTick: { show: false },
|
|
456
|
+
axisLabel: {
|
|
457
|
+
fontSize: 10,
|
|
458
|
+
interval: 0,
|
|
459
|
+
width: 160,
|
|
460
|
+
overflow: 'truncate' as const,
|
|
461
|
+
ellipsis: '...',
|
|
462
|
+
...yAxis?.axisLabel,
|
|
463
|
+
},
|
|
464
|
+
data: xData,
|
|
465
|
+
...yAxis,
|
|
466
|
+
},
|
|
467
|
+
xAxis: {
|
|
468
|
+
type: 'value' as const,
|
|
469
|
+
minInterval: 1,
|
|
470
|
+
axisLabel: {
|
|
471
|
+
fontSize: 10,
|
|
472
|
+
formatter: (v: number) => `${v}${unit}`,
|
|
473
|
+
...xAxis?.axisLabel,
|
|
474
|
+
},
|
|
475
|
+
axisLine: { show: false },
|
|
476
|
+
splitLine: { show: false },
|
|
477
|
+
...xAxis,
|
|
478
|
+
},
|
|
479
|
+
series: series.map((item: any, sIdx: number) => {
|
|
480
|
+
return {
|
|
481
|
+
name: item?.name,
|
|
482
|
+
type: 'bar' as const,
|
|
483
|
+
barMaxWidth: 50,
|
|
484
|
+
stack: item?.stack || 'stackKey',
|
|
485
|
+
data: item?.data,
|
|
486
|
+
label: showLabel
|
|
487
|
+
? {
|
|
488
|
+
show: true,
|
|
489
|
+
position: 'right' as const,
|
|
490
|
+
fontSize: 12,
|
|
491
|
+
color: '#333',
|
|
492
|
+
formatter: (params: any) => {
|
|
493
|
+
const { dataIndex, name } = params;
|
|
494
|
+
const validLen =
|
|
495
|
+
dateMap[name]?.filter((v: any) => v !== null)?.length ?? 0;
|
|
496
|
+
if (sIdx !== validLen - 1) return '';
|
|
497
|
+
const total = series.reduce(
|
|
498
|
+
(sum: number, s: any) =>
|
|
499
|
+
sum + (Number(s.data[dataIndex]) || 0),
|
|
500
|
+
0,
|
|
501
|
+
);
|
|
502
|
+
return total ? `${total}${unit}` : '';
|
|
503
|
+
},
|
|
504
|
+
}
|
|
505
|
+
: { show: false },
|
|
506
|
+
...seriesProps,
|
|
507
|
+
...item,
|
|
508
|
+
...(item?.label ? { label: item.label } : showLabel ? {} : {}),
|
|
509
|
+
};
|
|
510
|
+
}),
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
function buildStackBarPercentOption(
|
|
515
|
+
data: BarDataPercent,
|
|
516
|
+
unit: string,
|
|
517
|
+
chartProps: Record<string, any>,
|
|
518
|
+
): echarts.EChartsCoreOption {
|
|
519
|
+
const { grid = {} } = chartProps;
|
|
520
|
+
const { xData = [], series = [], allTypes = [], originalData = {} } = data;
|
|
521
|
+
|
|
522
|
+
return {
|
|
523
|
+
tooltip: {
|
|
524
|
+
trigger: 'axis' as const,
|
|
525
|
+
formatter: (arr: any) => {
|
|
526
|
+
const xName = arr[0]?.name ?? '';
|
|
527
|
+
const originData: any[] = originalData[xName] ?? [];
|
|
528
|
+
const dateLabel = xName.replace(/^\d{4}(\d{2})(\d{2})$/, '$1/$2');
|
|
529
|
+
const str = arr
|
|
530
|
+
.map((item: any) => {
|
|
531
|
+
const cnt = (
|
|
532
|
+
originData.find((o: any) => o.key === item?.seriesName)
|
|
533
|
+
?.active_device_cnt ?? 0
|
|
534
|
+
).toLocaleString();
|
|
535
|
+
return `<div style="text-align:left;">${item?.marker} ${item?.seriesName} ${cnt}(${item.value}${unit})</div>`;
|
|
536
|
+
})
|
|
537
|
+
.join('');
|
|
538
|
+
return `<div style="text-align:left;">${dateLabel}</div>${str}`;
|
|
539
|
+
},
|
|
540
|
+
},
|
|
541
|
+
legend: {
|
|
542
|
+
...LEGEND_BASE,
|
|
543
|
+
data: allTypes,
|
|
544
|
+
},
|
|
545
|
+
grid: {
|
|
546
|
+
top: 30,
|
|
547
|
+
left: 50,
|
|
548
|
+
right: 40,
|
|
549
|
+
bottom: 60,
|
|
550
|
+
containLabel: true,
|
|
551
|
+
...grid,
|
|
552
|
+
},
|
|
553
|
+
xAxis: {
|
|
554
|
+
type: 'category' as const,
|
|
555
|
+
data: xData,
|
|
556
|
+
axisTick: { show: false },
|
|
557
|
+
axisPointer: { type: 'shadow' as const },
|
|
558
|
+
axisLabel: {
|
|
559
|
+
fontSize: 10,
|
|
560
|
+
formatter: (value: string) =>
|
|
561
|
+
value.replace(/^\d{4}(\d{2})(\d{2})$/, '$1/$2'),
|
|
562
|
+
},
|
|
563
|
+
},
|
|
564
|
+
yAxis: {
|
|
565
|
+
type: 'value' as const,
|
|
566
|
+
max: 100,
|
|
567
|
+
nameLocation: 'middle' as const,
|
|
568
|
+
nameGap: 80,
|
|
569
|
+
position: 'left' as const,
|
|
570
|
+
axisLabel: {
|
|
571
|
+
fontSize: 10,
|
|
572
|
+
formatter: '{value}%',
|
|
573
|
+
},
|
|
574
|
+
},
|
|
575
|
+
series: series.map((barItem: any) => ({
|
|
576
|
+
name: barItem.name,
|
|
577
|
+
type: 'bar' as const,
|
|
578
|
+
barMaxWidth: 50,
|
|
579
|
+
stack: 'Total',
|
|
580
|
+
data: barItem.data,
|
|
581
|
+
label: {
|
|
582
|
+
show: true,
|
|
583
|
+
position: 'inside' as const,
|
|
584
|
+
fontSize: 12,
|
|
585
|
+
formatter: (params: any) => {
|
|
586
|
+
const oData: any[] = originalData[params.name] ?? [];
|
|
587
|
+
const tarData = oData.find(
|
|
588
|
+
(item: any) => item.key === params.seriesName,
|
|
589
|
+
);
|
|
590
|
+
return tarData?.active_device_cnt ?? 0;
|
|
591
|
+
},
|
|
592
|
+
},
|
|
593
|
+
})),
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
function buildInversionStackBarPercentOption(
|
|
598
|
+
data: BarDataPercent,
|
|
599
|
+
unit: string,
|
|
600
|
+
chartProps: Record<string, any>,
|
|
601
|
+
): echarts.EChartsCoreOption {
|
|
602
|
+
const { grid = {} } = chartProps;
|
|
603
|
+
const { xData = [], series = [], allTypes = [], originalData = {} } = data;
|
|
604
|
+
|
|
605
|
+
return {
|
|
606
|
+
tooltip: {
|
|
607
|
+
trigger: 'axis' as const,
|
|
608
|
+
formatter: (arr: any) => {
|
|
609
|
+
const yName = arr[0]?.name ?? '';
|
|
610
|
+
const originData: any[] = originalData[yName] ?? [];
|
|
611
|
+
const dateLabel = yName.replace(/^\d{4}(\d{2})(\d{2})$/, '$1/$2');
|
|
612
|
+
const str = arr
|
|
613
|
+
.map((item: any) => {
|
|
614
|
+
const cnt = (
|
|
615
|
+
originData.find((o: any) => o.key === item?.seriesName)
|
|
616
|
+
?.active_device_cnt ?? 0
|
|
617
|
+
).toLocaleString();
|
|
618
|
+
return `<div style="text-align:left;">${item?.marker} ${item?.seriesName} ${cnt}(${item.value}${unit})</div>`;
|
|
619
|
+
})
|
|
620
|
+
.join('');
|
|
621
|
+
return `<div style="text-align:left;">${dateLabel}</div>${str}`;
|
|
622
|
+
},
|
|
623
|
+
},
|
|
624
|
+
legend: {
|
|
625
|
+
...LEGEND_BASE,
|
|
626
|
+
data: allTypes,
|
|
627
|
+
},
|
|
628
|
+
grid: {
|
|
629
|
+
top: 30,
|
|
630
|
+
left: 50,
|
|
631
|
+
right: 40,
|
|
632
|
+
bottom: 60,
|
|
633
|
+
containLabel: true,
|
|
634
|
+
...grid,
|
|
635
|
+
},
|
|
636
|
+
yAxis: {
|
|
637
|
+
type: 'category' as const,
|
|
638
|
+
data: xData,
|
|
639
|
+
axisTick: { show: false },
|
|
640
|
+
axisLabel: {
|
|
641
|
+
fontSize: 10,
|
|
642
|
+
formatter: (value: string) =>
|
|
643
|
+
value.replace(/^\d{4}(\d{2})(\d{2})$/, '$1/$2'),
|
|
644
|
+
},
|
|
645
|
+
},
|
|
646
|
+
xAxis: {
|
|
647
|
+
type: 'value' as const,
|
|
648
|
+
max: 100,
|
|
649
|
+
axisLabel: {
|
|
650
|
+
fontSize: 10,
|
|
651
|
+
formatter: '{value}%',
|
|
652
|
+
},
|
|
653
|
+
},
|
|
654
|
+
series: series.map((barItem: any) => ({
|
|
655
|
+
name: barItem.name,
|
|
656
|
+
type: 'bar' as const,
|
|
657
|
+
barMaxWidth: 50,
|
|
658
|
+
stack: 'Total',
|
|
659
|
+
data: barItem.data,
|
|
660
|
+
label: {
|
|
661
|
+
show: true,
|
|
662
|
+
position: 'inside' as const,
|
|
663
|
+
fontSize: 12,
|
|
664
|
+
formatter: (params: any) => {
|
|
665
|
+
const oData: any[] = originalData[params.name] ?? [];
|
|
666
|
+
const tarData = oData.find(
|
|
667
|
+
(item: any) => item.key === params.seriesName,
|
|
668
|
+
);
|
|
669
|
+
return tarData?.active_device_cnt ?? 0;
|
|
670
|
+
},
|
|
671
|
+
},
|
|
672
|
+
})),
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
// ─── 组件 ─────────────────────────────────────────────────────────────────────
|
|
677
|
+
|
|
678
|
+
export const BarChart: React.FC<BarChartProps> = ({
|
|
679
|
+
data,
|
|
680
|
+
variant = 'bar',
|
|
681
|
+
direction = 'vertical',
|
|
682
|
+
unit = '',
|
|
683
|
+
title,
|
|
684
|
+
height = 300,
|
|
685
|
+
showLabel: showLabelProp,
|
|
686
|
+
showGrid: showGridProp,
|
|
687
|
+
legendShow: legendShowProp,
|
|
688
|
+
chartProps = {},
|
|
689
|
+
option: optionOverride,
|
|
690
|
+
onChartReady,
|
|
691
|
+
loading = false,
|
|
692
|
+
empty,
|
|
693
|
+
style,
|
|
694
|
+
className,
|
|
695
|
+
testId,
|
|
696
|
+
}) => {
|
|
697
|
+
// 空态判断
|
|
698
|
+
const isEmptyData = empty ?? isEmpty(data);
|
|
699
|
+
|
|
700
|
+
// showLabel 默认值
|
|
701
|
+
const showLabel = showLabelProp ?? true;
|
|
702
|
+
|
|
703
|
+
// showGrid 默认值
|
|
704
|
+
const showGrid = showGridProp ?? true;
|
|
705
|
+
|
|
706
|
+
// 构建 option
|
|
707
|
+
const mergedOption = useMemo(() => {
|
|
708
|
+
let baseOption: echarts.EChartsCoreOption;
|
|
709
|
+
|
|
710
|
+
if (variant === 'bar' && direction === 'horizontal') {
|
|
711
|
+
baseOption = buildHorizontalBarOption(
|
|
712
|
+
data as BarDataSingle,
|
|
713
|
+
unit,
|
|
714
|
+
showLabel,
|
|
715
|
+
chartProps,
|
|
716
|
+
);
|
|
717
|
+
} else if (variant === 'stackBar' && direction === 'horizontal') {
|
|
718
|
+
baseOption = buildInversionStackBarOption(
|
|
719
|
+
data as BarDataMulti,
|
|
720
|
+
unit,
|
|
721
|
+
showLabel,
|
|
722
|
+
chartProps,
|
|
723
|
+
);
|
|
724
|
+
} else if (variant === 'stackBarPercent' && direction === 'horizontal') {
|
|
725
|
+
baseOption = buildInversionStackBarPercentOption(
|
|
726
|
+
data as BarDataPercent,
|
|
727
|
+
unit,
|
|
728
|
+
chartProps,
|
|
729
|
+
);
|
|
730
|
+
} else if (variant === 'stackBarPercent') {
|
|
731
|
+
baseOption = buildStackBarPercentOption(
|
|
732
|
+
data as BarDataPercent,
|
|
733
|
+
unit,
|
|
734
|
+
chartProps,
|
|
735
|
+
);
|
|
736
|
+
} else if (variant === 'stackBar') {
|
|
737
|
+
baseOption = buildStackBarOption(
|
|
738
|
+
data as BarDataMulti,
|
|
739
|
+
unit,
|
|
740
|
+
showLabel,
|
|
741
|
+
chartProps,
|
|
742
|
+
);
|
|
743
|
+
} else {
|
|
744
|
+
// variant === 'bar' && direction === 'vertical' (default)
|
|
745
|
+
baseOption = buildBarOption(
|
|
746
|
+
data as BarDataSingle,
|
|
747
|
+
unit,
|
|
748
|
+
showLabel,
|
|
749
|
+
chartProps,
|
|
750
|
+
);
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
// legendShow 覆盖
|
|
754
|
+
if (legendShowProp !== undefined) {
|
|
755
|
+
const legend = baseOption.legend as any;
|
|
756
|
+
baseOption = {
|
|
757
|
+
...baseOption,
|
|
758
|
+
legend: { ...legend, show: legendShowProp },
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
// showGrid 覆盖:隐藏网格线
|
|
763
|
+
if (!showGrid) {
|
|
764
|
+
const yAxisBase = (baseOption as any).yAxis ?? {};
|
|
765
|
+
const xAxisBase = (baseOption as any).xAxis ?? {};
|
|
766
|
+
baseOption = {
|
|
767
|
+
...baseOption,
|
|
768
|
+
yAxis: {
|
|
769
|
+
...yAxisBase,
|
|
770
|
+
splitLine: { ...yAxisBase.splitLine, show: false },
|
|
771
|
+
},
|
|
772
|
+
xAxis: {
|
|
773
|
+
...xAxisBase,
|
|
774
|
+
splitLine: { ...xAxisBase.splitLine, show: false },
|
|
775
|
+
},
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
// option 覆盖合并
|
|
780
|
+
if (optionOverride) {
|
|
781
|
+
return {
|
|
782
|
+
...baseOption,
|
|
783
|
+
...optionOverride,
|
|
784
|
+
...(optionOverride.legend
|
|
785
|
+
? {
|
|
786
|
+
legend: {
|
|
787
|
+
...(baseOption.legend as any),
|
|
788
|
+
...(optionOverride.legend as any),
|
|
789
|
+
},
|
|
790
|
+
}
|
|
791
|
+
: {}),
|
|
792
|
+
...(optionOverride.tooltip
|
|
793
|
+
? {
|
|
794
|
+
tooltip: {
|
|
795
|
+
...(baseOption.tooltip as any),
|
|
796
|
+
...(optionOverride.tooltip as any),
|
|
797
|
+
},
|
|
798
|
+
}
|
|
799
|
+
: {}),
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
return baseOption;
|
|
804
|
+
}, [
|
|
805
|
+
data,
|
|
806
|
+
variant,
|
|
807
|
+
direction,
|
|
808
|
+
unit,
|
|
809
|
+
showLabel,
|
|
810
|
+
showGrid,
|
|
811
|
+
legendShowProp,
|
|
812
|
+
chartProps,
|
|
813
|
+
optionOverride,
|
|
814
|
+
]);
|
|
815
|
+
|
|
816
|
+
const { domRef, chartRef } = useECharts({ option: mergedOption });
|
|
817
|
+
|
|
818
|
+
// onChartReady 回调
|
|
819
|
+
useEffect(() => {
|
|
820
|
+
onChartReady?.(chartRef.current);
|
|
821
|
+
return () => {
|
|
822
|
+
onChartReady?.(null);
|
|
823
|
+
};
|
|
824
|
+
}, [chartRef.current, onChartReady]);
|
|
825
|
+
|
|
826
|
+
const titleNode = title ? (
|
|
827
|
+
typeof title === 'string' ? (
|
|
828
|
+
<div
|
|
829
|
+
style={{
|
|
830
|
+
textAlign: 'center',
|
|
831
|
+
fontSize: 13,
|
|
832
|
+
fontWeight: 'bold',
|
|
833
|
+
color: '#515151',
|
|
834
|
+
marginTop: 12,
|
|
835
|
+
marginBottom: 4,
|
|
836
|
+
}}
|
|
837
|
+
>
|
|
838
|
+
{title}
|
|
839
|
+
</div>
|
|
840
|
+
) : (
|
|
841
|
+
title
|
|
842
|
+
)
|
|
843
|
+
) : null;
|
|
844
|
+
|
|
845
|
+
return (
|
|
846
|
+
<Spin spinning={loading}>
|
|
847
|
+
<div
|
|
848
|
+
style={{
|
|
849
|
+
position: 'relative',
|
|
850
|
+
width: '100%',
|
|
851
|
+
...(titleNode
|
|
852
|
+
? { display: 'flex', flexDirection: 'column', height }
|
|
853
|
+
: {}),
|
|
854
|
+
}}
|
|
855
|
+
>
|
|
856
|
+
{titleNode}
|
|
857
|
+
<div
|
|
858
|
+
style={{
|
|
859
|
+
position: 'relative',
|
|
860
|
+
width: '100%',
|
|
861
|
+
...(titleNode ? { flex: 1, minHeight: 0 } : { height }),
|
|
862
|
+
}}
|
|
863
|
+
>
|
|
864
|
+
<div
|
|
865
|
+
ref={domRef}
|
|
866
|
+
className={className}
|
|
867
|
+
style={{
|
|
868
|
+
width: '100%',
|
|
869
|
+
height: titleNode ? '100%' : height,
|
|
870
|
+
...style,
|
|
871
|
+
}}
|
|
872
|
+
data-testid={testId}
|
|
873
|
+
/>
|
|
874
|
+
{isEmptyData && !loading && (
|
|
875
|
+
<div
|
|
876
|
+
style={{
|
|
877
|
+
position: 'absolute',
|
|
878
|
+
inset: 0,
|
|
879
|
+
display: 'flex',
|
|
880
|
+
justifyContent: 'center',
|
|
881
|
+
alignItems: 'center',
|
|
882
|
+
}}
|
|
883
|
+
>
|
|
884
|
+
<Empty
|
|
885
|
+
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
|
886
|
+
description="NO DATA"
|
|
887
|
+
/>
|
|
888
|
+
</div>
|
|
889
|
+
)}
|
|
890
|
+
</div>
|
|
891
|
+
</div>
|
|
892
|
+
</Spin>
|
|
893
|
+
);
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
export default BarChart;
|