Package Exports
- @swzs/erp-common
- @swzs/erp-common/es/index.js
- @swzs/erp-common/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@swzs/erp-common) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@swzs/erp-common
ERP通用组件库,基于React + TypeScript + Ant Design开发,提供可复用的组件、样式和资源。
🚀 特性
- 📦 开箱即用: 基于Ant Design设计语言,提供高质量React组件
- 🎯 TypeScript: 完整的类型定义,更好的开发体验
- 🎨 主题定制: 支持主题定制,满足不同业务需求
- 📱 响应式: 支持移动端和桌面端
- 🔧 工程化: 完整的开发工具链,支持多种模块格式
- 🌍 国际化: 支持多语言
- ⚡ 性能优化: 支持按需加载
📦 安装
# npm
npm install @swzs/erp-common
# yarn
yarn add @swzs/erp-common
# pnpm
pnpm add @swzs/erp-common🔨 使用
基础用法
import React from 'react';
import { DictSelect, CountrySelect, StatusIcons } from '@swzs/erp-common';
function App() {
return (
<div>
{/* 字典选择组件 */}
<DictSelect
dictType="USER_STATUS"
onLoadDict={fetchDictData}
onChange={value => console.log(value)}
/>
{/* 国家选择组件 */}
<CountrySelect
open={true}
onLoadCountry={fetchCountryData}
onChange={codes => console.log(codes)}
/>
{/* 图标使用 */}
<StatusIcons.success />
</div>
);
}样式引入
// 在你的应用入口文件中引入样式
import '@swzs/erp-common/dist/erp-common.min.css';📚 组件文档
字典组件
DictSelect- 字典选择器DictRadio- 字典单选框DictCheckbox- 字典复选框DictTree- 字典树形选择DictTreeSelect- 字典树形下拉选择
业务组件
CountrySelect- 国家选择器Button- 通用按钮
图标模块
StatusIcons- 状态图标ActionIcons- 操作图标BusinessIcons- 业务图标IconFont- Iconfont图标
Hooks
useDict- 字典数据管理useCountry- 国家数据管理
🔗 依赖
同伴依赖 (peerDependencies)
{
"react": ">=16.9.0",
"react-dom": ">=16.9.0",
"antd": ">=5.0.0"
}确保你的项目中已安装这些依赖。
🛠️ 开发
# 克隆仓库
git clone https://github.com/your-username/erp-common.git
# 安装依赖
cd erp-common
npm install
# 启动开发服务器
npm run dev
# 构建
npm run build
# 运行测试
npm test
# 类型检查
npm run type-check📋 目录结构
erp-common/
├── src/ # 源码目录
│ ├── components/ # 组件
│ ├── hooks/ # Hooks
│ ├── icons/ # 图标模块
│ ├── styles/ # 样式
│ ├── types/ # 类型定义
│ └── utils/ # 工具函数
├── docs/ # 文档
├── lib/ # CommonJS 构建产物
├── es/ # ES Module 构建产物
└── dist/ # UMD 构建产物🤝 贡献
欢迎提交 Issue 和 Pull Request!