openxiangda-skill-kit 2.1.4 → 2.1.5
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openxiangda-skill-kit",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"description": "OpenXiangda 2.0 中文 AI 技能的校验、分发与安装。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"openxiangda-devkit-core": "2.
|
|
20
|
+
"openxiangda-devkit-core": "2.13.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"tsx": "4.23.12",
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
| 规则 | 正确写法 |
|
|
8
8
|
| --- | --- |
|
|
9
9
|
| `crud[].model` 必须引用本模块已声明的模型 | `crud: [{ model: 'repair-requests', ... }]` |
|
|
10
|
+
| `user: true` 一行声明即可生成用户端标准面(“我的记录”列表 + 提交表单,双端),并自动成为登录落地页 | `crud: [{ model: 'supply-requests', user: true, ... }]`;多资源时 `user: { home: true }` 指定落地资源,“仅本人”是展示过滤,行级隔离仍用 dataPolicies |
|
|
10
11
|
| 视图 `list`/`form`/`detail` 的 `model` 可省略(继承视图模型);显式声明时必须与 `crud[].model` 一致 | `list: { fields: [...] }` 即可,不必写 `model` |
|
|
11
12
|
| 每个模型最多 20 个命名视图;命名视图需要稳定 `code` + `name` | `crud: [{ model: 'x', code: 'x-active', name: '进行中', ... }]` |
|
|
12
13
|
| 新建视图的 `form.fields` 必须覆盖全部无默认必填字段,或显式 `generated.create: false` | 检查器会列出缺失字段 |
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
| `audit.read` 可写 `true`(绑定本资源读能力)或能力数组 | `audit: { read: true }` |
|
|
22
23
|
| `resource-ref.*` 必须带 `source` 来源协议 | `{ type: 'resource-ref.single', source: { kind: 'resource', resourceCode: 'repair-requests', labelField: 'title', searchFields: ['title'], pageSize: 20, loadMode: 'search' } }` |
|
|
23
24
|
| `labelField` 必须指向目标资源的 `text.short` / `text.long` 字段 | 不要用流水号/选项字段当 label |
|
|
25
|
+
| 每个字段都必须带中文/业务 `label`(含子表外键与排序字段) | `{ code: 'requestId', type: 'uuid', label: '所属申请', required: true }` |
|
|
24
26
|
| 子表 `subtable` 的外键是子资源的 **uuid** 字段,排序字段是**可写 number.integer** | 子资源:`{ code: 'requestId', type: 'uuid', required: true }` + `{ code: 'sortOrder', type: 'number.integer', required: true }`;父表:`subtable: { resourceCode: 'repair-items', foreignKey: 'requestId', orderField: 'sortOrder', maxRows: 20 }` |
|
|
25
27
|
| 图片/附件的 `file` 限定数量与大小 | `file: { maxCount: 3, maxSizeMb: 10, accept: ['image/png', 'image/jpeg'] }` |
|
|
26
28
|
|
|
@@ -120,11 +122,12 @@ const requests = {
|
|
|
120
122
|
const items = {
|
|
121
123
|
code: 'request-items', name: '明细',
|
|
122
124
|
fields: [
|
|
123
|
-
|
|
124
|
-
{ code: '
|
|
125
|
-
{ code: '
|
|
126
|
-
{ code: '
|
|
127
|
-
{ code: '
|
|
125
|
+
// 所有字段(含子表外键/排序)都必须声明中文 label。
|
|
126
|
+
{ code: 'requestId', type: 'uuid', label: '所属申请', required: true },
|
|
127
|
+
{ code: 'sortOrder', type: 'number.integer', label: '排序', required: true },
|
|
128
|
+
{ code: 'name', type: 'text.short', label: '名称', required: true },
|
|
129
|
+
{ code: 'qty', type: 'number.integer', label: '数量' },
|
|
130
|
+
{ code: 'price', type: 'number.decimal', label: '单价', precision: 12, scale: 2 },
|
|
128
131
|
],
|
|
129
132
|
};
|
|
130
133
|
|
|
@@ -63,7 +63,22 @@ capability、应用角色和数据策略。前端只根据当前登录用户完
|
|
|
63
63
|
可替换 Data API adapter。不要调用自定义 Nest CRUD、Function 或 Workflow 来绕过
|
|
64
64
|
Data API。只有真正需要事务或外部系统的动作才使用同源 `/api`。
|
|
65
65
|
|
|
66
|
-
###
|
|
66
|
+
### 生成式用户标准面 {#user-surface}
|
|
67
|
+
|
|
68
|
+
对普通用户(登录基线角色)开放提交的 CRUD 资源,在 CRUD 视图上声明 `user: true` 即可获得
|
|
69
|
+
开箱即用的用户端标准页,无需编写任何 React 代码:
|
|
70
|
+
|
|
71
|
+
- “我的记录”列表(`/my/<resource>`,移动端 `/m/my/<resource>`):默认仅显示当前登录用户
|
|
72
|
+
创建的记录(`created_by` 展示过滤),支持分页、行详情抽屉与“提交”入口。
|
|
73
|
+
- “提交”表单(`/my/<resource>/submit`):复用标准字段渲染与文件上传,成功后回到列表。
|
|
74
|
+
- 首页接线:首个启用资源自动成为登录落地页与根路径;多资源时用 `user: { home: true }` 显式指定;
|
|
75
|
+
声明的 `/home` 占位路由保留可用,也可以继续用自定义页面覆盖用户端体验。
|
|
76
|
+
- 能力接线自动完成:列表要求资源 read,提交要求 create;无能力的用户看到标准 403 面。
|
|
77
|
+
|
|
78
|
+
注意:“仅本人”是页面展示过滤,不是授权边界。需要服务端强制行级隔离时按[数据与权限](data-authz.md)
|
|
79
|
+
声明 dataPolicies。
|
|
80
|
+
|
|
81
|
+
## 自定义页面消费平台数据 {#data-access}
|
|
67
82
|
|
|
68
83
|
自定义报表、工具页和用户端页面从 `openxiangda/core` 导入 `createNativeResourceClient`,
|
|
69
84
|
用生成契约里的 surface 直接获得该资源的权威读写客户端;行、字段与操作授权由平台在
|