crud-page-react 0.1.0 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +56 -9
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  一个基于 React + Ant Design 的动态 CRUD 组件库,支持通过 JSON Schema 配置生成完整的增删改查界面。
4
4
 
5
+ ## 🌐 在线演示
6
+
7
+ **[https://crud.fufanghao.space/](https://crud.fufanghao.space/)**
8
+
9
+ - 🎮 **Demo 示例** - 查看完整功能演示和字段类型
10
+ - 🛠️ **配置生成器** - 可视化配置工具,零代码生成 CRUD 页面
11
+ - 🤖 **AI 提示词** - 使用 AI 从接口文档生成配置
12
+
5
13
  ## 特性
6
14
 
7
15
  - 🚀 **零代码配置** - 通过 JSON Schema 配置即可生成完整 CRUD 界面
@@ -47,10 +55,22 @@ const schema: CrudPageSchema = {
47
55
  id: 'users',
48
56
  title: '用户管理',
49
57
  api: {
50
- list: '/api/users',
51
- create: '/api/users',
52
- update: '/api/users/:id',
53
- delete: '/api/users/:id',
58
+ list: {
59
+ url: '/api/users',
60
+ method: 'GET'
61
+ },
62
+ create: {
63
+ url: '/api/users',
64
+ method: 'POST'
65
+ },
66
+ update: {
67
+ url: '/api/users/:id',
68
+ method: 'PUT'
69
+ },
70
+ delete: {
71
+ url: '/api/users/:id',
72
+ method: 'DELETE'
73
+ },
54
74
  },
55
75
  fields: [
56
76
  {
@@ -109,17 +129,20 @@ export default App;
109
129
 
110
130
  ### 扩展 API 配置
111
131
 
112
- v0.0.7+ 版本支持更强大的 API 配置,包括自定义 HTTP 方法、请求头、请求体数据和模板变量:
132
+ v0.1.0+ 版本要求使用完整的 API 配置对象,支持自定义 HTTP 方法、请求头、请求体数据和模板变量:
113
133
 
114
134
  ```tsx
115
135
  const advancedSchema: CrudPageSchema = {
116
136
  id: 'orders',
117
137
  title: '订单管理',
118
138
  api: {
119
- // 简单字符串配置(向后兼容)
120
- list: '/api/orders',
139
+ // 基础配置
140
+ list: {
141
+ url: '/api/orders',
142
+ method: 'GET'
143
+ },
121
144
 
122
- // 扩展对象配置
145
+ // 扩展配置
123
146
  create: {
124
147
  url: '/api/orders',
125
148
  method: 'POST',
@@ -156,7 +179,7 @@ const advancedSchema: CrudPageSchema = {
156
179
  };
157
180
  ```
158
181
 
159
- ### 支持的扩展配置
182
+ ### 支持的配置选项
160
183
 
161
184
  - **HTTP 方法**:GET、POST、PUT、PATCH、DELETE
162
185
  - **自定义请求头**:添加认证、来源标识等
@@ -164,6 +187,30 @@ const advancedSchema: CrudPageSchema = {
164
187
  - **模板变量**:`{{fieldName}}` 格式的动态值替换
165
188
  - **URL 占位符**:`:fieldName` 格式的动态 URL 构建
166
189
 
190
+ ### 💥 Breaking Changes (v0.1.0)
191
+
192
+ v0.1.0 版本移除了简单字符串配置支持,所有 API 配置必须使用对象格式:
193
+
194
+ ```tsx
195
+ // ❌ 不再支持 (v0.0.x)
196
+ api: {
197
+ list: '/api/users',
198
+ create: '/api/users'
199
+ }
200
+
201
+ // ✅ 必须使用 (v0.1.0+)
202
+ api: {
203
+ list: {
204
+ url: '/api/users',
205
+ method: 'GET'
206
+ },
207
+ create: {
208
+ url: '/api/users',
209
+ method: 'POST'
210
+ }
211
+ }
212
+ ```
213
+
167
214
  ## 动态 URL 参数
168
215
 
169
216
  支持在 API 配置中使用任意字段作为 URL 参数:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crud-page-react",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "一个基于 React + Ant Design 的动态 CRUD 组件库,支持通过 JSON Schema 配置生成完整的增删改查界面",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",