@wangtaizong/components 1.0.8 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +285 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +2 -0
- package/dist/index.min.js.map +1 -0
- package/es/Button/index.d.ts +9 -0
- package/es/Button/index.js +25 -0
- package/es/Icon/index.d.ts +9 -0
- package/es/Icon/index.js +25 -0
- package/es/Upload/index.d.ts +16 -0
- package/es/Upload/index.js +221 -0
- package/es/antd/index.js +2 -0
- package/es/index.js +5 -0
- package/lib/Button/index.d.ts +9 -0
- package/lib/Button/index.js +29 -0
- package/lib/Icon/index.d.ts +9 -0
- package/lib/Icon/index.js +48 -0
- package/lib/Upload/index.d.ts +16 -0
- package/lib/Upload/index.js +243 -0
- package/lib/antd/index.d.ts +2 -0
- package/lib/antd/index.js +28 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +32 -0
- package/package.json +40 -68
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/.dumirc.ts +0 -28
- package/.editorconfig +0 -13
- package/.eslintrc.js +0 -3
- package/.husky/commit-msg +0 -5
- package/.husky/pre-commit +0 -8
- package/.husky/pre-push +0 -8
- package/.prettierignore +0 -2
- package/.prettierrc.js +0 -19
- package/.stylelintrc +0 -3
- package/.vscode/settings.json +0 -3
- package/README.md +0 -0
- package/commitlint.config.js +0 -21
- package/docs/changelogs/index.md +0 -9
- package/docs/components/index.md +0 -1
- package/docs/guide/install.md +0 -39
- package/docs/index.md +0 -21
- package/docs/utils/index.md +0 -1
- package/lerna.json +0 -8
- package/packages/components/CHANGELOG.md +0 -0
- package/packages/components/package.json +0 -48
- package/packages/components/rollup.config.mjs +0 -108
- package/packages/components/src/Button/index.md +0 -13
- package/packages/components/src/Button/index.tsx +0 -34
- package/packages/components/src/Icon/index.md +0 -81
- package/packages/components/src/Icon/index.tsx +0 -34
- package/packages/components/src/Upload/index.md +0 -209
- package/packages/components/src/Upload/index.tsx +0 -218
- package/packages/components/src/antd/index.md +0 -12
- package/packages/components/src/index.md +0 -23
- package/packages/components/tsconfig.json +0 -32
- package/packages/utils/README.md +0 -11
- package/packages/utils/package.json +0 -35
- package/packages/utils/rollup.config.mjs +0 -63
- package/packages/utils/src/CHRRequest/index.md +0 -59
- package/packages/utils/src/CHRRequest/index.ts +0 -94
- package/packages/utils/src/index.ts +0 -17
- package/packages/utils/tsconfig.json +0 -28
- package/pnpm-workspace.yaml +0 -8
- package/public/favicon.ico +0 -0
- package/public/logo.webp +0 -0
- package/tsconfig.json +0 -14
- /package/{packages/components/src/antd/index.tsx → es/antd/index.d.ts} +0 -0
- /package/{packages/components/src/index.ts → es/index.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,75 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wangtaizong/components",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"lint": "npm run lint:es && npm run lint:css",
|
|
20
|
-
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
|
21
|
-
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
22
|
-
"lp": "lerna publish from-git",
|
|
23
|
-
"lv": "lerna version",
|
|
24
|
-
"start": "npm run dev"
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "基础组件",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "lib/index.js",
|
|
9
|
+
"unpkg": "dist/index.min.js",
|
|
10
|
+
"module": "es/index.js",
|
|
11
|
+
"typings": "es/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"es",
|
|
14
|
+
"lib",
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@ant-design/icons": "^6.0.0"
|
|
25
19
|
},
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@babel/preset-env": "^7.26.9",
|
|
22
|
+
"@babel/preset-react": "^7.26.3",
|
|
23
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
24
|
+
"@rollup/plugin-commonjs": "^28.0.3",
|
|
25
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
26
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
27
|
+
"rollup": "^4.38.0",
|
|
28
|
+
"rollup-plugin-dts": "^6.2.1",
|
|
29
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
30
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
31
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
32
|
+
"typescript": "^5.8.2"
|
|
30
33
|
},
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"stylelint --fix",
|
|
37
|
-
"prettier --write"
|
|
38
|
-
],
|
|
39
|
-
"*.{js,jsx}": [
|
|
40
|
-
"eslint --fix",
|
|
41
|
-
"prettier --write"
|
|
42
|
-
],
|
|
43
|
-
"*.{ts,tsx}": [
|
|
44
|
-
"eslint --fix",
|
|
45
|
-
"prettier --parser=typescript --write"
|
|
46
|
-
]
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@ant-design/icons": "^6.0.0",
|
|
36
|
+
"antd": "^5.0.0",
|
|
37
|
+
"react": "^18.0.0",
|
|
38
|
+
"react-dom": "^18.0.0"
|
|
47
39
|
},
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
}
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public",
|
|
42
|
+
"registry": "https://registry.npmjs.org/"
|
|
52
43
|
},
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"@commitlint/cli": "^17.1.2",
|
|
56
|
-
"@commitlint/config-conventional": "^17.1.0",
|
|
57
|
-
"@types/react": "^18.0.0",
|
|
58
|
-
"@types/react-dom": "^18.0.0",
|
|
59
|
-
"@umijs/lint": "^4.0.0",
|
|
60
|
-
"commitizen": "^4.3.1",
|
|
61
|
-
"cz-conventional-changelog": "^3.3.0",
|
|
62
|
-
"dumi": "^2.4.18",
|
|
63
|
-
"eslint": "^8.23.0",
|
|
64
|
-
"father": "^4.1.0",
|
|
65
|
-
"husky": "^8.0.1",
|
|
66
|
-
"lerna": "^8.2.1",
|
|
67
|
-
"lint-staged": "^13.0.3",
|
|
68
|
-
"prettier": "^2.7.1",
|
|
69
|
-
"prettier-plugin-organize-imports": "^3.0.0",
|
|
70
|
-
"prettier-plugin-packagejson": "^2.2.18",
|
|
71
|
-
"react": "^18.0.0",
|
|
72
|
-
"react-dom": "^18.0.0",
|
|
73
|
-
"stylelint": "^14.9.1"
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "rollup -c"
|
|
74
46
|
}
|
|
75
|
-
}
|
|
47
|
+
}
|
package/.changeset/README.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Changesets
|
|
2
|
-
|
|
3
|
-
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
|
4
|
-
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
|
5
|
-
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
|
6
|
-
|
|
7
|
-
We have a quick list of common questions to get you started engaging with this project in
|
|
8
|
-
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
package/.changeset/config.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
3
|
-
"changelog": "@changesets/cli/changelog",
|
|
4
|
-
"commit": false,
|
|
5
|
-
"fixed": [],
|
|
6
|
-
"linked": [],
|
|
7
|
-
"access": "restricted",
|
|
8
|
-
"baseBranch": "main",
|
|
9
|
-
"updateInternalDependencies": "patch",
|
|
10
|
-
"ignore": []
|
|
11
|
-
}
|
package/.dumirc.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'dumi';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
outputPath: 'docs-dist',
|
|
6
|
-
autoAlias: false,
|
|
7
|
-
alias: {
|
|
8
|
-
'@chr/components': path.join(__dirname, 'packages/components/src'),
|
|
9
|
-
'@chr/utils': path.join(__dirname, 'packages/utils/src'),
|
|
10
|
-
'@chr/hooks': path.join(__dirname, 'packages/hooks/src'),
|
|
11
|
-
},
|
|
12
|
-
themeConfig: {
|
|
13
|
-
name: 'chr',
|
|
14
|
-
nav: [
|
|
15
|
-
{ title: '介绍', link: '/guide/install' },
|
|
16
|
-
{ title: '组件', link: '/components' },
|
|
17
|
-
{ title: '方法', link: '/utils' },
|
|
18
|
-
{ title: '更新日志', link: '/changelogs' },
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
resolve: {
|
|
22
|
-
atomDirs: [
|
|
23
|
-
{ type: 'component', dir: 'packages/components/src' },
|
|
24
|
-
{ type: 'utils', dir: 'packages/utils/src' },
|
|
25
|
-
{ type: 'hooks', dir: 'packages/hooks/src' },
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
});
|
package/.editorconfig
DELETED
package/.eslintrc.js
DELETED
package/.husky/commit-msg
DELETED
package/.husky/pre-commit
DELETED
package/.husky/pre-push
DELETED
package/.prettierignore
DELETED
package/.prettierrc.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
pluginSearchDirs: false,
|
|
3
|
-
plugins: [
|
|
4
|
-
require.resolve('prettier-plugin-organize-imports'),
|
|
5
|
-
require.resolve('prettier-plugin-packagejson'),
|
|
6
|
-
],
|
|
7
|
-
printWidth: 80,
|
|
8
|
-
proseWrap: 'never',
|
|
9
|
-
singleQuote: true,
|
|
10
|
-
trailingComma: 'all',
|
|
11
|
-
overrides: [
|
|
12
|
-
{
|
|
13
|
-
files: '*.md',
|
|
14
|
-
options: {
|
|
15
|
-
proseWrap: 'preserve',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
};
|
package/.stylelintrc
DELETED
package/.vscode/settings.json
DELETED
package/README.md
DELETED
|
File without changes
|
package/commitlint.config.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// commitlint.config.js
|
|
2
|
-
module.exports = {
|
|
3
|
-
extends: ['@commitlint/config-conventional'],
|
|
4
|
-
rules: {
|
|
5
|
-
'type-enum': [
|
|
6
|
-
2,
|
|
7
|
-
'always',
|
|
8
|
-
[
|
|
9
|
-
'feat',
|
|
10
|
-
'fix',
|
|
11
|
-
'docs',
|
|
12
|
-
'style',
|
|
13
|
-
'refactor',
|
|
14
|
-
'perf',
|
|
15
|
-
'test',
|
|
16
|
-
'chore',
|
|
17
|
-
'revert',
|
|
18
|
-
],
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
};
|
package/docs/changelogs/index.md
DELETED
package/docs/components/index.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1
|
package/docs/guide/install.md
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 安装
|
|
3
|
-
toc: content
|
|
4
|
-
group:
|
|
5
|
-
title: 快速上手
|
|
6
|
-
order: 1
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# 安装
|
|
10
|
-
|
|
11
|
-
`@chr/ui@1.0` 是基于 `antd@6.3.3` 开发的。
|
|
12
|
-
|
|
13
|
-
## 前置依赖
|
|
14
|
-
|
|
15
|
-
请先检查项目中是否已安装以下依赖:
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
"react": ">=16.9.0",
|
|
19
|
-
"react-dom": ">=16.9.0",
|
|
20
|
-
"antd": ">=6.3.3"
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## 镜像仓库
|
|
24
|
-
|
|
25
|
-
`@chr/ui@1.0` 应当发布到公司的npm私服中。
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm config set registry http://npm.xxx.com
|
|
29
|
-
# or
|
|
30
|
-
yarn config set registry http://npm.xxx.com
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## 安装
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npm install @chr/ui
|
|
37
|
-
# or
|
|
38
|
-
yarn add @chr/ui
|
|
39
|
-
```
|
package/docs/index.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
hero:
|
|
3
|
-
title: MyAntd
|
|
4
|
-
description: 一个基于Antd二次封装的组件库
|
|
5
|
-
actions:
|
|
6
|
-
- text: 快速上手
|
|
7
|
-
link: /guide/install
|
|
8
|
-
- text: gitlab
|
|
9
|
-
link: https://gitlab.com
|
|
10
|
-
features:
|
|
11
|
-
- title: 快速开发
|
|
12
|
-
emoji: 🚀
|
|
13
|
-
description: 让开发更快速、简单
|
|
14
|
-
- title: 'Ant Design'
|
|
15
|
-
emoji: 💎
|
|
16
|
-
description: 在 Ant Design基础上进行的封装,无缝对接 antd 项目
|
|
17
|
-
- title: TypeScript
|
|
18
|
-
emoji: 🌈
|
|
19
|
-
description: 使用TypeScript开发,提供完整的类型定义文件
|
|
20
|
-
---
|
|
21
|
-
|
package/docs/utils/index.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1
|
package/lerna.json
DELETED
|
File without changes
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@chr/components",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "基础组件",
|
|
5
|
-
"keywords": [],
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"sideEffects": false,
|
|
8
|
-
"main": "lib/index.js",
|
|
9
|
-
"unpkg": "dist/index.min.js",
|
|
10
|
-
"module": "es/index.js",
|
|
11
|
-
"typings": "es/index.d.ts",
|
|
12
|
-
"files": [
|
|
13
|
-
"es",
|
|
14
|
-
"lib",
|
|
15
|
-
"dist"
|
|
16
|
-
],
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "rollup -c"
|
|
19
|
-
},
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"@ant-design/icons": "^6.0.0"
|
|
22
|
-
},
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@babel/preset-env": "^7.26.9",
|
|
25
|
-
"@babel/preset-react": "^7.26.3",
|
|
26
|
-
"@rollup/plugin-babel": "^6.0.4",
|
|
27
|
-
"@rollup/plugin-commonjs": "^28.0.3",
|
|
28
|
-
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
29
|
-
"@rollup/plugin-typescript": "^12.1.2",
|
|
30
|
-
"rollup": "^4.38.0",
|
|
31
|
-
"rollup-plugin-dts": "^6.2.1",
|
|
32
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
33
|
-
"rollup-plugin-postcss": "^4.0.2",
|
|
34
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
35
|
-
"typescript": "^5.8.2"
|
|
36
|
-
},
|
|
37
|
-
"peerDependencies": {
|
|
38
|
-
"antd": "catalog:",
|
|
39
|
-
"react": "catalog:",
|
|
40
|
-
"react-dom": "catalog:",
|
|
41
|
-
"@ant-design/icons": "catalog:"
|
|
42
|
-
},
|
|
43
|
-
"packageManager": "pnpm@10.7.0",
|
|
44
|
-
"publishConfig": {
|
|
45
|
-
"access": "public",
|
|
46
|
-
"registry": "https://registry.npmjs.org/"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import babel from '@rollup/plugin-babel';
|
|
2
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
-
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
4
|
-
import typescript from '@rollup/plugin-typescript';
|
|
5
|
-
import { defineConfig } from 'rollup';
|
|
6
|
-
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
|
7
|
-
import postcss from 'rollup-plugin-postcss';
|
|
8
|
-
import { terser } from 'rollup-plugin-terser';
|
|
9
|
-
|
|
10
|
-
const DIR_MAP = {
|
|
11
|
-
ESM: 'es',
|
|
12
|
-
CJS: 'lib',
|
|
13
|
-
UMD: 'dist',
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// 处理 Ant Design 样式按需加载
|
|
17
|
-
const antdStyles = () => ({
|
|
18
|
-
name: 'antd-styles',
|
|
19
|
-
transform(code, id) {
|
|
20
|
-
if (/node_modules\/antd/.test(id) && id.endsWith('.js')) {
|
|
21
|
-
return code.replace(/import\s+['"].*\.less['"]/, '');
|
|
22
|
-
}
|
|
23
|
-
return null;
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const baseConfig = (tsConfig) => ({
|
|
28
|
-
external: ['react', 'react-dom', 'antd', 'tslib'],
|
|
29
|
-
input: 'src/index.ts',
|
|
30
|
-
plugins: [
|
|
31
|
-
peerDepsExternal(),
|
|
32
|
-
nodeResolve({
|
|
33
|
-
modulesOnly: true,
|
|
34
|
-
extensions: ['.ts', '.tsx', '.js', '.jsx'],
|
|
35
|
-
preferBuiltins: true,
|
|
36
|
-
}),
|
|
37
|
-
commonjs(),
|
|
38
|
-
typescript(tsConfig),
|
|
39
|
-
babel({
|
|
40
|
-
babelHelpers: 'bundled',
|
|
41
|
-
extensions: ['.ts', '.tsx'],
|
|
42
|
-
presets: [
|
|
43
|
-
'@babel/preset-react',
|
|
44
|
-
['@babel/preset-env', { modules: false }],
|
|
45
|
-
],
|
|
46
|
-
}),
|
|
47
|
-
postcss({
|
|
48
|
-
extract: true, // 分离 CSS 文件
|
|
49
|
-
modules: false,
|
|
50
|
-
use: ['less'],
|
|
51
|
-
minimize: true,
|
|
52
|
-
}),
|
|
53
|
-
antdStyles(),
|
|
54
|
-
],
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
const esmConfig = {
|
|
58
|
-
...baseConfig({
|
|
59
|
-
declaration: true,
|
|
60
|
-
declarationDir: DIR_MAP.ESM,
|
|
61
|
-
}),
|
|
62
|
-
output: {
|
|
63
|
-
dir: DIR_MAP.ESM,
|
|
64
|
-
format: 'esm',
|
|
65
|
-
preserveModules: true,
|
|
66
|
-
preserveModulesRoot: 'src',
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const cjsConfig = {
|
|
71
|
-
...baseConfig({
|
|
72
|
-
declaration: true,
|
|
73
|
-
declarationDir: DIR_MAP.CJS,
|
|
74
|
-
}),
|
|
75
|
-
output: {
|
|
76
|
-
dir: DIR_MAP.CJS,
|
|
77
|
-
format: 'cjs',
|
|
78
|
-
exports: 'named',
|
|
79
|
-
preserveModules: true,
|
|
80
|
-
preserveModulesRoot: 'src',
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const umdConfig = {
|
|
85
|
-
...baseConfig(),
|
|
86
|
-
output: [
|
|
87
|
-
{
|
|
88
|
-
file: DIR_MAP.UMD + '/index.js',
|
|
89
|
-
format: 'umd',
|
|
90
|
-
name: 'KcComponents',
|
|
91
|
-
globals: {
|
|
92
|
-
react: 'React',
|
|
93
|
-
'react-dom': 'ReactDOM',
|
|
94
|
-
antd: 'antd',
|
|
95
|
-
},
|
|
96
|
-
sourcemap: true,
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
file: DIR_MAP.UMD + '/index.min.js',
|
|
100
|
-
format: 'umd',
|
|
101
|
-
name: 'KcComponents',
|
|
102
|
-
plugins: [terser()],
|
|
103
|
-
sourcemap: true,
|
|
104
|
-
},
|
|
105
|
-
],
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export default defineConfig([esmConfig, cjsConfig, umdConfig]);
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Button } from 'antd';
|
|
2
|
-
import React, { type FC, ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
interface CHRButtonProps {
|
|
5
|
-
children?: ReactNode;
|
|
6
|
-
title?: string;
|
|
7
|
-
defaultText?: string;
|
|
8
|
-
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const CHRButton: FC<CHRButtonProps> = ({
|
|
12
|
-
children,
|
|
13
|
-
title,
|
|
14
|
-
defaultText = '按钮',
|
|
15
|
-
onClick,
|
|
16
|
-
...restProps
|
|
17
|
-
}) => {
|
|
18
|
-
const handleClick: React.MouseEventHandler<HTMLElement> = (e) => {
|
|
19
|
-
console.log('CHRButton 内部点击处理');
|
|
20
|
-
onClick?.(e);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// 决定显示内容
|
|
24
|
-
let content: ReactNode;
|
|
25
|
-
content = children !== undefined ? children : title || defaultText;
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Button {...restProps} onClick={handleClick}>
|
|
29
|
-
{content}
|
|
30
|
-
</Button>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default CHRButton;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# CHRIcon
|
|
2
|
-
|
|
3
|
-
## 代码演示
|
|
4
|
-
|
|
5
|
-
### 基本用法
|
|
6
|
-
|
|
7
|
-
通过 icon 属性指定图标名称(使用 Ant Design 图标组件的导出名)。
|
|
8
|
-
|
|
9
|
-
```jsx
|
|
10
|
-
import { CHRIcon } from '@chr/components';
|
|
11
|
-
|
|
12
|
-
export default () => {
|
|
13
|
-
return (
|
|
14
|
-
<div style={{ display: 'flex', gap: 12 }}>
|
|
15
|
-
<CHRIcon icon="HomeOutlined" />
|
|
16
|
-
<CHRIcon icon="UserOutlined" />
|
|
17
|
-
<CHRIcon icon="SearchOutlined" />
|
|
18
|
-
</div>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### 自定义尺寸
|
|
24
|
-
|
|
25
|
-
通过 fontSize 属性设置图标大小(单位:px)。
|
|
26
|
-
|
|
27
|
-
```jsx
|
|
28
|
-
import { CHRIcon } from '@chr/components';
|
|
29
|
-
|
|
30
|
-
export default () => {
|
|
31
|
-
return (
|
|
32
|
-
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
|
33
|
-
<CHRIcon icon="MessageOutlined" fontSize={16} />
|
|
34
|
-
<CHRIcon icon="MessageOutlined" fontSize={24} />
|
|
35
|
-
<CHRIcon icon="MessageOutlined" fontSize={32} />
|
|
36
|
-
<CHRIcon icon="MessageOutlined" fontSize={40} />
|
|
37
|
-
</div>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### 自定义样式
|
|
43
|
-
|
|
44
|
-
通过 className 和 style 属性自定义样式。
|
|
45
|
-
|
|
46
|
-
```jsx
|
|
47
|
-
import { CHRIcon } from '@chr/components';
|
|
48
|
-
|
|
49
|
-
export default () => {
|
|
50
|
-
return (
|
|
51
|
-
<div style={{ display: 'flex', gap: 12 }}>
|
|
52
|
-
<CHRIcon icon="HeartOutlined" style={{ color: '#ff4d4f' }} />
|
|
53
|
-
<CHRIcon icon="StarOutlined" style={{ color: '#faad14' }} />
|
|
54
|
-
<CHRIcon icon="CheckCircleOutlined" style={{ color: '#52c41a' }} />
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### 未找到 icon
|
|
61
|
-
|
|
62
|
-
```jsx
|
|
63
|
-
import { CHRIcon } from '@chr/components';
|
|
64
|
-
|
|
65
|
-
export default () => {
|
|
66
|
-
return (
|
|
67
|
-
<div style={{ display: 'flex', gap: 12 }}>
|
|
68
|
-
<CHRIcon icon="HeartOutlined1" style={{ color: '#ff4d4f' }} />
|
|
69
|
-
</div>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## API
|
|
75
|
-
|
|
76
|
-
| 属性 | 说明 | 类型 | 默认值 |
|
|
77
|
-
| --------- | --------------------------------------------------------------------------- | ------------------- | ------ |
|
|
78
|
-
| icon | 图标名称,对应 Ant Design 图标组件的导出名(如 HomeOutlined、UserOutlined) | - | - |
|
|
79
|
-
| fontSize | 图标大小,单位:px | number | 20 |
|
|
80
|
-
| className | 自定义 CSS 类名 | string | - |
|
|
81
|
-
| style | 自定义内联样式 | React.CSSProperties | - |
|