bi-components-library 1.0.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/README.md +221 -0
- package/dist/index.es.js +1557 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +33 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +60 -0
package/README.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# SealSeek BI 组件库
|
|
2
|
+
|
|
3
|
+
基于 Ant Design 的企业级 React 组件库,专为 BI 业务场景设计。
|
|
4
|
+
|
|
5
|
+
## 📦 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @sealseek/bi-components
|
|
9
|
+
# 或
|
|
10
|
+
yarn add @sealseek/bi-components
|
|
11
|
+
# 或
|
|
12
|
+
pnpm add @sealseek/bi-components
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 🚀 快速开始
|
|
16
|
+
|
|
17
|
+
### 1. 安装依赖
|
|
18
|
+
|
|
19
|
+
确保您的项目已安装必要的依赖:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install react react-dom antd @ant-design/icons
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2. 引入组件
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import React from 'react';
|
|
29
|
+
import { ConfigProvider } from 'antd';
|
|
30
|
+
import {
|
|
31
|
+
Button,
|
|
32
|
+
Card,
|
|
33
|
+
DynamicInput,
|
|
34
|
+
DynamicTextArea,
|
|
35
|
+
AdvancedTable,
|
|
36
|
+
lightTheme
|
|
37
|
+
} from '@sealseek/bi-components';
|
|
38
|
+
|
|
39
|
+
function App() {
|
|
40
|
+
return (
|
|
41
|
+
<ConfigProvider theme={lightTheme}>
|
|
42
|
+
<div>
|
|
43
|
+
<Button type="primary">基础按钮</Button>
|
|
44
|
+
|
|
45
|
+
<DynamicInput
|
|
46
|
+
texts={["请输入用户名", "请输入邮箱", "请输入手机号"]}
|
|
47
|
+
placeholder="请输入内容"
|
|
48
|
+
/>
|
|
49
|
+
|
|
50
|
+
<DynamicTextArea
|
|
51
|
+
texts={["描述您的需求", "详细说明问题", "提供更多信息"]}
|
|
52
|
+
placeholder="请输入详细内容"
|
|
53
|
+
maxLength={500}
|
|
54
|
+
showCount={true}
|
|
55
|
+
onSubmit={(value) => console.log('提交:', value)}
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
</ConfigProvider>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default App;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 🎨 组件列表
|
|
66
|
+
|
|
67
|
+
### 基础组件
|
|
68
|
+
- **Button** - 增强的按钮组件
|
|
69
|
+
- **Card** - 卡片容器组件
|
|
70
|
+
|
|
71
|
+
### 业务组件
|
|
72
|
+
- **AppModal** - 应用级模态框
|
|
73
|
+
- **PageTable** - 页面级表格
|
|
74
|
+
- **AdvancedTable** - 高级表格(支持搜索、排序、分页)
|
|
75
|
+
- **XcIcon** - 自定义图标组件
|
|
76
|
+
- **EmptyAndSpin** - 空状态和加载状态
|
|
77
|
+
- **BackButton** - 返回按钮
|
|
78
|
+
- **LinkButton** - 链接样式按钮
|
|
79
|
+
|
|
80
|
+
### 动态组件
|
|
81
|
+
- **DynamicInput** - 动态文案输入框
|
|
82
|
+
- **DynamicTextArea** - 动态文案文本域
|
|
83
|
+
|
|
84
|
+
## 🔧 高级用法
|
|
85
|
+
|
|
86
|
+
### DynamicInput 动态输入框
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import { DynamicInput } from '@sealseek/bi-components';
|
|
90
|
+
|
|
91
|
+
function MyComponent() {
|
|
92
|
+
const [value, setValue] = useState('');
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<DynamicInput
|
|
96
|
+
texts={["搜索商品", "搜索用户", "搜索订单"]}
|
|
97
|
+
placeholder="请输入搜索关键词"
|
|
98
|
+
animationSpeed={80}
|
|
99
|
+
autoPlay={true}
|
|
100
|
+
value={value}
|
|
101
|
+
onChange={setValue}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### DynamicTextArea 动态文本域
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
import { DynamicTextArea } from '@sealseek/bi-components';
|
|
111
|
+
|
|
112
|
+
function MyComponent() {
|
|
113
|
+
const handleSubmit = (value: string) => {
|
|
114
|
+
console.log('提交内容:', value);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<DynamicTextArea
|
|
119
|
+
texts={[
|
|
120
|
+
"描述您的业务需求",
|
|
121
|
+
"详细说明技术问题",
|
|
122
|
+
"提供更多背景信息"
|
|
123
|
+
]}
|
|
124
|
+
placeholder="请输入详细内容"
|
|
125
|
+
maxLength={1000}
|
|
126
|
+
showCount={true}
|
|
127
|
+
submitText="发送"
|
|
128
|
+
onSubmit={handleSubmit}
|
|
129
|
+
/>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### AdvancedTable 高级表格
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
import { AdvancedTable } from '@sealseek/bi-components';
|
|
138
|
+
|
|
139
|
+
const columns = [
|
|
140
|
+
{
|
|
141
|
+
title: '姓名',
|
|
142
|
+
dataIndex: 'name',
|
|
143
|
+
key: 'name',
|
|
144
|
+
searchable: true,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
title: '年龄',
|
|
148
|
+
dataIndex: 'age',
|
|
149
|
+
key: 'age',
|
|
150
|
+
sorter: true,
|
|
151
|
+
},
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
function MyTable() {
|
|
155
|
+
const fetchData = async (params: any) => {
|
|
156
|
+
// 您的数据获取逻辑
|
|
157
|
+
return {
|
|
158
|
+
data: [],
|
|
159
|
+
total: 0,
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
return (
|
|
164
|
+
<AdvancedTable
|
|
165
|
+
columns={columns}
|
|
166
|
+
fetchData={fetchData}
|
|
167
|
+
autoLoad={true}
|
|
168
|
+
/>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## 🎨 主题定制
|
|
174
|
+
|
|
175
|
+
组件库提供了默认的明亮主题,您也可以自定义主题:
|
|
176
|
+
|
|
177
|
+
```tsx
|
|
178
|
+
import { ConfigProvider } from 'antd';
|
|
179
|
+
import { lightTheme } from '@sealseek/bi-components';
|
|
180
|
+
|
|
181
|
+
const customTheme = {
|
|
182
|
+
...lightTheme,
|
|
183
|
+
token: {
|
|
184
|
+
...lightTheme.token,
|
|
185
|
+
colorPrimary: '#1890ff',
|
|
186
|
+
borderRadius: 8,
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
function App() {
|
|
191
|
+
return (
|
|
192
|
+
<ConfigProvider theme={customTheme}>
|
|
193
|
+
{/* 您的应用 */}
|
|
194
|
+
</ConfigProvider>
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## 📝 TypeScript 支持
|
|
200
|
+
|
|
201
|
+
组件库完全使用 TypeScript 编写,提供完整的类型定义:
|
|
202
|
+
|
|
203
|
+
```tsx
|
|
204
|
+
import type {
|
|
205
|
+
DynamicInputProps,
|
|
206
|
+
DynamicTextAreaProps
|
|
207
|
+
} from '@sealseek/bi-components';
|
|
208
|
+
|
|
209
|
+
interface MyProps {
|
|
210
|
+
inputProps: DynamicInputProps;
|
|
211
|
+
textareaProps: DynamicTextAreaProps;
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## 🤝 贡献
|
|
216
|
+
|
|
217
|
+
欢迎提交 Issue 和 Pull Request!
|
|
218
|
+
|
|
219
|
+
## 📄 许可证
|
|
220
|
+
|
|
221
|
+
MIT License
|