crud-page-react 0.1.0 → 0.1.1

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 +48 -9
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -47,10 +47,22 @@ const schema: CrudPageSchema = {
47
47
  id: 'users',
48
48
  title: '用户管理',
49
49
  api: {
50
- list: '/api/users',
51
- create: '/api/users',
52
- update: '/api/users/:id',
53
- delete: '/api/users/:id',
50
+ list: {
51
+ url: '/api/users',
52
+ method: 'GET'
53
+ },
54
+ create: {
55
+ url: '/api/users',
56
+ method: 'POST'
57
+ },
58
+ update: {
59
+ url: '/api/users/:id',
60
+ method: 'PUT'
61
+ },
62
+ delete: {
63
+ url: '/api/users/:id',
64
+ method: 'DELETE'
65
+ },
54
66
  },
55
67
  fields: [
56
68
  {
@@ -109,17 +121,20 @@ export default App;
109
121
 
110
122
  ### 扩展 API 配置
111
123
 
112
- v0.0.7+ 版本支持更强大的 API 配置,包括自定义 HTTP 方法、请求头、请求体数据和模板变量:
124
+ v0.1.0+ 版本要求使用完整的 API 配置对象,支持自定义 HTTP 方法、请求头、请求体数据和模板变量:
113
125
 
114
126
  ```tsx
115
127
  const advancedSchema: CrudPageSchema = {
116
128
  id: 'orders',
117
129
  title: '订单管理',
118
130
  api: {
119
- // 简单字符串配置(向后兼容)
120
- list: '/api/orders',
131
+ // 基础配置
132
+ list: {
133
+ url: '/api/orders',
134
+ method: 'GET'
135
+ },
121
136
 
122
- // 扩展对象配置
137
+ // 扩展配置
123
138
  create: {
124
139
  url: '/api/orders',
125
140
  method: 'POST',
@@ -156,7 +171,7 @@ const advancedSchema: CrudPageSchema = {
156
171
  };
157
172
  ```
158
173
 
159
- ### 支持的扩展配置
174
+ ### 支持的配置选项
160
175
 
161
176
  - **HTTP 方法**:GET、POST、PUT、PATCH、DELETE
162
177
  - **自定义请求头**:添加认证、来源标识等
@@ -164,6 +179,30 @@ const advancedSchema: CrudPageSchema = {
164
179
  - **模板变量**:`{{fieldName}}` 格式的动态值替换
165
180
  - **URL 占位符**:`:fieldName` 格式的动态 URL 构建
166
181
 
182
+ ### 💥 Breaking Changes (v0.1.0)
183
+
184
+ v0.1.0 版本移除了简单字符串配置支持,所有 API 配置必须使用对象格式:
185
+
186
+ ```tsx
187
+ // ❌ 不再支持 (v0.0.x)
188
+ api: {
189
+ list: '/api/users',
190
+ create: '/api/users'
191
+ }
192
+
193
+ // ✅ 必须使用 (v0.1.0+)
194
+ api: {
195
+ list: {
196
+ url: '/api/users',
197
+ method: 'GET'
198
+ },
199
+ create: {
200
+ url: '/api/users',
201
+ method: 'POST'
202
+ }
203
+ }
204
+ ```
205
+
167
206
  ## 动态 URL 参数
168
207
 
169
208
  支持在 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.1",
4
4
  "description": "一个基于 React + Ant Design 的动态 CRUD 组件库,支持通过 JSON Schema 配置生成完整的增删改查界面",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",