Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: react-component/menu
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v9.5.3
Choose a base ref
...
head repository: react-component/menu
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 4,059 additions and 2,593 deletions.
  1. +24 −0 .dumirc.ts
  2. +8 −5 .eslintrc.js
  3. +5 −9 .fatherrc.js
  4. +15 −0 .github/FUNDING.yml
  5. +28 −0 .github/dependabot.yml
  6. +41 −0 .github/workflows/codeql.yml
  7. +5 −113 .github/workflows/main.yml
  8. +7 −4 .gitignore
  9. +1 −0 .husky/pre-commit
  10. +2 −0 .prettierrc
  11. +0 −19 .umirc.ts
  12. +36 −2 README.md
  13. +13 −1 assets/index.less
  14. +2 −0 bunfig.toml
  15. +1 −1 docs/demo/antd-switch.md
  16. +1 −1 docs/demo/antd.md
  17. +1 −1 docs/demo/custom-icon.md
  18. +3 −0 docs/demo/customPopupRender.md
  19. +1 −1 docs/demo/debug.md
  20. +1 −1 docs/demo/fragment.md
  21. +1 −1 docs/demo/inlineCollapsed.md
  22. +3 −0 docs/demo/items-ref.md
  23. +1 −1 docs/demo/items.md
  24. +1 −1 docs/demo/keyPath.md
  25. +1 −1 docs/demo/menuItemGroup.md
  26. +1 −1 docs/demo/multiple.md
  27. +1 −1 docs/demo/openKeys.md
  28. +1 −1 docs/demo/rtl-antd.md
  29. +1 −1 docs/demo/scrollable.md
  30. +1 −1 docs/demo/selectedKeys.md
  31. +1 −1 docs/demo/single.md
  32. +12 −38 docs/examples/antd.tsx
  33. +76 −0 docs/examples/customPopupRender.less
  34. +164 −0 docs/examples/customPopupRender.tsx
  35. +10 −5 docs/examples/debug.tsx
  36. +1 −1 docs/examples/fragment.tsx
  37. +24 −10 docs/examples/inlineCollapsed.tsx
  38. +100 −0 docs/examples/items-ref.tsx
  39. +1 −0 docs/examples/items.tsx
  40. +1 −1 docs/examples/keyPath.tsx
  41. +6 −2 docs/examples/menuItemGroup.tsx
  42. +1 −1 docs/examples/multiple.tsx
  43. +1 −1 docs/examples/openKeys.tsx
  44. +18 −36 docs/examples/rtl-antd.tsx
  45. +1 −1 docs/examples/scrollable.tsx
  46. +9 −3 docs/examples/selectedKeys.tsx
  47. +50 −63 docs/examples/single.tsx
  48. +2 −2 jest.config.js
  49. +57 −49 package.json
  50. +2 −5 src/Divider.tsx
  51. +5 −1 src/Icon.tsx
  52. +175 −118 src/Menu.tsx
  53. +34 −25 src/MenuItem.tsx
  54. +32 −27 src/MenuItemGroup.tsx
  55. +5 −19 src/SubMenu/InlineSubMenuList.tsx
  56. +22 −9 src/SubMenu/PopupTrigger.tsx
  57. +8 −5 src/SubMenu/SubMenuList.tsx
  58. +99 −61 src/SubMenu/index.tsx
  59. +0 −3 src/context/IdContext.ts
  60. +14 −14 src/context/MenuContext.tsx
  61. +43 −100 src/hooks/useAccessibility.ts
  62. +7 −7 src/hooks/useKeyRecords.ts
  63. +0 −23 src/hooks/useUUID.ts
  64. +15 −10 src/index.ts
  65. +29 −10 src/interface.ts
  66. +32 −8 src/placements.ts
  67. +27 −0 src/utils/commonUtil.ts
  68. +1 −1 src/utils/motionUtil.ts
  69. +41 −45 src/utils/nodeUtil.tsx
  70. +2 −5 src/utils/warnUtil.ts
  71. +0 −273 tests/Collapsed.spec.js
  72. +342 −0 tests/Collapsed.spec.tsx
  73. +190 −0 tests/Focus.spec.tsx
  74. +88 −110 tests/Keyboard.spec.tsx
  75. +0 −676 tests/Menu.spec.js
  76. +863 −0 tests/Menu.spec.tsx
  77. +85 −31 tests/{MenuItem.spec.js → MenuItem.spec.tsx}
  78. +3 −3 tests/Options.spec.tsx
  79. +8 −12 tests/{Private.spec.js → Private.spec.tsx}
  80. +59 −0 tests/React18.spec.tsx
  81. +121 −40 tests/Responsive.spec.tsx
  82. +0 −443 tests/SubMenu.spec.js
  83. +487 −0 tests/SubMenu.spec.tsx
  84. +3 −0 tests/__mocks__/@rc-component/trigger.js
  85. +0 −3 tests/__mocks__/rc-trigger.js
  86. +9 −4 tests/__snapshots__/Keyboard.spec.tsx.snap
  87. +101 −59 tests/__snapshots__/{Menu.spec.js.snap → Menu.spec.tsx.snap}
  88. +64 −11 tests/__snapshots__/{MenuItem.spec.js.snap → MenuItem.spec.tsx.snap}
  89. +11 −6 tests/__snapshots__/Options.spec.tsx.snap
  90. +10 −6 tests/__snapshots__/Responsive.spec.tsx.snap
  91. +130 −0 tests/__snapshots__/SubMenu.spec.tsx.snap
  92. +57 −0 tests/popupRender.test.tsx
  93. +78 −0 tests/semantic.spec.tsx
  94. +0 −23 tests/setup.js
  95. +1 −0 tests/setupFilesAfterEnv.ts
  96. +11 −13 tests/util.ts
  97. +3 −3 tsconfig.json
