@wangtaizong/components 1.0.5 → 1.0.7
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/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.dumirc.ts +28 -0
- package/.editorconfig +13 -0
- package/.eslintrc.js +3 -0
- package/.husky/commit-msg +5 -0
- package/.husky/pre-commit +8 -0
- package/.husky/pre-push +8 -0
- package/.prettierignore +2 -0
- package/.prettierrc.js +19 -0
- package/.stylelintrc +3 -0
- package/.vscode/settings.json +3 -0
- package/LICENSE +21 -0
- package/README.md +0 -52
- package/commitlint.config.js +21 -0
- package/docs/changelogs/index.md +9 -0
- package/docs/components/index.md +1 -0
- package/docs/guide/install.md +39 -0
- package/docs/index.md +21 -0
- package/docs/utils/index.md +1 -0
- package/lerna.json +8 -0
- package/package.json +66 -69
- package/packages/components/CHANGELOG.md +0 -0
- package/packages/components/package.json +48 -0
- package/packages/components/rollup.config.mjs +108 -0
- package/packages/components/src/Button/index.md +13 -0
- package/packages/components/src/Button/index.tsx +34 -0
- package/packages/components/src/Icon/index.md +81 -0
- package/packages/components/src/Icon/index.tsx +34 -0
- package/packages/components/src/Upload/index.md +209 -0
- package/packages/components/src/Upload/index.tsx +218 -0
- package/packages/components/src/antd/index.md +12 -0
- package/packages/components/src/antd/index.tsx +2 -0
- package/packages/components/src/index.md +23 -0
- package/packages/components/src/index.ts +5 -0
- package/packages/components/tsconfig.json +32 -0
- package/packages/utils/README.md +11 -0
- package/packages/utils/package.json +35 -0
- package/packages/utils/rollup.config.mjs +63 -0
- package/packages/utils/src/CHRRequest/index.md +59 -0
- package/packages/utils/src/CHRRequest/index.ts +94 -0
- package/packages/utils/src/index.ts +17 -0
- package/packages/utils/tsconfig.json +28 -0
- package/pnpm-workspace.yaml +8 -0
- package/public/favicon.ico +0 -0
- package/public/logo.webp +0 -0
- package/tsconfig.json +14 -0
- package/dist/base-80a1f760-4106f070.js +0 -23
- package/dist/components/editor/MonacoEditor.d.ts +0 -2
- package/dist/components/editor/WEditor.d.ts +0 -12
- package/dist/components/editor/sandpack-file-explorer/CreateNewNode.d.ts +0 -3
- package/dist/components/editor/sandpack-file-explorer/Example.d.ts +0 -4
- package/dist/components/editor/sandpack-file-explorer/FileTreeExplorer.d.ts +0 -1
- package/dist/components/editor/sandpack-file-explorer/SandpackFilesProvider.d.ts +0 -24
- package/dist/components/editor/sandpack-file-explorer/SingleInputForm.d.ts +0 -8
- package/dist/components/editor/sandpack-file-explorer/index.d.ts +0 -6
- package/dist/components/editor/sandpack-file-explorer/types.d.ts +0 -18
- package/dist/components/editor/sandpack-file-explorer/utils/arrayToObject.d.ts +0 -1
- package/dist/components/editor/sandpack-file-explorer/utils/buildPath.d.ts +0 -2
- package/dist/components/editor/sandpack-file-explorer/utils/deepMerge.d.ts +0 -2
- package/dist/components/editor/sandpack-file-explorer/utils/deleteKeys.d.ts +0 -4
- package/dist/components/editor/sandpack-file-explorer/utils/directoryFileMap.d.ts +0 -3
- package/dist/components/editor/sandpack-file-explorer/utils/fiindParentPath.d.ts +0 -1
- package/dist/components/editor/sandpack-file-explorer/utils/flattenObject.d.ts +0 -2
- package/dist/components/editor/sandpack-file-explorer/utils/getEntryFile.d.ts +0 -2
- package/dist/components/editor/sandpack-file-explorer/utils/getRemovedKeys.d.ts +0 -5
- package/dist/components/editor/sandpack-file-explorer/utils/index.d.ts +0 -12
- package/dist/components/editor/sandpack-file-explorer/utils/mergeHierarchicalArray.d.ts +0 -2
- package/dist/components/editor/sandpack-file-explorer/utils/removeHiddenEntries.d.ts +0 -3
- package/dist/components/editor/sandpack-file-explorer/utils/toHierarchicalArray.d.ts +0 -3
- package/dist/components/editor/utils/map.d.ts +0 -4
- package/dist/consoleHook-59e792cb-38408587.js +0 -168
- package/dist/index-585bceb7-0bf06f98.js +0 -8813
- package/dist/index-6afdc2ce.js +0 -32171
- package/dist/index-83b70eea.js +0 -316
- package/dist/index-e28d3e42.js +0 -1104
- package/dist/index.d.ts +0 -2
- package/dist/index.es.js +0 -5
- package/dist/index.umd.js +0 -779
|
@@ -0,0 +1,8 @@
|
|
|
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)
|
|
@@ -0,0 +1,11 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
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
ADDED
package/.eslintrc.js
ADDED
package/.husky/pre-push
ADDED
package/.prettierignore
ADDED
package/.prettierrc.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) kincy
|
|
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.
|
package/README.md
CHANGED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# EverUI
|
|
2
|
-
|
|
3
|
-
前端业务组件库项目
|
|
4
|
-
|
|
5
|
-
框架:react + vite + storybook
|
|
6
|
-
|
|
7
|
-
[story文档 ](https://storybook.js.org/docs/react/addons/addons-api#addonssetconfigconfig)
|
|
8
|
-
|
|
9
|
-
### 开发
|
|
10
|
-
```
|
|
11
|
-
yarn storybook
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### 打包
|
|
15
|
-
```
|
|
16
|
-
yarn build
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### 发布npm
|
|
20
|
-
```
|
|
21
|
-
npm publish
|
|
22
|
-
```
|
|
23
|
-
[npm线上地址](https://www.npmjs.com/package/@youdao-ead-fe/yodao-ui)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
### 使用组件库
|
|
27
|
-
```
|
|
28
|
-
npm install @youdao-ead-fe/yodao-ui
|
|
29
|
-
|
|
30
|
-
// 在输入文件如_app.js中引入style
|
|
31
|
-
import '@youdao-ead-fe/yodao-ui/style'
|
|
32
|
-
|
|
33
|
-
// 在目标页面中
|
|
34
|
-
import {MutipleSelector} from @youdao-ead-fe/yodao-ui
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
### 发布到github
|
|
40
|
-
使用[@storybook/storybook-deployer文档](https://github.com/storybook-eol/storybook-deployer)发布到github
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
yarn build-storybook
|
|
44
|
-
|
|
45
|
-
// 在storybook-static 文件夹中添加.nojekyll文件
|
|
46
|
-
|
|
47
|
-
yarn deploy-storybook -- --existing-output-dir=storybook-static
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
[线上地址](https://MingwieJin.github.io/EverUI/)
|
|
51
|
-
|
|
52
|
-
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1
|
|
@@ -0,0 +1,39 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1
|
package/lerna.json
ADDED
package/package.json
CHANGED
|
@@ -1,78 +1,75 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wangtaizong/components",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"publishConfig": {
|
|
7
|
-
"access": "public",
|
|
8
|
-
"registry": "https://registry.npmjs.org/"
|
|
9
|
-
},
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"private": false,
|
|
10
5
|
"scripts": {
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
6
|
+
"start": "npm run dev",
|
|
7
|
+
"dev": "dumi dev",
|
|
8
|
+
"build": "lerna run build",
|
|
9
|
+
"docs:build": "dumi build",
|
|
10
|
+
"docs:preview": "dumi preview",
|
|
11
|
+
"lint": "npm run lint:es && npm run lint:css",
|
|
12
|
+
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
|
13
|
+
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
14
|
+
"commit": "git add . && git cz",
|
|
15
|
+
"clean": "lerna clean --yes",
|
|
16
|
+
"clean:dist": "lerna exec -- rm -rf dist es lib",
|
|
17
|
+
"lv": "lerna version",
|
|
18
|
+
"lp": "lerna publish from-git",
|
|
19
|
+
"cs:add": "pnpm changeset add",
|
|
20
|
+
"cs:version": "pnpm changeset version",
|
|
21
|
+
"cs:publish": "pnpm changeset publish",
|
|
22
|
+
"cs:status": "pnpm changeset status",
|
|
23
|
+
"cs:preEnter": "pnpm changeset pre enter beta",
|
|
24
|
+
"cs:preExit": "pnpm changeset pre exit"
|
|
19
25
|
},
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"@monaco-editor/react": "4.6.0",
|
|
25
|
-
"path": "^0.12.7",
|
|
26
|
-
"react": "^18.2.0",
|
|
27
|
-
"react-dom": "^18.2.0",
|
|
28
|
-
"react-dnd": "^16.0.1"
|
|
26
|
+
"commitlint": {
|
|
27
|
+
"extends": [
|
|
28
|
+
"@commitlint/config-conventional"
|
|
29
|
+
]
|
|
29
30
|
},
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"@storybook/addon-onboarding": "1.0.8",
|
|
35
|
-
"@storybook/blocks": "^7.4.0",
|
|
36
|
-
"@storybook/manager-api": "^7.4.0",
|
|
37
|
-
"@storybook/react": "^7.4.0",
|
|
38
|
-
"@storybook/react-vite": "^7.4.0",
|
|
39
|
-
"@storybook/storybook-deployer": "^2.8.16",
|
|
40
|
-
"@storybook/testing-library": "0.2.2",
|
|
41
|
-
"@storybook/theming": "^7.4.0",
|
|
42
|
-
"@types/less": "^3.0.4",
|
|
43
|
-
"@types/node": "^20.8.3",
|
|
44
|
-
"@types/react": "^18.2.15",
|
|
45
|
-
"@types/react-dom": "^18.2.7",
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
47
|
-
"@typescript-eslint/parser": "^6.0.0",
|
|
48
|
-
"@vitejs/plugin-react": "^4.0.3",
|
|
49
|
-
"classnames": "^2.3.2",
|
|
50
|
-
"eslint": "^8.45.0",
|
|
51
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
52
|
-
"eslint-plugin-react-refresh": "^0.4.3",
|
|
53
|
-
"eslint-plugin-storybook": "^0.6.15",
|
|
54
|
-
"less": "^4.2.0",
|
|
55
|
-
"react-selectable-fast": "^3.4.0",
|
|
56
|
-
"storybook": "^7.4.0",
|
|
57
|
-
"typescript": "^5.0.2",
|
|
58
|
-
"vite": "^4.4.5"
|
|
31
|
+
"config": {
|
|
32
|
+
"commitizen": {
|
|
33
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
34
|
+
}
|
|
59
35
|
},
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
36
|
+
"lint-staged": {
|
|
37
|
+
"*.{md,json}": [
|
|
38
|
+
"prettier --write --no-error-on-unmatched-pattern"
|
|
39
|
+
],
|
|
40
|
+
"*.{css,less}": [
|
|
41
|
+
"stylelint --fix",
|
|
42
|
+
"prettier --write"
|
|
43
|
+
],
|
|
44
|
+
"*.{js,jsx}": [
|
|
45
|
+
"eslint --fix",
|
|
46
|
+
"prettier --write"
|
|
47
|
+
],
|
|
48
|
+
"*.{ts,tsx}": [
|
|
49
|
+
"eslint --fix",
|
|
50
|
+
"prettier --parser=typescript --write"
|
|
51
|
+
]
|
|
72
52
|
},
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@changesets/cli": "^2.29.2",
|
|
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"
|
|
77
74
|
}
|
|
78
75
|
}
|
|
File without changes
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
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]);
|
|
@@ -0,0 +1,34 @@
|
|
|
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;
|