Skip to content

Commit

Permalink
feat: basic realization (#1)
Browse files Browse the repository at this point in the history
* chore: init

* chore: update

* chore: update

* chore: update

* chore: update

* chore: remove

* feat: feature

* test: add hook

* chore: add test

* chore: update pnpm-lock

* fix: bug

* feat: feature

* chore: update demo

* fix: clean bug
  • Loading branch information
Wxh16144 committed Feb 23, 2024
1 parent 6dca798 commit 9ec442c
Show file tree
Hide file tree
Showing 93 changed files with 1,984 additions and 3,593 deletions.
8 changes: 4 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
_test_
__test__

/node_modules
node_modules
jest*
/es
/lib
/docs
es
lib
docs
1 change: 0 additions & 1 deletion .fatherrc.ts → .fatherrc.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ import { defineConfig } from 'father';
export default defineConfig({
cjs: { output: 'lib' },
esm: { output: 'es' },
umd: { output: 'dist', name: 'easyAntdModal' },
});
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ _roadhog-api-doc
# production
**/dist
/.vscode
/es
/lib
es
lib

# misc
.DS_Store
Expand Down Expand Up @@ -44,3 +44,6 @@ techUI*

# Symbolic link
examples/with-antd4/src/App.tsx

# turbo
.turbo
7 changes: 6 additions & 1 deletion .releaserc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ module.exports = {
changelogFile: 'CHANGELOG.md',
},
],
'@semantic-release/npm',
/**
* using monorepo, use "@semrel-extra/npm" instead of the official package
* https://github.com/dhoulb/multi-semantic-release#npm-invalid-npm-token
*/
// '@semantic-release/npm',
'@semrel-extra/npm',
[
'@semantic-release/github',
{
Expand Down
69 changes: 0 additions & 69 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,69 +0,0 @@
## [1.5.1](https://github.com/Wxh16144/easy-antd-modal/compare/v1.5.0...v1.5.1) (2024-01-12)

### Bug Fixes

- 修复部分机器安装依赖失败问题 ([#16](https://github.com/Wxh16144/easy-antd-modal/issues/16)) ([397cb22](https://github.com/Wxh16144/easy-antd-modal/commit/397cb2225b466c7a276ad012be5003926d516edd))

# [1.5.0](https://github.com/Wxh16144/easy-antd-modal/compare/v1.4.2...v1.5.0) (2024-01-10)

### Features

- 克隆 antd 静态方法 ([#15](https://github.com/Wxh16144/easy-antd-modal/issues/15)) ([2f8cdac](https://github.com/Wxh16144/easy-antd-modal/commit/2f8cdacd48efa318d563302f399947f3b6a2e46b))

## [1.4.2](https://github.com/Wxh16144/easy-antd-modal/compare/v1.4.1...v1.4.2) (2023-08-29)

### Bug Fixes

- 修复 drawer 类型未导出错误 ([#13](https://github.com/Wxh16144/easy-antd-modal/issues/13)) ([002e26c](https://github.com/Wxh16144/easy-antd-modal/commit/002e26c42282d43d908173b56a299857297454de))

# [1.4.1](https://github.com/Wxh16144/easy-antd-modal/compare/v1.3.0...v1.4.1) (2023-08-14)

### Features

- 补充 prefixCls 逻辑 ([#11](https://github.com/Wxh16144/easy-antd-modal/issues/11)) ([e88e9df](https://github.com/Wxh16144/easy-antd-modal/commit/e88e9df32a8d29c4ce3a65facad1cde24a3fc21b))

# [1.4.0-beta.1](https://github.com/Wxh16144/easy-antd-modal/compare/v1.3.0...v1.4.0-beta.1) (2023-08-14)

### Features

- 补充 prefixCls 逻辑 ([#10](https://github.com/Wxh16144/easy-antd-modal/issues/10)) ([287bfde](https://github.com/Wxh16144/easy-antd-modal/commit/287bfdede391840b3b85d3987667724fa9d29e0f))

# [1.3.0](https://github.com/Wxh16144/easy-antd-modal/compare/v1.2.1...v1.3.0) (2023-08-11)

### Features

- 调整 package#exports ([#8](https://github.com/Wxh16144/easy-antd-modal/issues/8)) ([8206020](https://github.com/Wxh16144/easy-antd-modal/commit/8206020b4aecf7289a419b57446d096ce0aa257d))

## [1.2.1](https://github.com/Wxh16144/easy-antd-modal/compare/v1.2.0...v1.2.1) (2023-08-08)

### Bug Fixes

- 修复前置依赖版本问题 ([#5](https://github.com/Wxh16144/easy-antd-modal/issues/5)) ([79051f8](https://github.com/Wxh16144/easy-antd-modal/commit/79051f8b1da3f53f10a258656e07a94df2e68fa4))

# [1.2.0](https://github.com/Wxh16144/easy-antd-modal/compare/v1.1.1...v1.2.0) (2023-08-01)

### Features

- 添加 useEasyAntdModal 导出 ([#4](https://github.com/Wxh16144/easy-antd-modal/issues/4)) ([5464171](https://github.com/Wxh16144/easy-antd-modal/commit/5464171fb50f41feb126f7885d23ec5930878056))

# [1.2.0-beta.1](https://github.com/Wxh16144/easy-antd-modal/compare/v1.1.1...v1.2.0-beta.1) (2023-08-01)

### Features

- 基础功能开发 ([2fb3ac2](https://github.com/Wxh16144/easy-antd-modal/commit/2fb3ac29b479fd27a947b1fef38b17aba3f0ebcb))
- 导出上下文中的 useEasyAntdModal hook ([e614ead](https://github.com/Wxh16144/easy-antd-modal/commit/e614ead7b310c0fecf547fea9266fbc71d19c032))
- 添加移动端 & 使用文档 ([4ab7905](https://github.com/Wxh16144/easy-antd-modal/commit/4ab790594c3c250226a798a7fec42b36dcc15caf))

## [1.1.1](https://github.com/Wxh16144/easy-antd-modal/compare/v1.1.0...v1.1.1) (2023-07-24)

### Bug Fixes

- 修复 contentNode 中 props.enhancedAction 未定义错误 ([#3](https://github.com/Wxh16144/easy-antd-modal/issues/3)) ([7394edf](https://github.com/Wxh16144/easy-antd-modal/commit/7394edf066456d054846673a0efa6ae66a2e182d))

# [1.1.0](https://github.com/Wxh16144/easy-antd-modal/compare/v1.0.0...v1.1.0) (2023-07-19)

### Features

- support antd-mobile & update docs ([#2](https://github.com/Wxh16144/easy-antd-modal/issues/2)) ([3804b6c](https://github.com/Wxh16144/easy-antd-modal/commit/3804b6cd7a50c0dfe3b4b2fa8ab5ee92cd302f10))

# Changelog
61 changes: 19 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# easy-antd-modal
# react-record-hotkey

<!-- SHIELD GROUP -->

[![NPM version][npm-image]][npm-url] [![NPM downloads][download-image]][download-url] [![install size][npm-size]][npm-size-url]

[![Test CI status][test-ci]][test-ci-url] [![Deploy CI][release-ci]][release-ci-url] [![Coverage][coverage]][codecov-url]

[![contributors][contributors-shield]][contributors-url] [![forks][forks-shield]][forks-url] [![stargazers][stargazers-shield]][stargazers-url] [![issues][issues-shield]][issues-url]
Expand All @@ -15,37 +13,23 @@
[dumi-url]: https://img.shields.io/badge/docs%20by-dumi-blue
[father-url]: https://img.shields.io/badge/build%20with-father-028fe4.svg

<!-- npm url -->

[npm-image]: http://img.shields.io/npm/v/easy-antd-modal.svg?style=flat-square&color=deepgreen&label=latest
[npm-url]: http://npmjs.org/package/easy-antd-modal
[npm-size]: https://img.shields.io/bundlephobia/minzip/easy-antd-modal?color=deepgreen&label=gizpped%20size&style=flat-square
[npm-size-url]: https://packagephobia.com/result?p=easy-antd-modal

<!-- coverage -->

[coverage]: https://codecov.io/gh/Wxh16144/easy-antd-modal/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/Wxh16144/easy-antd-modal/branch/master
[coverage]: https://codecov.io/gh/Wxh16144/react-record-hotkey/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/Wxh16144/react-record-hotkey/branch/master

<!-- Github CI -->

[test-ci]: https://github.com/Wxh16144/easy-antd-modal/workflows/Test%20CI/badge.svg
[release-ci]: https://github.com/Wxh16144/easy-antd-modal/workflows/Release%20CI/badge.svg
[test-ci-url]: https://github.com/Wxh16144/easy-antd-modal/actions?query=workflow%3ATest%20CI
[release-ci-url]: https://github.com/Wxh16144/easy-antd-modal/actions?query=workflow%3ARelease%20CI
[download-image]: https://img.shields.io/npm/dm/easy-antd-modal.svg?style=flat-square
[download-url]: https://npmjs.org/package/easy-antd-modal
[test-ci]: https://github.com/Wxh16144/react-record-hotkey/workflows/Test%20CI/badge.svg
[release-ci]: https://github.com/Wxh16144/react-record-hotkey/workflows/Release%20CI/badge.svg
[test-ci-url]: https://github.com/Wxh16144/react-record-hotkey/actions?query=workflow%3ATest%20CI
[release-ci-url]: https://github.com/Wxh16144/react-record-hotkey/actions?query=workflow%3ARelease%20CI
[download-image]: https://img.shields.io/npm/dm/react-record-hotkey.svg?style=flat-square
[download-url]: https://npmjs.org/package/react-record-hotkey

## 简介

基于 Ant Design 的 Modal 组件的二次封装,简化了 Modal 的使用方式

- 支持 antd4.x 和 antd5.x, API 保持一致
- 自动绑定打开事件, 无需维护 open 状态
- content 增强, 支持内部手动关闭
- 支持拖拽, 类 window 窗口
- 可直接对接 antd-mobile 的 Mask, Modal, Popup, Dialog 组件
- 长期维护 (欢迎 PR)

## 快速上手

Expand All @@ -54,20 +38,13 @@
推荐使用 `pnpm` 安装

```bash
pnpm i easy-antd-modal -S
# todo
```

### 使用

```tsx | pure
import { Button } from 'antd';
import Modal from 'easy-antd-modal';

export default () => (
<Modal title="easy-antd-modal" trigger={<Button type="primary">Click Me</Button>}>
I ❤️ antd
</Modal>
);
// todo
```

## 迭代记录
Expand All @@ -85,20 +62,20 @@ This project is [MIT](./LICENSE) licensed.

<!-- contributors -->

[contributors-shield]: https://img.shields.io/github/contributors/Wxh16144/easy-antd-modal.svg?style=flat
[contributors-url]: https://github.com/Wxh16144/easy-antd-modal/graphs/contributors
[contributors-shield]: https://img.shields.io/github/contributors/Wxh16144/react-record-hotkey.svg?style=flat
[contributors-url]: https://github.com/Wxh16144/react-record-hotkey/graphs/contributors

<!-- forks -->

[forks-shield]: https://img.shields.io/github/forks/Wxh16144/easy-antd-modal.svg?style=flat
[forks-url]: https://github.com/Wxh16144/easy-antd-modal/network/members
[forks-shield]: https://img.shields.io/github/forks/Wxh16144/react-record-hotkey.svg?style=flat
[forks-url]: https://github.com/Wxh16144/react-record-hotkey/network/members

<!-- stargazers -->

[stargazers-shield]: https://img.shields.io/github/stars/Wxh16144/easy-antd-modal.svg?style=flat
[stargazers-url]: https://github.com/Wxh16144/easy-antd-modal/stargazers
[stargazers-shield]: https://img.shields.io/github/stars/Wxh16144/react-record-hotkey.svg?style=flat
[stargazers-url]: https://github.com/Wxh16144/react-record-hotkey/stargazers

<!-- issues -->

[issues-shield]: https://img.shields.io/github/issues/Wxh16144/easy-antd-modal.svg?style=flat
[issues-url]: https://github.com/Wxh16144/easy-antd-modal/issues/new/choose
[issues-shield]: https://img.shields.io/github/issues/Wxh16144/react-record-hotkey.svg?style=flat
[issues-url]: https://github.com/Wxh16144/react-record-hotkey/issues/new/choose
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ hero:
- text: 快速上手
link: /guide
- text: 查看源码
link: https://github.com/Wxh16144/easy-antd-modal
link: https://github.com/Wxh16144/react-record-hotkey

features:
- title: 兼容 Ant Design 4 & 5
Expand Down Expand Up @@ -38,7 +38,7 @@ features:
- title: 长期维护
image: 📅
description: 长期维护 (欢迎 PR)
link: https://github.com/Wxh16144/easy-antd-modal/pulse
link: https://github.com/Wxh16144/react-record-hotkey/pulse
row: 8
---

Expand Down
27 changes: 27 additions & 0 deletions examples/react-hooks/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* eslint-env node */

module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:react-hooks/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: true,
tsconfigRootDir: __dirname,
},
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'@typescript-eslint/no-non-null-assertion': 'off',
},
}
24 changes: 24 additions & 0 deletions examples/react-hooks/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
30 changes: 30 additions & 0 deletions examples/react-hooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default {
// other rules...
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
};
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
14 changes: 14 additions & 0 deletions examples/react-hooks/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://unpkg.com/modern-normalize" rel="stylesheet" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
30 changes: 30 additions & 0 deletions examples/react-hooks/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "react-hooks",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"build": "tsc && vite build",
"dev": "vite",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"antd": "^5.12.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-use-record-hotkey": "workspace:*"
},
"devDependencies": {
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"@vitejs/plugin-react": "^4.0.1",
"eslint": "^8.44.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.1",
"typescript": "^5.0.2",
"vite": "^4.4.0"
}
}
1 change: 1 addition & 0 deletions examples/react-hooks/public/vite.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9ec442c

Please sign in to comment.