diff --git a/.fatherrc.js b/.fatherrc.js index f6810f73b..96268ae1e 100644 --- a/.fatherrc.js +++ b/.fatherrc.js @@ -1,9 +1,5 @@ -export default { - cjs: 'babel', - esm: { type: 'babel', importLibToEs: true }, - preCommit: { - eslint: true, - prettier: false, - }, - runtimeHelpers: true, -}; +import { defineConfig } from 'father'; + +export default defineConfig({ + plugins: ['@rc-component/father-plugin'], +}); diff --git a/.github/dependabot.yml b/.github/dependabot.yml index afd4cd080..437d0bd3b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -18,14 +18,12 @@ updates: - 17.0.0 - 17.0.1 - 17.0.2 - - dependency-name: np + - dependency-name: '@rc-component/np' versions: - - 7.2.0 - - 7.3.0 - - 7.4.0 - - dependency-name: rc-tooltip + - 1.0.0 + - dependency-name: '@rc-component/tooltip' versions: - - 5.0.2 + - 1.0.0 - dependency-name: less versions: - - 4.1.0 + - 4.1.0 \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4edf95f7..f860ff107 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,113 +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 test -- --coverage && bash <(curl -s https://codecov.io/bash) - - needs: setup \ No newline at end of file + test: + uses: react-component/rc-test/.github/workflows/test.yml@main + secrets: inherit diff --git a/.gitignore b/.gitignore index 99bee95bb..05da2c692 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .storybook +.vscode *.iml *.log .doc/ @@ -21,6 +22,7 @@ coverage/ *.pyc *.pyo package-lock.json +pnpm-lock.yaml .build node_modules .cache @@ -37,3 +39,5 @@ es/ .umi-production .umi-test .env.local + +.dumi/ \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 000000000..af5adff9d --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +lint-staged \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 000000000..c2e0187bd --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +node-options="--openssl-legacy-provider" \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index ecb24d331..214377229 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,7 @@ +.doc +.storybook +es +lib **/*.svg **/*.ejs **/*.html diff --git a/.prettierrc b/.prettierrc index 7f12e041e..b04278194 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,6 +4,7 @@ "singleQuote": true, "tabWidth": 2, "trailingComma": "all", + "proseWrap": "never", "printWidth": 100, "arrowParens": "avoid" } diff --git a/.umirc.ts b/.umirc.ts index 2ec33e439..f734dd5c1 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -2,18 +2,7 @@ import { defineConfig } from 'dumi'; export default defineConfig({ - title: 'rc-tree', - favicon: - 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', - logo: - 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', - outputPath: '.doc', - exportStatic: {}, - styles: [ - ` - .markdown table { - width: auto !important; - } - `, - ] + themeConfig: { + name: 'Tree', + }, }); diff --git a/README.md b/README.md index 57ad6046a..d56dd7509 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,19 @@ Tree component. -[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Test coverage][codecov-image]][codecov-url] [![Dependencies][david-image]][david-url] [![DevDependencies][david-dev-image]][david-dev-url] [![npm download][download-image]][download-url] [![bundle size][bundlephobia-image]][bundlephobia-url] +[![NPM version][npm-image]][npm-url] +[![npm download][download-image]][download-url] +[![build status][github-actions-image]][github-actions-url] +[![Codecov][codecov-image]][codecov-url] +[![bundle size][bundlephobia-image]][bundlephobia-url] +[![dumi][dumi-image]][dumi-url] [npm-image]: http://img.shields.io/npm/v/rc-tree.svg?style=flat-square [npm-url]: http://npmjs.org/package/rc-tree -[github-actions-image]: https://github.com/react-component/tree/workflows/CI/badge.svg -[github-actions-url]: https://github.com/react-component/tree/actions +[github-actions-image]: https://github.com/react-component/tree/actions/workflows/main.yml/badge.svg +[github-actions-url]: https://github.com/react-component/tree/actions/workflows/main.yml [codecov-image]: https://img.shields.io/codecov/c/github/react-component/tree/master.svg?style=flat-square -[codecov-url]: https://codecov.io/gh/react-component/tree/branch/master +[codecov-url]: https://codecov.io/gh/react-component/tree/ [david-url]: https://david-dm.org/react-component/tree [david-image]: https://david-dm.org/react-component/tree/status.svg?style=flat-square [david-dev-url]: https://david-dm.org/react-component/tree?type=dev @@ -18,6 +23,8 @@ Tree component. [download-url]: https://npmjs.org/package/rc-tree [bundlephobia-url]: https://bundlephobia.com/result?p=rc-tree [bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-tree +[dumi-url]: https://github.com/umijs/dumi +[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square ## Screenshots diff --git a/docs/demo/animation-draggable.md b/docs/demo/animation-draggable.md index 4f7bf4f3e..cd51870e3 100644 --- a/docs/demo/animation-draggable.md +++ b/docs/demo/animation-draggable.md @@ -1,3 +1,8 @@ -## animation-draggable +--- +title: Animation Draggable +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/animation.md b/docs/demo/animation.md index ff20eb94c..431fe072f 100644 --- a/docs/demo/animation.md +++ b/docs/demo/animation.md @@ -1,3 +1,8 @@ -## animation +--- +title: Animation +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/basic-controlled.md b/docs/demo/basic-controlled.md index 17cf6c15f..9ef9a3a05 100644 --- a/docs/demo/basic-controlled.md +++ b/docs/demo/basic-controlled.md @@ -1,3 +1,8 @@ -## basic-controlled +--- +title: Basic Controlled +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/basic.md b/docs/demo/basic.md index 80be196e8..2bfed0cc5 100644 --- a/docs/demo/basic.md +++ b/docs/demo/basic.md @@ -1,3 +1,8 @@ -## basic +--- +title: Basic +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/big-data.md b/docs/demo/big-data.md index ac3490a66..695474e64 100644 --- a/docs/demo/big-data.md +++ b/docs/demo/big-data.md @@ -1,3 +1,8 @@ -## big-data +--- +title: Big Data +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/contextmenu.md b/docs/demo/contextmenu.md index 551601d8d..b088fcebf 100644 --- a/docs/demo/contextmenu.md +++ b/docs/demo/contextmenu.md @@ -1,3 +1,8 @@ -## contextmenu +--- +title: Context Menu +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/custom-switch-icon.md b/docs/demo/custom-switch-icon.md index b0e63a13a..81644e7ea 100644 --- a/docs/demo/custom-switch-icon.md +++ b/docs/demo/custom-switch-icon.md @@ -1,3 +1,8 @@ -## custom-switch-icon +--- +title: Custom Switch Icon +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/draggable-allow-drop.md b/docs/demo/draggable-allow-drop.md index 29611ce6c..2cbe21e44 100644 --- a/docs/demo/draggable-allow-drop.md +++ b/docs/demo/draggable-allow-drop.md @@ -1,3 +1,8 @@ -## draggable-allow-drop +--- +title: Draggable Allow Drop +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/draggable.md b/docs/demo/draggable.md index ab708b6ab..5f167c755 100644 --- a/docs/demo/draggable.md +++ b/docs/demo/draggable.md @@ -1,3 +1,8 @@ -## draggable +--- +title: Draggable +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/dropdown.md b/docs/demo/dropdown.md index 8339a3364..1ee32c191 100644 --- a/docs/demo/dropdown.md +++ b/docs/demo/dropdown.md @@ -1,3 +1,8 @@ -## dropdown +--- +title: Dropdown +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/dynamic.md b/docs/demo/dynamic.md index 5014c2a50..8470bbfe6 100644 --- a/docs/demo/dynamic.md +++ b/docs/demo/dynamic.md @@ -1,3 +1,8 @@ -## dynamic +--- +title: Dynamic +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/expandAction.md b/docs/demo/expandAction.md index 8be97a035..902c8714a 100644 --- a/docs/demo/expandAction.md +++ b/docs/demo/expandAction.md @@ -1,3 +1,8 @@ -## expandAction +--- +title: Expand Action +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/fieldNames.md b/docs/demo/fieldNames.md index 2d34a1c1d..05f5f59c9 100644 --- a/docs/demo/fieldNames.md +++ b/docs/demo/fieldNames.md @@ -1,3 +1,8 @@ -## Field Names +--- +title: Field Names +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/funtionTitle.md b/docs/demo/funtionTitle.md index 70f6f93b9..385d6b7c7 100644 --- a/docs/demo/funtionTitle.md +++ b/docs/demo/funtionTitle.md @@ -1,3 +1,8 @@ -## funtionTitle +--- +title: Function Title +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/icon.md b/docs/demo/icon.md index aeef622b5..176aad6a9 100644 --- a/docs/demo/icon.md +++ b/docs/demo/icon.md @@ -1,3 +1,8 @@ -## icon +--- +title: Icon +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/selectable.md b/docs/demo/selectable.md index 387ee44ba..ad30c00e6 100644 --- a/docs/demo/selectable.md +++ b/docs/demo/selectable.md @@ -1,3 +1,8 @@ -## selectable +--- +title: Selectable +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/examples/animation-draggable.jsx b/docs/examples/animation-draggable.jsx index 0448d7e49..cb2985548 100644 --- a/docs/examples/animation-draggable.jsx +++ b/docs/examples/animation-draggable.jsx @@ -3,7 +3,7 @@ react/no-danger, no-param-reassign */ import React from 'react'; import { gData } from './utils/dataUtil'; import '../../assets/index.less'; -import Tree from 'rc-tree'; +import Tree from '@rc-component/tree'; const STYLE = ` .rc-tree-child-tree { diff --git a/docs/examples/animation.jsx b/docs/examples/animation.jsx index 703d491b3..7dcb5c3f1 100644 --- a/docs/examples/animation.jsx +++ b/docs/examples/animation.jsx @@ -1,8 +1,9 @@ /* eslint no-console:0, react/no-danger: 0 */ +import { Provider } from '@rc-component/motion'; +import Tree from '@rc-component/tree'; +import React from 'react'; import '../../assets/index.less'; import './animation.less'; -import React from 'react'; -import Tree from 'rc-tree'; const STYLE = ` .rc-tree-child-tree { @@ -108,43 +109,56 @@ function getTreeData() { const Demo = () => { const treeRef = React.useRef(); + const [enableMotion, setEnableMotion] = React.useState(true); setTimeout(() => { treeRef.current.scrollTo({ key: '0-9-2' }); }, 100); return ( -
-

expanded

-