24 changes: 24 additions & 0 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// more config: https://d.umijs.org/config
import { defineConfig } from 'dumi';

export default defineConfig({
themeConfig: {
name: 'rc-menu',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
nav: [
{ title: 'Demo', link: '/demo/antd'}
],
},
favicons:
['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
outputPath: '.doc',
exportStatic: {},
mfsu: {},
styles: [
`
.markdown table {
width: auto !important;
}
`,
]
});
13 changes: 8 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const base = require('@umijs/fabric/dist/eslint');

module.exports = {
...base,
extends: [require.resolve('@umijs/fabric/dist/eslint')],
rules: {
...base.rules,
'import/no-extraneous-dependencies': 0,
'import/no-named-as-default': 0,
'no-template-curly-in-string': 0,
@@ -15,6 +12,12 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 0,
'jsx-a11y/label-has-associated-control': 0,
'jsx-a11y/label-has-for': 0,
'@typescript-eslint/no-empty-interface': "off",
'@typescript-eslint/no-empty-interface': 0,
'@typescript-eslint/consistent-indexed-object-style': 0,
'@typescript-eslint/switch-exhaustiveness-check': 0,
'@typescript-eslint/no-parameter-properties': 0,
'@typescript-eslint/no-throw-literal': 0,
'@typescript-eslint/type-annotation-spacing': 0,
'@typescript-eslint/ban-types': 0,
},
};
14 changes: 5 additions & 9 deletions .fatherrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
export default {
cjs: 'babel',
esm: { type: 'babel', importLibToEs: true },
preCommit: {
eslint: true,
prettier: true,
},
runtimeHelpers: true,
};
import { defineConfig } from 'father';

export default defineConfig({
plugins: ['@rc-component/father-plugin'],
});
15 changes: 15 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# These are supported funding model platforms

github: ant-design # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: ant-design # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
thanks_dev: # Replace with a single thanks.dev username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
28 changes: 28 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "21:00"
open-pull-requests-limit: 10
ignore:
- dependency-name: "@types/react-dom"
versions:
- 17.0.0
- 17.0.1
- 17.0.2
- dependency-name: "@types/react"
versions:
- 17.0.0
- 17.0.1
- 17.0.2
- 17.0.3
- dependency-name: np
versions:
- 7.2.0
- 7.3.0
- 7.4.0
- dependency-name: less
versions:
- 4.1.0
41 changes: 41 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: "12 22 * * 6"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ javascript ]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"
118 changes: 5 additions & 113 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,114 +1,6 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

name: ✅ test
on: [push, pull_request]
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master

- uses: actions/setup-node@v1
with:
node-version: '12'

- name: cache package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}

- name: create package-lock.json
run: npm i --package-lock-only

- name: hack for singe file
run: |
if [ ! -d "package-temp-dir" ]; then
mkdir package-temp-dir
fi
cp package-lock.json package-temp-dir
- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

- name: install
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
run: npm ci

lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master

- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}

- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

- name: lint
run: npm run lint

needs: setup

compile:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master

- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}

- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

- name: compile
run: npm run compile

needs: setup

coverage:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master

- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}

- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

- name: coverage
run: npm run coverage && bash <(curl -s https://codecov.io/bash)

needs: setup
test:
uses: react-component/rc-test/.github/workflows/test.yml@main
secrets: inherit
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -29,10 +29,13 @@ es
coverage
yarn.lock
package-lock.json
pnpm-lock.yaml
.vscode

# umi
.umi
.umi-production
.umi-test
.env.local
.dumi/tmp
.dumi/tmp-test
.dumi/tmp-production
.env.local

bun.lockb
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lint-staged
2 changes: 2 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"printWidth": 100,
"proseWrap": "never",
"trailingComma": "all",
"arrowParens": "avoid"
}
19 changes: 0 additions & 19 deletions .umirc.ts

This file was deleted.

Loading