├── .commitlintrc.js ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── question.md ├── dependabot.yml └── workflows │ ├── ci.yml │ ├── coverage.yml │ ├── emoji-helper.yml │ ├── issue-labeled.yml │ ├── issue-open-check.yml │ ├── preview-build.yml │ ├── preview-deploy.yml │ └── preview-start.yml ├── .gitignore ├── .husky ├── commit-msg └── pre-commit ├── .lintstagedrc ├── .prettierignore ├── .prettierrc.js ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.ar-DZ.md ├── README.es-ES.md ├── README.fr-FR.md ├── README.ja-JP.md ├── README.md ├── README.pt-BR.md ├── README.ru-RU.md ├── README.tr-TR.md ├── README.zh-CN.md ├── config ├── config.ts ├── defaultSettings.ts ├── oneapi.json ├── proxy.ts └── routes.ts ├── jest.config.ts ├── jsconfig.json ├── mock ├── listTableList.ts ├── notices.ts ├── requestRecord.mock.js ├── route.ts └── user.ts ├── package.json ├── public ├── CNAME ├── favicon.ico ├── icons │ ├── icon-128x128.png │ ├── icon-192x192.png │ └── icon-512x512.png ├── logo.svg ├── pro_icon.svg └── scripts │ └── loading.js ├── src ├── access.ts ├── app.tsx ├── components │ ├── Footer │ │ └── index.tsx │ ├── HeaderDropdown │ │ └── index.tsx │ ├── RightContent │ │ ├── AvatarDropdown.tsx │ │ └── index.tsx │ └── index.ts ├── global.less ├── global.tsx ├── locales │ ├── bn-BD.ts │ ├── bn-BD │ │ ├── component.ts │ │ ├── globalHeader.ts │ │ ├── menu.ts │ │ ├── pages.ts │ │ ├── pwa.ts │ │ ├── settingDrawer.ts │ │ └── settings.ts │ ├── en-US.ts │ ├── en-US │ │ ├── component.ts │ │ ├── globalHeader.ts │ │ ├── menu.ts │ │ ├── pages.ts │ │ ├── pwa.ts │ │ ├── settingDrawer.ts │ │ └── settings.ts │ ├── fa-IR.ts │ ├── fa-IR │ │ ├── component.ts │ │ ├── globalHeader.ts │ │ ├── menu.ts │ │ ├── pages.ts │ │ ├── pwa.ts │ │ ├── settingDrawer.ts │ │ └── settings.ts │ ├── id-ID.ts │ ├── id-ID │ │ ├── component.ts │ │ ├── globalHeader.ts │ │ ├── menu.ts │ │ ├── pages.ts │ │ ├── pwa.ts │ │ ├── settingDrawer.ts │ │ └── settings.ts │ ├── ja-JP.ts │ ├── ja-JP │ │ ├── component.ts │ │ ├── globalHeader.ts │ │ ├── menu.ts │ │ ├── pages.ts │ │ ├── pwa.ts │ │ ├── settingDrawer.ts │ │ └── settings.ts │ ├── pt-BR.ts │ ├── pt-BR │ │ ├── component.ts │ │ ├── globalHeader.ts │ │ ├── menu.ts │ │ ├── pages.ts │ │ ├── pwa.ts │ │ ├── settingDrawer.ts │ │ └── settings.ts │ ├── zh-CN.ts │ ├── zh-CN │ │ ├── component.ts │ │ ├── globalHeader.ts │ │ ├── menu.ts │ │ ├── pages.ts │ │ ├── pwa.ts │ │ ├── settingDrawer.ts │ │ └── settings.ts │ ├── zh-TW.ts │ └── zh-TW │ │ ├── component.ts │ │ ├── globalHeader.ts │ │ ├── menu.ts │ │ ├── pages.ts │ │ ├── pwa.ts │ │ ├── settingDrawer.ts │ │ └── settings.ts ├── manifest.json ├── pages │ ├── 404.tsx │ ├── Admin.tsx │ ├── TableList │ │ ├── components │ │ │ └── UpdateForm.tsx │ │ └── index.tsx │ ├── User │ │ └── Login │ │ │ ├── __snapshots__ │ │ │ └── login.test.tsx.snap │ │ │ ├── index.tsx │ │ │ └── login.test.tsx │ └── Welcome.tsx ├── requestErrorConfig.ts ├── service-worker.js ├── services │ ├── ant-design-pro │ │ ├── api.ts │ │ ├── index.ts │ │ ├── login.ts │ │ └── typings.d.ts │ └── swagger │ │ ├── index.ts │ │ ├── pet.ts │ │ ├── store.ts │ │ ├── typings.d.ts │ │ └── user.ts └── typings.d.ts ├── tests └── setupTests.jsx ├── tsconfig.json └── types ├── cache ├── cache.json ├── login.cache.json └── mock │ ├── login.mock.cache.js │ └── mock.cache.js └── index.d.ts /.commitlintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { extends: ['@commitlint/config-conventional'] }; 2 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | 15 | [Makefile] 16 | indent_style = tab 17 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /lambda/ 2 | /scripts 3 | /config 4 | .history 5 | public 6 | dist 7 | .umi 8 | mock -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: [require.resolve('@umijs/lint/dist/config/eslint')], 3 | globals: { 4 | page: true, 5 | REACT_APP_ENV: true, 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: ant-design # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: ant-design 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: '报告 Bug | Report bug 🐛' 3 | about: 报告 Ant Design Pro 的 bug 4 | title: '🐛 [BUG]' 5 | labels: '🐛 bug' 6 | assignees: '' 7 | --- 8 | 9 | ### 🐛 bug 描述 10 | 11 | 15 | 16 | ### 📷 复现步骤 | Recurrence steps 17 | 18 | 22 | 23 | ### 🏞 期望结果 | Expected results 24 | 25 | 29 | 30 | ### 💻 复现代码 | Recurrence code 31 | 32 | 36 | 37 | ### © 版本信息 38 | 39 | - Ant Design Pro 版本: [e.g. 4.0.0] 40 | - umi 版本 41 | - 浏览器环境 42 | - 开发环境 [e.g. mac OS] 43 | 44 | ### 🚑 其他信息 45 | 46 | 49 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: '功能需求 | Feature Requirements ✨' 3 | about: 对 Ant Design Pro 的需求或建议 4 | title: '👑 [需求 | Feature]' 5 | labels: '👑 Feature Request' 6 | assignees: '' 7 | --- 8 | 9 | ### 🥰 需求描述 | Requirements description 10 | 11 | 15 | 16 | ### 🧐 解决方案 | Solution 17 | 18 | 22 | 23 | ### 🚑 其他信息 | Other information 24 | 25 | 29 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: '疑问或需要帮助 | Questions or need help ❓' 3 | about: 对 Ant Design Pro 使用的疑问或需要帮助 4 | title: '🧐[问题 | question]' 5 | labels: '🧐 question' 6 | assignees: '' 7 | --- 8 | 9 | ### 🧐 问题描述 | Problem description 10 | 11 | 15 | 16 | ### 💻 示例代码 | Sample code 17 | 18 | 22 | 23 | ### 🚑 其他信息 | Other information 24 | 25 | 29 | 30 | OS: 31 | 32 | Node: 33 | 34 | 浏览器 | browser: 35 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: 'npm' # See documentation for possible values 9 | directory: '/' # Location of package manifests 10 | schedule: 11 | interval: 'weekly' 12 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push, pull_request] 4 | 5 | permissions: 6 | contents: read 7 | 8 | jobs: 9 | build: 10 | runs-on: ${{ matrix.os }} 11 | strategy: 12 | matrix: 13 | node_version: [20, 16] 14 | os: [ubuntu-latest, windows-latest, macOS-latest] 15 | steps: 16 | - uses: actions/checkout@v4 17 | - name: Use Node.js ${{ matrix.node_version }} 18 | uses: actions/setup-node@v4 19 | with: 20 | node-version: ${{ matrix.node_version }} 21 | - run: echo ${{github.ref}} 22 | - uses: oven-sh/setup-bun@v2 23 | - run: bun install 24 | - run: bun run lint 25 | - run: bun run tsc 26 | - run: bun run build 27 | env: 28 | CI: true 29 | PROGRESS: none 30 | NODE_ENV: test 31 | NODE_OPTIONS: --max_old_space_size=4096 32 | -------------------------------------------------------------------------------- /.github/workflows/coverage.yml: -------------------------------------------------------------------------------- 1 | name: coverage CI 2 | 3 | on: [push, pull_request] 4 | 5 | permissions: 6 | contents: read 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v1 13 | - name: Use Node.js 16.x 14 | uses: actions/setup-node@v1 15 | with: 16 | node-version: 16.x 17 | - run: echo ${{github.ref}} 18 | - run: curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@7 19 | - run: pnpm config set store-dir ~/.pnpm-store 20 | - run: pnpm install --strict-peer-dependencies=false 21 | - run: yarn run test:coverage 22 | env: 23 | CI: true 24 | PROGRESS: none 25 | NODE_ENV: test 26 | NODE_OPTIONS: --max_old_space_size=4096 27 | - run: bash <(curl -s https://codecov.io/bash) 28 | -------------------------------------------------------------------------------- /.github/workflows/emoji-helper.yml: -------------------------------------------------------------------------------- 1 | name: Emoji Helper 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | emoji: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions-cool/emoji-helper@v1.0.0 12 | with: 13 | type: 'release' 14 | emoji: '+1, laugh, heart, hooray, rocket, eyes' 15 | -------------------------------------------------------------------------------- /.github/workflows/issue-labeled.yml: -------------------------------------------------------------------------------- 1 | name: Issue labeled 2 | 3 | on: 4 | issues: 5 | types: [labeled] 6 | 7 | jobs: 8 | reply-helper: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: help wanted 12 | if: github.event.label.name == '❤️ help wanted' || github.event.label.name == '🤝Welcome PR' 13 | uses: actions-cool/issues-helper@v1.11 14 | with: 15 | actions: 'create-comment' 16 | token: ${{ secrets.GITHUB_TOKEN }} 17 | issue-number: ${{ github.event.issue.number }} 18 | body: | 19 | Hello @${{ github.event.issue.user.login }}. We totally like your proposal/feedback, welcome to [send us a Pull Request](https://help.github.com/en/articles/creating-a-pull-request) for it. Please provide changelog/TypeScript/documentation/test cases if needed and make sure CI passed, we will review it soon. We appreciate your effort in advance and looking forward to your contribution! 20 | 21 | 你好 @${{ github.event.issue.user.login }},我们完全同意你的提议/反馈,欢迎直接在此仓库 [创建一个 Pull Request](https://help.github.com/en/articles/creating-a-pull-request) 来解决这个问题。请务必提供改动所需相应的 changelog、TypeScript 定义、测试用例、文档等,并确保 CI 通过,我们会尽快进行 Review,提前感谢和期待您的贡献。 22 | 23 | ![giphy](https://user-images.githubusercontent.com/507615/62342668-4735dc00-b51a-11e9-92a7-d46fbb1cc0c7.gif) 24 | 25 | - name: Need Reproduce 26 | if: github.event.label.name == '🤔 Need Reproduce' 27 | uses: actions-cool/issues-helper@v1.11 28 | with: 29 | actions: 'create-comment' 30 | token: ${{ secrets.GITHUB_TOKEN }} 31 | issue-number: ${{ github.event.issue.number }} 32 | body: | 33 | Hello @${{ github.event.issue.user.login }}. Please provide a online reproduction by forking this link https://codesandbox.io/ or a minimal GitHub repository. 34 | 35 | 你好 @${{ github.event.issue.user.login }}, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 [此处](https://codesandbox.io/) 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。 36 | 37 | ![](https://gw.alipayobjects.com/zos/antfincdn/y9kwg7DVCd/reproduce.gif) 38 | -------------------------------------------------------------------------------- /.github/workflows/issue-open-check.yml: -------------------------------------------------------------------------------- 1 | name: Issue Open Check 2 | 3 | on: 4 | issues: 5 | types: [opened, edited] 6 | 7 | jobs: 8 | check-issue: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions-cool/issues-helper@v2.2.0 12 | id: check 13 | with: 14 | actions: 'check-issue' 15 | issue-number: ${{ github.event.issue.number }} 16 | title-excludes: '🐛 [BUG], 👑 [需求 | Feature], 🧐[问题 | question]' 17 | 18 | - if: steps.check.outputs.check-result == 'false' && github.event.issue.state == 'open' 19 | uses: actions-cool/issues-helper@v2.2.0 20 | with: 21 | actions: 'create-comment, close-issue' 22 | issue-number: ${{ github.event.issue.number }} 23 | body: | 24 | 当前 Issue 未检测到标题,请规范填写,谢谢! 25 | 26 | The title of the current issue is not detected, please fill in according to the specifications, thank you! 27 | 28 | - if: steps.check.outputs.check-result == 'true' 29 | uses: actions-cool/issues-similarity-analysis@v1 30 | with: 31 | filter-threshold: 0.8 32 | title-excludes: '🐛[BUG], 👑 [需求 | Feature], 🧐[问题 | question]' 33 | comment-title: '### 以下的 Issues 可能会帮助到你 / The following issues may help you' 34 | show-footer: false 35 | -------------------------------------------------------------------------------- /.github/workflows/preview-build.yml: -------------------------------------------------------------------------------- 1 | name: Preview Build 2 | 3 | on: 4 | pull_request: 5 | types: [opened, synchronize, reopened] 6 | 7 | permissions: 8 | contents: read 9 | 10 | jobs: 11 | build-preview: 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | with: 17 | ref: ${{ github.event.pull_request.head.sha }} 18 | 19 | - name: build 20 | run: | 21 | yarn 22 | yarn add umi-plugin-pro --save 23 | yarn build 24 | 25 | - name: upload dist artifact 26 | uses: actions/upload-artifact@v4 27 | with: 28 | name: dist 29 | path: dist/ 30 | retention-days: 5 31 | 32 | - name: Save PR number 33 | if: ${{ always() }} 34 | run: echo ${{ github.event.number }} > ./pr-id.txt 35 | 36 | - name: Upload PR number 37 | if: ${{ always() }} 38 | uses: actions/upload-artifact@v4 39 | with: 40 | name: pr 41 | path: ./pr-id.txt 42 | -------------------------------------------------------------------------------- /.github/workflows/preview-deploy.yml: -------------------------------------------------------------------------------- 1 | name: Preview Deploy 2 | 3 | on: 4 | workflow_run: 5 | workflows: ['Preview Build'] 6 | types: 7 | - completed 8 | 9 | permissions: 10 | contents: read 11 | 12 | jobs: 13 | success: 14 | permissions: 15 | actions: read # for dawidd6/action-download-artifact to query and download artifacts 16 | issues: write # for actions-cool/maintain-one-comment to modify or create issue comments 17 | pull-requests: write # for actions-cool/maintain-one-comment to modify or create PR comments 18 | runs-on: ubuntu-latest 19 | if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' 20 | steps: 21 | - name: download pr artifact 22 | uses: dawidd6/action-download-artifact@v4 23 | with: 24 | workflow: ${{ github.event.workflow_run.workflow_id }} 25 | name: pr 26 | 27 | - name: save PR id 28 | id: pr 29 | run: echo "::set-output name=id::$( 52 | 53 | 54 | body-include: '' 55 | number: ${{ steps.pr.outputs.id }} 56 | 57 | - name: The job failed 58 | if: ${{ failure() }} 59 | uses: actions-cool/maintain-one-comment@v1.2.1 60 | with: 61 | token: ${{ secrets.GITHUB_TOKEN }} 62 | body: | 63 | 😭 Deploy PR Preview failed. 64 | 65 | 66 | 67 | 68 | body-include: '' 69 | number: ${{ steps.pr.outputs.id }} 70 | 71 | failed: 72 | permissions: 73 | actions: read # for dawidd6/action-download-artifact to query and download artifacts 74 | issues: write # for actions-cool/maintain-one-comment to modify or create issue comments 75 | pull-requests: write # for actions-cool/maintain-one-comment to modify or create PR comments 76 | runs-on: ubuntu-latest 77 | if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure' 78 | steps: 79 | - name: download pr artifact 80 | uses: dawidd6/action-download-artifact@v4 81 | with: 82 | workflow: ${{ github.event.workflow_run.workflow_id }} 83 | name: pr 84 | 85 | - name: save PR id 86 | id: pr 87 | run: echo "::set-output name=id::$( 97 | 98 | 99 | body-include: '' 100 | number: ${{ steps.pr.outputs.id }} 101 | -------------------------------------------------------------------------------- /.github/workflows/preview-start.yml: -------------------------------------------------------------------------------- 1 | name: Preview Start 2 | 3 | on: pull_request_target 4 | 5 | permissions: 6 | contents: read 7 | 8 | jobs: 9 | preview: 10 | permissions: 11 | issues: write # for actions-cool/maintain-one-comment to modify or create issue comments 12 | pull-requests: write # for actions-cool/maintain-one-comment to modify or create PR comments 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: create 16 | uses: actions-cool/maintain-one-comment@v1.2.1 17 | with: 18 | token: ${{ secrets.GITHUB_TOKEN }} 19 | body: | 20 | ⚡️ Deploying PR Preview... 21 | 22 | 23 | 24 | body-include: '' 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | **/node_modules 5 | # roadhog-api-doc ignore 6 | /src/utils/request-temp.js 7 | _roadhog-api-doc 8 | 9 | # production 10 | /dist 11 | 12 | # misc 13 | .DS_Store 14 | npm-debug.log* 15 | yarn-error.log 16 | 17 | /coverage 18 | .idea 19 | yarn.lock 20 | package-lock.json 21 | *bak 22 | .vscode 23 | 24 | 25 | # visual studio code 26 | .history 27 | *.log 28 | functions/* 29 | .temp/** 30 | 31 | # umi 32 | .umi 33 | .umi-production 34 | .umi-test 35 | 36 | # screenshot 37 | screenshot 38 | .firebase 39 | .eslintcache 40 | 41 | build 42 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | npx --no -- commitlint --edit $1 2 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | lint-staged 2 | -------------------------------------------------------------------------------- /.lintstagedrc: -------------------------------------------------------------------------------- 1 | { 2 | "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js", 3 | "**/*.{js,jsx,tsx,ts,less,md,json,yml}": [ 4 | "prettier --write" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | **/*.svg 2 | .umi 3 | .umi-production 4 | /dist 5 | .dockerignore 6 | .DS_Store 7 | .eslintignore 8 | *.png 9 | *.toml 10 | docker 11 | .editorconfig 12 | Dockerfile* 13 | .gitignore 14 | .prettierignore 15 | LICENSE 16 | .eslintcache 17 | *.lock 18 | yarn-error.log 19 | .history 20 | CNAME 21 | /build 22 | /public 23 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | singleQuote: true, 3 | trailingComma: 'all', 4 | printWidth: 100, 5 | proseWrap: 'never', 6 | endOfLine: 'lf', 7 | overrides: [ 8 | { 9 | files: '.prettierrc', 10 | options: { 11 | parser: 'json', 12 | }, 13 | }, 14 | { 15 | files: 'document.ejs', 16 | options: { 17 | parser: 'html', 18 | }, 19 | }, 20 | ], 21 | }; 22 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | - Using welcoming and inclusive language 12 | - Being respectful of differing viewpoints and experiences 13 | - Gracefully accepting constructive criticism 14 | - Focusing on what is best for the community 15 | - Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | - The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | - Trolling, insulting/derogatory comments, and personal or political attacks 21 | - Public or private harassment 22 | - Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | - Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at afc163@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-present Alipay.inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.ja-JP.md: -------------------------------------------------------------------------------- 1 | Language : [🇺🇸](./README.md) | [🇨🇳](./README.zh-CN.md) | [🇷🇺](./README.ru-RU.md) | [🇹🇷](./README.tr-TR.md) | 🇯🇵 | [🇫🇷](./README.fr-FR.md) | [🇵🇹](./README.pt-BR.md) | [🇸🇦](./README.ar-DZ.md) 2 | 3 |

Ant Design Pro

4 | 5 |
6 | 7 | 独創的な業務システムの UI を解決するための React ボイラープレート。 8 | 9 | [![Node CI](https://github.com/ant-design/ant-design-pro/actions/workflows/ci.yml/badge.svg)](https://github.com/ant-design/ant-design-pro/actions/workflows/ci.yml) [![Preview Deploy](https://github.com/ant-design/ant-design-pro/actions/workflows/preview-deploy.yml/badge.svg)](https://github.com/ant-design/ant-design-pro/actions/workflows/preview-deploy.yml) [![Build With Umi](https://img.shields.io/badge/build%20with-umi-028fe4.svg?style=flat-square)](http://umijs.org/) ![](https://badgen.net/badge/icon/Ant%20Design?icon=https://gw.alipayobjects.com/zos/antfincdn/Pp4WPgVDB3/KDpgvguMpGfqaHPjicRK.svg&label) 10 | 11 | ![](https://github.com/user-attachments/assets/fde29061-3d9a-4397-8ac2-397b0e033ef5) 12 | 13 |
14 | 15 | - プレビュー: http://preview.pro.ant.design 16 | - ホームページ: http://pro.ant.design 17 | - ドキュメント: http://pro.ant.design/docs/getting-started 18 | - 変更ログ: http://pro.ant.design/docs/changelog 19 | - FAQ: http://pro.ant.design/docs/faq 20 | 21 | ## 2.0 がリリースされました 🎉🎉🎉 22 | 23 | [Announcing Ant Design Pro 2.0.0](https://medium.com/ant-design/beautiful-and-powerful-ant-design-pro-2-0-release-51358da5af95) 24 | 25 | ## 翻訳の募集 :loudspeaker: 26 | 27 | 私たちはあなたの助けを必要としています。: https://github.com/ant-design/ant-design-pro/issues/120 28 | 29 | ## 特徴 30 | 31 | - :gem: **きちんとしたデザイン**: [Ant Design specification](http://ant.design/) に従ってくださ い。 32 | - :triangular_ruler: **共通のテンプレート**: 業務システム用のテンプレート 33 | - :rocket: **現状のアート開発**: `React/umi/dva/antd` の最新開発スタック 34 | - :iphone: **レスポンシブ**: さまざまな画面サイズ用の設計 35 | - :art: **テーマ**: シンプルな設定でカスタマイズ可能なテーマ 36 | - :globe_with_meridians: **国際化**: 国際化の解決策を内蔵 37 | - :gear: **ベストプラクティス**: コードを美しくするための正しいワークフロー 38 | - :1234: **モック開発**: 使いやすいモック開発 39 | - :white_check_mark: **UI テスト**: ユニットテストと e2e テスト 40 | 41 | ## テンプレート 42 | 43 | ``` 44 | - ダッシュボード 45 | - アナリティクス 46 | - モニター 47 |   - ワークスペース 48 | - 形 49 |   - 基本フォーム 50 |   - ステップフォーム 51 |   - 高度なフォーム 52 | - リスト 53 |   - スタンダードテーブル 54 |   - スタンダードリスト 55 |   - カードリスト 56 |   - 検索リスト(プロジェクト/アプリケーション/記事) 57 | - プロフィール 58 |   - 簡単なプロフィール 59 |   - 高度なプロファイル 60 | - アカウント 61 |   - アカウントセンター 62 |   - アカウント設定 63 | - 結果 64 |   - 成功 65 |   - 失敗 66 | - 例外 67 |   - 403 68 |   - 404 69 |   - 500 70 | - ユーザー 71 |   - ログイン 72 |   - 登録 73 |   - 登録結果 74 | ``` 75 | 76 | ## 使用法 77 | 78 | ### bash を使う方法 79 | 80 | ```bash 81 | $ mkdir 82 | $ cd 83 | $ yarn create umi # or npm create umi 84 | 85 | # Choose ant-design-pro: 86 | Select the boilerplate type (Use arrow keys) 87 | ❯ ant-design-pro - Create project with an layout-only ant-design-pro boilerplate, use together with umi block. 88 | app - Create project with a simple boilerplate, support typescript. 89 | block - Create a umi block. 90 | library - Create a library with umi. 91 | plugin - Create a umi plugin. 92 | 93 | $ git init 94 | $ npm install 95 | $ npm start # http://localhost:8000 を開く 96 | ``` 97 | 98 | ## サポートするブラウザー 99 | 100 | モダンなブラウザと。 101 | 102 | | [Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | [Opera](http://godban.github.io/browsers-support-badges/)
Opera | 103 | | --- | --- | --- | --- | --- | 104 | | Edge | 最新版から 2 バージョン | 最新版から 2 バージョン | 最新版から 2 バージョン | 最新版から 2 バージョン | 105 | 106 | ## 貢献する 107 | 108 | どんな種類の貢献でも大歓迎です。あなたがこのプロジェクトに貢献できる方法のいくつかの例はここにあります。: 109 | 110 | - 毎日の仕事に Ant Design Pro を使用すること。 111 | - 報告すること。 [issues](http://github.com/ant-design/ant-design-pro/issues) にバグ報告や質問をしてください。 112 | - 更新すること。 改善を、[pull requests](http://github.com/ant-design/ant-design-pro/pulls) で送ってください。 113 | 114 | [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) 115 | -------------------------------------------------------------------------------- /README.zh-CN.md: -------------------------------------------------------------------------------- 1 | Language : [🇺🇸](./README.md) | 🇨🇳 | [🇷🇺](./README.ru-RU.md) | [🇹🇷](./README.tr-TR.md) | [🇯🇵](./README.ja-JP.md) | [🇫🇷](./README.fr-FR.md) | [🇵🇹](./README.pt-BR.md) | [🇸🇦](./README.ar-DZ.md) 2 | 3 |

Ant Design Pro

4 | 5 |
6 | 7 | 开箱即用的中台前端/设计解决方案。 8 | 9 | [![Node CI](https://github.com/ant-design/ant-design-pro/actions/workflows/ci.yml/badge.svg)](https://github.com/ant-design/ant-design-pro/actions/workflows/ci.yml) [![Preview Deploy](https://github.com/ant-design/ant-design-pro/actions/workflows/preview-deploy.yml/badge.svg)](https://github.com/ant-design/ant-design-pro/actions/workflows/preview-deploy.yml) [![Build With Umi](https://img.shields.io/badge/build%20with-umi-028fe4.svg?style=flat-square)](http://umijs.org/) ![](https://badgen.net/badge/icon/Ant%20Design?icon=https://gw.alipayobjects.com/zos/antfincdn/Pp4WPgVDB3/KDpgvguMpGfqaHPjicRK.svg&label) 10 | 11 | ![](https://github.com/user-attachments/assets/fde29061-3d9a-4397-8ac2-397b0e033ef5) 12 | 13 |
14 | 15 | - 预览:http://preview.pro.ant.design 16 | - 首页:http://pro.ant.design/index-cn 17 | - 使用文档:http://pro.ant.design/docs/getting-started-cn 18 | - 更新日志: http://pro.ant.design/docs/changelog-cn 19 | - 常见问题:http://pro.ant.design/docs/faq-cn 20 | 21 | ## 5.0 已经发布! 🎉🎉🎉 22 | 23 | [Ant Design Pro 5.0.0](https://github.com/ant-design/ant-design-pro/issues/8656) 24 | 25 | ## 特性 26 | 27 | - :bulb: **TypeScript**: 应用程序级 JavaScript 的语言 28 | - :scroll: **区块**: 通过区块模板快速构建页面 29 | - :gem: **优雅美观**:基于 Ant Design 体系精心设计 30 | - :triangular_ruler: **常见设计模式**:提炼自中后台应用的典型页面和场景 31 | - :rocket: **最新技术栈**:使用 React/umi/dva/antd 等前端前沿技术开发 32 | - :iphone: **响应式**:针对不同屏幕大小设计 33 | - :art: **主题**:可配置的主题满足多样化的品牌诉求 34 | - :globe_with_meridians: **国际化**:内建业界通用的国际化方案 35 | - :gear: **最佳实践**:良好的工程实践助您持续产出高质量代码 36 | - :1234: **Mock 数据**:实用的本地数据调试方案 37 | - :white_check_mark: **UI 测试**:自动化测试保障前端产品质量 38 | 39 | ## 模板 40 | 41 | ``` 42 | - Dashboard 43 | - 分析页 44 | - 监控页 45 | - 工作台 46 | - 表单页 47 | - 基础表单页 48 | - 分步表单页 49 | - 高级表单页 50 | - 列表页 51 | - 查询表格 52 | - 标准列表 53 | - 卡片列表 54 | - 搜索列表(项目/应用/文章) 55 | - 详情页 56 | - 基础详情页 57 | - 高级详情页 58 | - 用户 59 | - 用户中心页 60 | - 用户设置页 61 | - 结果 62 | - 成功页 63 | - 失败页 64 | - 异常 65 | - 403 无权限 66 | - 404 找不到 67 | - 500 服务器出错 68 | - 帐户 69 | - 登录 70 | - 注册 71 | - 注册成功 72 | ``` 73 | 74 | ## 使用 75 | 76 | 我们提供了 pro-cli 来快速的初始化脚手架。 77 | 78 | ```bash 79 | # 使用 npm 80 | npm i @ant-design/pro-cli -g 81 | pro create myapp 82 | ``` 83 | 84 | 选择 umi 的版本 85 | 86 | ```shell 87 | ? 🐂 使用 umi@4 还是 umi@3 ? (Use arrow keys) 88 | ❯ umi@4 89 | umi@3 90 | ``` 91 | 92 | > 如果选择了 umi@4 版本,暂时还不支持全量区块。 93 | 94 | 如果选择了 umi@3,还可以选择 pro 的模板,simple 是基础模板,只提供了框架运行的基本内容,complete 包含所有区块,不太适合当基础模板来进行二次开发 95 | 96 | ```shell 97 | ? 🚀 要全量的还是一个简单的脚手架? (Use arrow keys) 98 | ❯ simple 99 | complete 100 | ``` 101 | 102 | 安装依赖: 103 | 104 | ```shell 105 | $ cd myapp && tyarn 106 | // 或 107 | $ cd myapp && npm install 108 | ``` 109 | 110 | 更多信息请参考 [使用文档](http://pro.ant.design/docs/getting-started)。 111 | 112 | ## 支持环境 113 | 114 | 现代浏览器。 115 | 116 | | [Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | [Opera](http://godban.github.io/browsers-support-badges/)
Opera | 117 | | --- | --- | --- | --- | --- | 118 | | Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions | 119 | 120 | ## 参与贡献 121 | 122 | 我们非常欢迎你的贡献,你可以通过以下方式和我们一起共建 :smiley:: 123 | 124 | - 在你的公司或个人项目中使用 Ant Design Pro。 125 | - 通过 [Issue](http://github.com/ant-design/ant-design-pro/issues) 报告 bug 或进行咨询。 126 | - 提交 [Pull Request](http://github.com/ant-design/ant-design-pro/pulls) 改进 Pro 的代码。 127 | -------------------------------------------------------------------------------- /config/config.ts: -------------------------------------------------------------------------------- 1 | // https://umijs.org/config/ 2 | import { defineConfig } from '@umijs/max'; 3 | import { join } from 'path'; 4 | import defaultSettings from './defaultSettings'; 5 | import proxy from './proxy'; 6 | import routes from './routes'; 7 | 8 | const { REACT_APP_ENV = 'dev' } = process.env; 9 | 10 | /** 11 | * @name 使用公共路径 12 | * @description 部署时的路径,如果部署在非根目录下,需要配置这个变量 13 | * @doc https://umijs.org/docs/api/config#publicpath 14 | */ 15 | const PUBLIC_PATH: string = '/'; 16 | 17 | export default defineConfig({ 18 | /** 19 | * @name 开启 hash 模式 20 | * @description 让 build 之后的产物包含 hash 后缀。通常用于增量发布和避免浏览器加载缓存。 21 | * @doc https://umijs.org/docs/api/config#hash 22 | */ 23 | hash: true, 24 | 25 | publicPath: PUBLIC_PATH, 26 | 27 | /** 28 | * @name 兼容性设置 29 | * @description 设置 ie11 不一定完美兼容,需要检查自己使用的所有依赖 30 | * @doc https://umijs.org/docs/api/config#targets 31 | */ 32 | // targets: { 33 | // ie: 11, 34 | // }, 35 | /** 36 | * @name 路由的配置,不在路由中引入的文件不会编译 37 | * @description 只支持 path,component,routes,redirect,wrappers,title 的配置 38 | * @doc https://umijs.org/docs/guides/routes 39 | */ 40 | // umi routes: https://umijs.org/docs/routing 41 | routes, 42 | /** 43 | * @name 主题的配置 44 | * @description 虽然叫主题,但是其实只是 less 的变量设置 45 | * @doc antd的主题设置 https://ant.design/docs/react/customize-theme-cn 46 | * @doc umi 的theme 配置 https://umijs.org/docs/api/config#theme 47 | */ 48 | theme: { 49 | // 如果不想要 configProvide 动态设置主题需要把这个设置为 default 50 | // 只有设置为 variable, 才能使用 configProvide 动态设置主色调 51 | 'root-entry-name': 'variable', 52 | }, 53 | /** 54 | * @name moment 的国际化配置 55 | * @description 如果对国际化没有要求,打开之后能减少js的包大小 56 | * @doc https://umijs.org/docs/api/config#ignoremomentlocale 57 | */ 58 | ignoreMomentLocale: true, 59 | /** 60 | * @name 代理配置 61 | * @description 可以让你的本地服务器代理到你的服务器上,这样你就可以访问服务器的数据了 62 | * @see 要注意以下 代理只能在本地开发时使用,build 之后就无法使用了。 63 | * @doc 代理介绍 https://umijs.org/docs/guides/proxy 64 | * @doc 代理配置 https://umijs.org/docs/api/config#proxy 65 | */ 66 | proxy: proxy[REACT_APP_ENV as keyof typeof proxy], 67 | /** 68 | * @name 快速热更新配置 69 | * @description 一个不错的热更新组件,更新时可以保留 state 70 | */ 71 | fastRefresh: true, 72 | //============== 以下都是max的插件配置 =============== 73 | /** 74 | * @name 数据流插件 75 | * @@doc https://umijs.org/docs/max/data-flow 76 | */ 77 | model: {}, 78 | /** 79 | * 一个全局的初始数据流,可以用它在插件之间共享数据 80 | * @description 可以用来存放一些全局的数据,比如用户信息,或者一些全局的状态,全局初始状态在整个 Umi 项目的最开始创建。 81 | * @doc https://umijs.org/docs/max/data-flow#%E5%85%A8%E5%B1%80%E5%88%9D%E5%A7%8B%E7%8A%B6%E6%80%81 82 | */ 83 | initialState: {}, 84 | /** 85 | * @name layout 插件 86 | * @doc https://umijs.org/docs/max/layout-menu 87 | */ 88 | title: 'Ant Design Pro', 89 | layout: { 90 | locale: true, 91 | ...defaultSettings, 92 | }, 93 | /** 94 | * @name moment2dayjs 插件 95 | * @description 将项目中的 moment 替换为 dayjs 96 | * @doc https://umijs.org/docs/max/moment2dayjs 97 | */ 98 | moment2dayjs: { 99 | preset: 'antd', 100 | plugins: ['duration'], 101 | }, 102 | /** 103 | * @name 国际化插件 104 | * @doc https://umijs.org/docs/max/i18n 105 | */ 106 | locale: { 107 | // default zh-CN 108 | default: 'zh-CN', 109 | antd: true, 110 | // default true, when it is true, will use `navigator.language` overwrite default 111 | baseNavigator: true, 112 | }, 113 | /** 114 | * @name antd 插件 115 | * @description 内置了 babel import 插件 116 | * @doc https://umijs.org/docs/max/antd#antd 117 | */ 118 | antd: {}, 119 | /** 120 | * @name 网络请求配置 121 | * @description 它基于 axios 和 ahooks 的 useRequest 提供了一套统一的网络请求和错误处理方案。 122 | * @doc https://umijs.org/docs/max/request 123 | */ 124 | request: {}, 125 | /** 126 | * @name 权限插件 127 | * @description 基于 initialState 的权限插件,必须先打开 initialState 128 | * @doc https://umijs.org/docs/max/access 129 | */ 130 | access: {}, 131 | /** 132 | * @name 中额外的 script 133 | * @description 配置 中额外的 script 134 | */ 135 | headScripts: [ 136 | // 解决首次加载时白屏的问题 137 | { src: join(PUBLIC_PATH, 'scripts/loading.js'), async: true }, 138 | ], 139 | //================ pro 插件配置 ================= 140 | presets: ['umi-presets-pro'], 141 | /** 142 | * @name openAPI 插件的配置 143 | * @description 基于 openapi 的规范生成serve 和mock,能减少很多样板代码 144 | * @doc https://pro.ant.design/zh-cn/docs/openapi/ 145 | */ 146 | openAPI: [ 147 | { 148 | requestLibPath: "import { request } from '@umijs/max'", 149 | // 或者使用在线的版本 150 | // schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json" 151 | schemaPath: join(__dirname, 'oneapi.json'), 152 | mock: false, 153 | }, 154 | { 155 | requestLibPath: "import { request } from '@umijs/max'", 156 | schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json', 157 | projectName: 'swagger', 158 | }, 159 | ], 160 | /** 161 | * @name 是否开启 mako 162 | * @description 使用 mako 极速研发 163 | * @doc https://umijs.org/docs/api/config#mako 164 | */ 165 | mako: {}, 166 | esbuildMinifyIIFE: true, 167 | requestRecord: {}, 168 | }); 169 | -------------------------------------------------------------------------------- /config/defaultSettings.ts: -------------------------------------------------------------------------------- 1 | import type { ProLayoutProps } from '@ant-design/pro-components'; 2 | 3 | /** 4 | * @name 5 | */ 6 | const Settings: ProLayoutProps & { 7 | pwa?: boolean; 8 | logo?: string; 9 | } = { 10 | navTheme: 'light', 11 | // 拂晓蓝 12 | colorPrimary: '#1890ff', 13 | layout: 'mix', 14 | contentWidth: 'Fluid', 15 | fixedHeader: false, 16 | fixSiderbar: true, 17 | colorWeak: false, 18 | title: 'Ant Design Pro', 19 | pwa: true, 20 | logo: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg', 21 | iconfontUrl: '', 22 | token: { 23 | // 参见ts声明,demo 见文档,通过token 修改样式 24 | //https://procomponents.ant.design/components/layout#%E9%80%9A%E8%BF%87-token-%E4%BF%AE%E6%94%B9%E6%A0%B7%E5%BC%8F 25 | }, 26 | }; 27 | 28 | export default Settings; 29 | -------------------------------------------------------------------------------- /config/proxy.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @name 代理的配置 3 | * @see 在生产环境 代理是无法生效的,所以这里没有生产环境的配置 4 | * ------------------------------- 5 | * The agent cannot take effect in the production environment 6 | * so there is no configuration of the production environment 7 | * For details, please see 8 | * https://pro.ant.design/docs/deploy 9 | * 10 | * @doc https://umijs.org/docs/guides/proxy 11 | */ 12 | export default { 13 | // 如果需要自定义本地开发服务器 请取消注释按需调整 14 | // dev: { 15 | // // localhost:8000/api/** -> https://preview.pro.ant.design/api/** 16 | // '/api/': { 17 | // // 要代理的地址 18 | // target: 'https://preview.pro.ant.design', 19 | // // 配置了这个可以从 http 代理到 https 20 | // // 依赖 origin 的功能可能需要这个,比如 cookie 21 | // changeOrigin: true, 22 | // }, 23 | // }, 24 | /** 25 | * @name 详细的代理配置 26 | * @doc https://github.com/chimurai/http-proxy-middleware 27 | */ 28 | test: { 29 | // localhost:8000/api/** -> https://preview.pro.ant.design/api/** 30 | '/api/': { 31 | target: 'https://proapi.azurewebsites.net', 32 | changeOrigin: true, 33 | pathRewrite: { '^': '' }, 34 | }, 35 | }, 36 | pre: { 37 | '/api/': { 38 | target: 'your pre url', 39 | changeOrigin: true, 40 | pathRewrite: { '^': '' }, 41 | }, 42 | }, 43 | }; 44 | -------------------------------------------------------------------------------- /config/routes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @name umi 的路由配置 3 | * @description 只支持 path,component,routes,redirect,wrappers,name,icon 的配置 4 | * @param path path 只支持两种占位符配置,第一种是动态参数 :id 的形式,第二种是 * 通配符,通配符只能出现路由字符串的最后。 5 | * @param component 配置 location 和 path 匹配后用于渲染的 React 组件路径。可以是绝对路径,也可以是相对路径,如果是相对路径,会从 src/pages 开始找起。 6 | * @param routes 配置子路由,通常在需要为多个路径增加 layout 组件时使用。 7 | * @param redirect 配置路由跳转 8 | * @param wrappers 配置路由组件的包装组件,通过包装组件可以为当前的路由组件组合进更多的功能。 比如,可以用于路由级别的权限校验 9 | * @param name 配置路由的标题,默认读取国际化文件 menu.ts 中 menu.xxxx 的值,如配置 name 为 login,则读取 menu.ts 中 menu.login 的取值作为标题 10 | * @param icon 配置路由的图标,取值参考 https://ant.design/components/icon-cn, 注意去除风格后缀和大小写,如想要配置图标为 则取值应为 stepBackward 或 StepBackward,如想要配置图标为 则取值应为 user 或者 User 11 | * @doc https://umijs.org/docs/guides/routes 12 | */ 13 | export default [ 14 | { 15 | path: '/user', 16 | layout: false, 17 | routes: [ 18 | { 19 | name: 'login', 20 | path: '/user/login', 21 | component: './User/Login', 22 | }, 23 | ], 24 | }, 25 | { 26 | path: '/welcome', 27 | name: 'welcome', 28 | icon: 'smile', 29 | component: './Welcome', 30 | }, 31 | { 32 | path: '/admin', 33 | name: 'admin', 34 | icon: 'crown', 35 | access: 'canAdmin', 36 | routes: [ 37 | { 38 | path: '/admin', 39 | redirect: '/admin/sub-page', 40 | }, 41 | { 42 | path: '/admin/sub-page', 43 | name: 'sub-page', 44 | component: './Admin', 45 | }, 46 | ], 47 | }, 48 | { 49 | name: 'list.table-list', 50 | icon: 'table', 51 | path: '/list', 52 | component: './TableList', 53 | }, 54 | { 55 | path: '/', 56 | redirect: '/welcome', 57 | }, 58 | { 59 | path: '*', 60 | layout: false, 61 | component: './404', 62 | }, 63 | ]; 64 | -------------------------------------------------------------------------------- /jest.config.ts: -------------------------------------------------------------------------------- 1 | import { configUmiAlias, createConfig } from '@umijs/max/test'; 2 | 3 | export default async () => { 4 | const config = await configUmiAlias({ 5 | ...createConfig({ 6 | target: 'browser', 7 | }), 8 | }); 9 | return { 10 | ...config, 11 | testEnvironmentOptions: { 12 | ...(config?.testEnvironmentOptions || {}), 13 | url: 'http://localhost:8000', 14 | }, 15 | setupFiles: [...(config.setupFiles || []), './tests/setupTests.jsx'], 16 | globals: { 17 | ...config.globals, 18 | localStorage: null, 19 | }, 20 | }; 21 | }; 22 | -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "jsx": "react-jsx", 4 | "emitDecoratorMetadata": true, 5 | "experimentalDecorators": true, 6 | "baseUrl": ".", 7 | "paths": { 8 | "@/*": ["./src/*"] 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /mock/notices.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response } from 'express'; 2 | 3 | const getNotices = (req: Request, res: Response) => { 4 | res.json({ 5 | data: [ 6 | { 7 | id: '000000001', 8 | avatar: 9 | 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/MSbDR4FR2MUAAAAAAAAAAAAAFl94AQBr', 10 | title: '你收到了 14 份新周报', 11 | datetime: '2017-08-09', 12 | type: 'notification', 13 | }, 14 | { 15 | id: '000000002', 16 | avatar: 17 | 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/hX-PTavYIq4AAAAAAAAAAAAAFl94AQBr', 18 | title: '你推荐的 曲妮妮 已通过第三轮面试', 19 | datetime: '2017-08-08', 20 | type: 'notification', 21 | }, 22 | { 23 | id: '000000003', 24 | avatar: 25 | 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/jHX5R5l3QjQAAAAAAAAAAAAAFl94AQBr', 26 | title: '这种模板可以区分多种通知类型', 27 | datetime: '2017-08-07', 28 | read: true, 29 | type: 'notification', 30 | }, 31 | { 32 | id: '000000004', 33 | avatar: 34 | 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/Wr4mQqx6jfwAAAAAAAAAAAAAFl94AQBr', 35 | title: '左侧图标用于区分不同的类型', 36 | datetime: '2017-08-07', 37 | type: 'notification', 38 | }, 39 | { 40 | id: '000000005', 41 | avatar: 42 | 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/Mzj_TbcWUj4AAAAAAAAAAAAAFl94AQBr', 43 | title: '内容不要超过两行字,超出时自动截断', 44 | datetime: '2017-08-07', 45 | type: 'notification', 46 | }, 47 | { 48 | id: '000000006', 49 | avatar: 50 | 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/eXLzRbPqQE4AAAAAAAAAAAAAFl94AQBr', 51 | title: '曲丽丽 评论了你', 52 | description: '描述信息描述信息描述信息', 53 | datetime: '2017-08-07', 54 | type: 'message', 55 | clickClose: true, 56 | }, 57 | { 58 | id: '000000007', 59 | avatar: 60 | 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/w5mRQY2AmEEAAAAAAAAAAAAAFl94AQBr', 61 | title: '朱偏右 回复了你', 62 | description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', 63 | datetime: '2017-08-07', 64 | type: 'message', 65 | clickClose: true, 66 | }, 67 | { 68 | id: '000000008', 69 | avatar: 70 | 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/wPadR5M9918AAAAAAAAAAAAAFl94AQBr', 71 | title: '标题', 72 | description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', 73 | datetime: '2017-08-07', 74 | type: 'message', 75 | clickClose: true, 76 | }, 77 | { 78 | id: '000000009', 79 | title: '任务名称', 80 | description: '任务需要在 2017-01-12 20:00 前启动', 81 | extra: '未开始', 82 | status: 'todo', 83 | type: 'event', 84 | }, 85 | { 86 | id: '000000010', 87 | title: '第三方紧急代码变更', 88 | description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', 89 | extra: '马上到期', 90 | status: 'urgent', 91 | type: 'event', 92 | }, 93 | { 94 | id: '000000011', 95 | title: '信息安全考试', 96 | description: '指派竹尔于 2017-01-09 前完成更新并发布', 97 | extra: '已耗时 8 天', 98 | status: 'doing', 99 | type: 'event', 100 | }, 101 | { 102 | id: '000000012', 103 | title: 'ABCD 版本发布', 104 | description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', 105 | extra: '进行中', 106 | status: 'processing', 107 | type: 'event', 108 | }, 109 | ], 110 | }); 111 | }; 112 | 113 | export default { 114 | 'GET /api/notices': getNotices, 115 | }; 116 | -------------------------------------------------------------------------------- /mock/route.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | '/api/auth_routes': { 3 | '/form/advanced-form': { authority: ['admin', 'user'] }, 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ant-design-pro", 3 | "version": "6.0.0", 4 | "private": true, 5 | "description": "An out-of-box UI solution for enterprise applications", 6 | "repository": "git@github.com:ant-design/ant-design-pro.git", 7 | "scripts": { 8 | "analyze": "cross-env ANALYZE=1 max build", 9 | "build": "max build", 10 | "deploy": "npm run build && npm run gh-pages", 11 | "dev": "npm run start:dev", 12 | "gh-pages": "gh-pages -d dist", 13 | "i18n-remove": "pro i18n-remove --locale=zh-CN --write", 14 | "postinstall": "max setup", 15 | "jest": "jest", 16 | "lint": "npm run lint:js && npm run lint:prettier && npm run tsc", 17 | "lint-staged": "lint-staged", 18 | "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ", 19 | "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ", 20 | "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src", 21 | "lint:prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto", 22 | "openapi": "max openapi", 23 | "prepare": "husky", 24 | "prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"", 25 | "preview": "npm run build && max preview --port 8000", 26 | "record": "cross-env NODE_ENV=development REACT_APP_ENV=test max record --scene=login", 27 | "serve": "umi-serve", 28 | "start": "cross-env UMI_ENV=dev max dev", 29 | "start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev max dev", 30 | "start:no-mock": "cross-env MOCK=none UMI_ENV=dev max dev", 31 | "start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev max dev", 32 | "start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev max dev", 33 | "test": "jest", 34 | "test:coverage": "npm run jest -- --coverage", 35 | "test:update": "npm run jest -- -u", 36 | "tsc": "tsc --noEmit" 37 | }, 38 | "browserslist": [ 39 | "defaults" 40 | ], 41 | "dependencies": { 42 | "@ant-design/icons": "^4.8.3", 43 | "@ant-design/pro-components": "^2.7.19", 44 | "antd": "^5.21.2", 45 | "antd-style": "^3.7.0", 46 | "classnames": "^2.5.1", 47 | "dayjs": "^1.11.13", 48 | "querystring": "^0.2.1", 49 | "react": "^18.3.1", 50 | "react-dom": "^18.3.1" 51 | }, 52 | "devDependencies": { 53 | "@ant-design/pro-cli": "^3.3.0", 54 | "@commitlint/cli": "^19.5.0", 55 | "@commitlint/config-conventional": "^19.5.0", 56 | "@testing-library/dom": "^10.4.0", 57 | "@testing-library/react": "^16.0.1", 58 | "@types/classnames": "^2.3.1", 59 | "@types/express": "^4.17.21", 60 | "@types/history": "^5.0.0", 61 | "@types/jest": "^29.5.13", 62 | "@types/lodash": "^4.17.10", 63 | "@types/react": "^18.3.11", 64 | "@types/react-dom": "^18.3.0", 65 | "@types/react-helmet": "^6.1.11", 66 | "@umijs/lint": "^4.3.24", 67 | "@umijs/max": "^4.3.24", 68 | "cross-env": "^7.0.3", 69 | "eslint": "^8.57.1", 70 | "express": "^4.21.1", 71 | "gh-pages": "^6.1.1", 72 | "husky": "^9.1.6", 73 | "jest": "^29.7.0", 74 | "jest-environment-jsdom": "^29.7.0", 75 | "lint-staged": "^15.2.10", 76 | "mockjs": "^1.1.0", 77 | "prettier": "^3.3.3", 78 | "ts-node": "^10.9.2", 79 | "typescript": "^5.6.3", 80 | "umi-presets-pro": "^2.0.3", 81 | "umi-serve": "^1.9.11" 82 | }, 83 | "engines": { 84 | "node": ">=12.0.0" 85 | }, 86 | "create-umi": { 87 | "ignoreScript": [ 88 | "docker*", 89 | "functions*", 90 | "site", 91 | "generateMock" 92 | ], 93 | "ignoreDependencies": [ 94 | "netlify*", 95 | "serverless" 96 | ], 97 | "ignore": [ 98 | ".dockerignore", 99 | ".git", 100 | ".github", 101 | ".gitpod.yml", 102 | "CODE_OF_CONDUCT.md", 103 | "Dockerfile", 104 | "Dockerfile.*", 105 | "lambda", 106 | "LICENSE", 107 | "netlify.toml", 108 | "README.*.md", 109 | "azure-pipelines.yml", 110 | "docker", 111 | "CNAME", 112 | "create-umi" 113 | ] 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /public/CNAME: -------------------------------------------------------------------------------- 1 | preview.pro.ant.design -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ant-design/ant-design-pro/aed948121ce734fb8ad0acb7f8677c9288a70c6c/public/favicon.ico -------------------------------------------------------------------------------- /public/icons/icon-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ant-design/ant-design-pro/aed948121ce734fb8ad0acb7f8677c9288a70c6c/public/icons/icon-128x128.png -------------------------------------------------------------------------------- /public/icons/icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ant-design/ant-design-pro/aed948121ce734fb8ad0acb7f8677c9288a70c6c/public/icons/icon-192x192.png -------------------------------------------------------------------------------- /public/icons/icon-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ant-design/ant-design-pro/aed948121ce734fb8ad0acb7f8677c9288a70c6c/public/icons/icon-512x512.png -------------------------------------------------------------------------------- /public/logo.svg: -------------------------------------------------------------------------------- 1 | Group 28 Copy 5Created with Sketch. -------------------------------------------------------------------------------- /public/pro_icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/access.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @see https://umijs.org/docs/max/access#access 3 | * */ 4 | export default function access(initialState: { currentUser?: API.CurrentUser } | undefined) { 5 | const { currentUser } = initialState ?? {}; 6 | return { 7 | canAdmin: currentUser && currentUser.access === 'admin', 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /src/app.tsx: -------------------------------------------------------------------------------- 1 | import { AvatarDropdown, AvatarName, Footer, Question, SelectLang } from '@/components'; 2 | import { currentUser as queryCurrentUser } from '@/services/ant-design-pro/api'; 3 | import { LinkOutlined } from '@ant-design/icons'; 4 | import type { Settings as LayoutSettings } from '@ant-design/pro-components'; 5 | import { SettingDrawer } from '@ant-design/pro-components'; 6 | import type { RunTimeLayoutConfig } from '@umijs/max'; 7 | import { history, Link } from '@umijs/max'; 8 | import React from 'react'; 9 | import defaultSettings from '../config/defaultSettings'; 10 | import { errorConfig } from './requestErrorConfig'; 11 | 12 | const isDev = process.env.NODE_ENV === 'development'; 13 | const loginPath = '/user/login'; 14 | 15 | /** 16 | * @see https://umijs.org/zh-CN/plugins/plugin-initial-state 17 | * */ 18 | export async function getInitialState(): Promise<{ 19 | settings?: Partial; 20 | currentUser?: API.CurrentUser; 21 | loading?: boolean; 22 | fetchUserInfo?: () => Promise; 23 | }> { 24 | const fetchUserInfo = async () => { 25 | try { 26 | const msg = await queryCurrentUser({ 27 | skipErrorHandler: true, 28 | }); 29 | return msg.data; 30 | } catch (error) { 31 | history.push(loginPath); 32 | } 33 | return undefined; 34 | }; 35 | // 如果不是登录页面,执行 36 | const { location } = history; 37 | if (location.pathname !== loginPath) { 38 | const currentUser = await fetchUserInfo(); 39 | return { 40 | fetchUserInfo, 41 | currentUser, 42 | settings: defaultSettings as Partial, 43 | }; 44 | } 45 | return { 46 | fetchUserInfo, 47 | settings: defaultSettings as Partial, 48 | }; 49 | } 50 | 51 | // ProLayout 支持的api https://procomponents.ant.design/components/layout 52 | export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) => { 53 | return { 54 | actionsRender: () => [, ], 55 | avatarProps: { 56 | src: initialState?.currentUser?.avatar, 57 | title: , 58 | render: (_, avatarChildren) => { 59 | return {avatarChildren}; 60 | }, 61 | }, 62 | waterMarkProps: { 63 | content: initialState?.currentUser?.name, 64 | }, 65 | footerRender: () =>