@amaster.ai/pi-lark 0.1.2-beta.42 → 0.1.2-beta.44

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 (35) hide show
  1. package/package.json +3 -3
  2. package/skills/lark-approval/references/lark-approval-initiate.md +2 -5
  3. package/skills/lark-approval/references/lark-approval-instances-initiated.md +6 -0
  4. package/skills/lark-approval/references/lark-approval-tasks-query.md +9 -0
  5. package/skills/lark-approval/references/lark-approval-tasks-rollback.md +8 -2
  6. package/skills/lark-apps/SKILL.md +16 -10
  7. package/skills/lark-apps/references/lark-apps-access-scope-set.md +1 -1
  8. package/skills/lark-apps/references/lark-apps-db-execute.md +185 -1
  9. package/skills/lark-apps/references/lark-apps-db.md +1 -1
  10. package/skills/lark-apps/references/lark-apps-role.md +133 -0
  11. package/skills/lark-base/SKILL.md +6 -2
  12. package/skills/lark-base/references/dashboard-block-data-config.md +28 -2
  13. package/skills/lark-base/references/lark-base-cell-value.md +9 -4
  14. package/skills/lark-base/references/lark-base-dashboard.md +11 -2
  15. package/skills/lark-base/references/lark-base-data-query.md +9 -7
  16. package/skills/lark-base/references/lark-base-field-create.md +4 -2
  17. package/skills/lark-base/references/lark-base-field-json.md +52 -15
  18. package/skills/lark-base/references/lark-base-field-update.md +4 -2
  19. package/skills/lark-base/references/lark-base-view-set-filter.md +3 -1
  20. package/skills/lark-drive/SKILL.md +4 -2
  21. package/skills/lark-drive/references/lark-drive-delete.md +23 -11
  22. package/skills/lark-drive/references/lark-drive-move.md +5 -3
  23. package/skills/lark-drive/references/lark-drive-task-result.md +58 -5
  24. package/skills/lark-event/SKILL.md +2 -1
  25. package/skills/lark-event/references/lark-event-approval.md +170 -0
  26. package/skills/lark-slides/references/slides_xml_schema_definition.xml +7 -2
  27. package/skills/lark-slides/references/xml-format-guide.md +15 -0
  28. package/skills/lark-slides/scripts/xml_text_overlap_lint.py +264 -6
  29. package/skills/lark-slides/scripts/xml_text_overlap_lint_test.py +348 -6
  30. package/skills/lark-vc/SKILL.md +6 -3
  31. package/skills/lark-vc/references/vc-domain-boundaries.md +9 -1
  32. package/skills/lark-vc-agent/SKILL.md +1 -1
  33. package/skills/lark-wiki/SKILL.md +4 -2
  34. package/skills/lark-wiki/references/lark-wiki-move-to-drive.md +122 -0
  35. package/skills/lark-wiki/references/lark-wiki-move.md +5 -3
@@ -3,7 +3,7 @@
3
3
 
4
4
  > **前置条件:** 先阅读 [`../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) 了解认证、全局参数和安全规则。
5
5
 
6
- 查询异步任务结果。该 shortcut 聚合了导入、导出、移动/删除文件夹、Wiki 节点 / 文档迁入 Wiki 等多种异步任务的结果查询,统一接口方便调用。
6
+ 查询异步任务结果。该 shortcut 聚合了导入、导出、Drive 文件/文件夹移动/删除、Wiki 节点 / 文档迁入 Wiki、Wiki 节点移出 Wiki、Wiki 删除等多种异步任务的结果查询,统一接口方便调用。
7
7
 
8
8
  > [!IMPORTANT]
9
9
  > 对于 `import` 场景,如果使用 `--as bot` 且这次查询**已经拿到最终在线文档目标**(`ready=true` 且返回了最终 `token` / `url`),CLI 会**再次尝试为当前 CLI 用户自动授予该资源的 `full_access`(可管理权限)**。
@@ -31,7 +31,7 @@ lark-cli drive +task_result \
31
31
  --ticket <EXPORT_TICKET> \
32
32
  --file-token <SOURCE_DOC_TOKEN>
33
33
 
34
- # 查询移动/删除文件夹任务状态
34
+ # 查询 Drive 文件/文件夹移动/删除任务状态
35
35
  lark-cli drive +task_result \
36
36
  --scenario task_check \
37
37
  --task-id <TASK_ID>
@@ -41,6 +41,11 @@ lark-cli drive +task_result \
41
41
  --scenario wiki_move \
42
42
  --task-id <TASK_ID>
43
43
 
44
+ # 查询 Wiki 节点移出知识库任务结果(wiki +move-to-drive 异步超时后的续跑)
45
+ lark-cli drive +task_result \
46
+ --scenario wiki_move_to_drive \
47
+ --task-id <TASK_ID>
48
+
44
49
  # 查询 Wiki 删除知识空间任务结果(wiki +delete-space 异步超时后的续跑)
45
50
  lark-cli drive +task_result \
46
51
  --scenario wiki_delete_space \
@@ -51,9 +56,9 @@ lark-cli drive +task_result \
51
56
 
52
57
  | 参数 | 必填 | 说明 |
53
58
  |------|------|------|
54
- | `--scenario` | 是 | 任务场景,可选值:`import` (导入任务)、`export` (导出任务)、`task_check` (移动/删除文件夹任务)、`wiki_move` (Wiki 移动任务)、`wiki_delete_space` (Wiki 删除知识空间任务) |
59
+ | `--scenario` | 是 | 任务场景,可选值:`import` (导入任务)、`export` (导出任务)、`task_check` (Drive 文件/文件夹移动/删除任务)、`wiki_move` (Wiki 移动任务)、`wiki_move_to_drive` (Wiki 节点移出知识库任务)、`wiki_delete_space` (Wiki 删除知识空间任务)、`wiki_delete_node` (Wiki 删除节点任务) |
55
60
  | `--ticket` | 条件必填 | 异步任务 ticket,**import/export 场景必填** |
56
- | `--task-id` | 条件必填 | 异步任务 ID,**task_check / wiki_move / wiki_delete_space 场景必填** |
61
+ | `--task-id` | 条件必填 | 异步任务 ID,**task_check 及所有 wiki 场景必填**;必须原样传递完整 ID |
57
62
  | `--file-token` | 条件必填 | 导出任务对应的源文档 token,**export 场景必填** |
58
63
 
59
64
  ## 场景说明
@@ -62,9 +67,11 @@ lark-cli drive +task_result \
62
67
  |------|------|----------|
63
68
  | `import` | 文档导入任务(如将本地文件导入为云文档) | `--ticket` |
64
69
  | `export` | 文档导出任务(如云文档导出为 PDF/Word) | `--ticket`、`--file-token` |
65
- | `task_check` | 文件夹移动/删除任务 | `--task-id` |
70
+ | `task_check` | Drive 文件/文件夹移动/删除任务 | `--task-id` |
66
71
  | `wiki_move` | Wiki 移动任务(`wiki +move` 的 docs-to-wiki 异步流程,超时后续跑用) | `--task-id` |
72
+ | `wiki_move_to_drive` | Wiki 节点移出知识库任务(`wiki +move-to-drive` 超时后续跑用) | `--task-id` |
67
73
  | `wiki_delete_space` | Wiki 删除知识空间任务(`wiki +delete-space` 的异步流程,超时后续跑用) | `--task-id` |
74
+ | `wiki_delete_node` | Wiki 删除节点任务(`wiki +node-delete` 的异步流程,超时后续跑用) | `--task-id` |
68
75
 
69
76
  ## 返回结果
70
77
 
@@ -196,6 +203,29 @@ lark-cli drive +task_result \
196
203
  - `space_id`、`obj_token`、`obj_type`、`title` 等:从首个 `move_results[0].node` 平铺到顶层,方便直接引用
197
204
  - `move_results`: 保留完整列表(适用于一次任务移动多个文档的场景)
198
205
 
206
+ ### Wiki_move_to_drive 场景返回
207
+
208
+ ```json
209
+ {
210
+ "scenario": "wiki_move_to_drive",
211
+ "task_id": "<OPAQUE_TASK_ID>",
212
+ "ready": true,
213
+ "failed": false,
214
+ "status": 0,
215
+ "status_msg": "success",
216
+ "obj_token": "doxcnXXX",
217
+ "obj_type": "docx",
218
+ "url": "https://example.feishu.cn/docx/doxcnXXX"
219
+ }
220
+ ```
221
+
222
+ **字段说明:**
223
+ - `ready`: `move_wiki_to_docs_result.status=0` 时为 `true`
224
+ - `failed`: `status<0` 时为 `true`;`status=1` 表示仍在处理
225
+ - `status` / `status_msg`: 协议返回的数值状态与可读消息;不要把字符串状态当作成功值解析
226
+ - `obj_token` / `obj_type` / `url`: 成功后新 Drive 文档的资源信息
227
+ - `task_id`: 签名后的 opaque ID,可能包含多个连字符;服务端响应省略 `task.task_id` 时回退为请求中的完整 ID
228
+
199
229
  ### Wiki_delete_space 场景返回
200
230
 
201
231
  ```json
@@ -256,6 +286,26 @@ lark-cli drive +task_result --scenario wiki_move --task-id <TASK_ID> --as user
256
286
 
257
287
  > **身份保持一致**:续跑命令的 `--as` 必须与原 `wiki +move` 调用一致;`wiki +move` 的 `next_command` 已自动带上正确的 `--as`。
258
288
 
289
+ ### 配合 wiki +move-to-drive 使用
290
+
291
+ ```bash
292
+ # 1. 把 Wiki 节点移到 Drive 文件夹;省略 --folder-token 表示当前身份的“我的空间”根目录
293
+ lark-cli wiki +move-to-drive \
294
+ --node-token <WIKI_NODE_TOKEN> \
295
+ --folder-token <TARGET_FOLDER_TOKEN> \
296
+ --as user
297
+ # 若轮询窗口内完成:直接返回 ready=true、obj_token、obj_type 和 url
298
+ # 若轮询窗口结束仍未完成:返回 ready=false、完整 task_id、timed_out=true 和 next_command
299
+
300
+ # 2. 使用完整 task_id 和相同身份续跑
301
+ lark-cli drive +task_result \
302
+ --scenario wiki_move_to_drive \
303
+ --task-id <COMPLETE_TASK_ID> \
304
+ --as user
305
+ ```
306
+
307
+ > **调用上下文和 ID 都要保持原样**:续跑的 `--profile` 与 `--as` 必须与初始移动一致;`task_id` 可能包含多个连字符,不要拆分或截断。`wiki +move-to-drive` 返回的 `next_command` 会保留 profile 与身份。
308
+
259
309
  ### 配合 wiki +delete-space 使用
260
310
 
261
311
  ```bash
@@ -291,7 +341,9 @@ lark-cli drive +export-download --file-token <EXPORTED_FILE_TOKEN>
291
341
  | export | `drive:drive.metadata:readonly` |
292
342
  | task_check | `drive:drive.metadata:readonly` |
293
343
  | wiki_move | `wiki:space:read` |
344
+ | wiki_move_to_drive | `wiki:space:read` |
294
345
  | wiki_delete_space | `wiki:space:read` |
346
+ | wiki_delete_node | `wiki:space:read` |
295
347
 
296
348
  > [!NOTE]
297
349
  > `import` 场景在 `--as bot` 且任务最终就绪时,还可能额外尝试一次协作者授权;如果 `permission_grant.status = failed`,请根据失败信息检查应用是否具备相应的文档协作者授权能力。
@@ -299,4 +351,5 @@ lark-cli drive +export-download --file-token <EXPORTED_FILE_TOKEN>
299
351
  ## 参考
300
352
 
301
353
  - [lark-drive](../SKILL.md) -- 云空间(云盘/云存储)全部命令
354
+ - [wiki +move-to-drive](../../lark-wiki/references/lark-wiki-move-to-drive.md) -- 将 Wiki 节点移出知识库并放入 Drive
302
355
  - [lark-shared](../../lark-shared/SKILL.md) -- 认证和全局参数
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: lark-event
3
3
  version: 1.0.0
4
- description: "Lark/Feishu real-time event listening / subscribing / consuming: stream events as NDJSON via `lark-cli event consume <EventKey>` (covers IM messages/reactions/chat changes, Task updates, VC meeting started/joined/ended, Minutes generated, Whiteboard updated, etc.). Use for Lark bots, real-time message processing, long-running subscribers, streaming webhook/push handlers. Supports `--max-events` / `--timeout` bounded runs and a stderr ready-marker contract — designed for AI agents running as subprocesses."
4
+ description: "Lark/Feishu real-time event listening / subscribing / consuming: stream events as NDJSON via `lark-cli event consume <EventKey>` (covers IM messages/reactions/chat changes, Approval status changes, Task updates, VC meeting started/joined/ended, Minutes generated, Whiteboard updated, etc.). Use for Lark bots, real-time message processing, long-running subscribers, streaming webhook/push handlers. Supports `--max-events` / `--timeout` bounded runs and a stderr ready-marker contract — designed for AI agents running as subprocesses."
5
5
  metadata:
6
6
  requires:
7
7
  bins: ["lark-cli"]
@@ -147,6 +147,7 @@ Lark-defined semantic tags (**not** JSON Schema's standard `format`). Common val
147
147
 
148
148
  | Topic | Reference | Coverage |
149
149
  |------------|------------------------------------------------------------------------------|---|
150
+ | Approval | [`references/lark-event-approval.md`](references/lark-event-approval.md) | Catalog of 2 Approval EventKeys (`approval.instance.status_changed_v4`, `approval.task.status_changed_v4`) + optional/multi `subscription_type` pre-registration + user-auth subscription lifecycle + flat output field reference |
150
151
  | IM | [`references/lark-event-im.md`](references/lark-event-im.md) | Catalog of 12 IM EventKeys + shape notes (flat vs V2 envelope) + `im.message.receive_v1` field gotchas (`sender_id` is open_id only; `.content` is plain text except for `interactive` cards) + common jq recipes (filter by chat_type / message_type / sender); for `card.action.trigger` see also [`../lark-im/references/lark-im-card-action-reply.md`](../lark-im/references/lark-im-card-action-reply.md) |
151
152
  | Task | [`references/lark-event-task.md`](references/lark-event-task.md) | Catalog of 1 Task EventKey (`task.task.update_user_access_v2`) + Native V2 envelope shape + task commit types + user/bot subscription notes |
152
153
  | VC | [`references/lark-event-vc.md`](references/lark-event-vc.md) | Catalog of 4 VC EventKeys (`vc.meeting.participant_meeting_started_v1`, `vc.meeting.participant_meeting_joined_v1`, `vc.meeting.participant_meeting_ended_v1`, `vc.note.generated_v1`) + field reference + source type semantics (meeting only) |
@@ -0,0 +1,170 @@
1
+ # Approval Events
2
+
3
+ > **Prerequisite:** Read [`../SKILL.md`](../SKILL.md) first for the `event consume` essentials (commands, subprocess contract, jq usage).
4
+
5
+ ## Key catalog (2)
6
+
7
+ | EventKey | Purpose |
8
+ |---|---|
9
+ | `approval.instance.status_changed_v4` | An approval instance status changed |
10
+ | `approval.task.status_changed_v4` | An approval task status changed |
11
+
12
+ Both keys use a **Custom schema**. The raw Lark schema 2.0 envelope is flattened: event metadata is exposed as `type`, `event_id`, and `timestamp`, while approval business fields are exposed at the top level.
13
+
14
+ Both keys carry a **PreConsume hook** that subscribes the current authorized user through the Approval subscription APIs before listening. The consumer intentionally does **not** unsubscribe on exit; the server-side Approval subscription relation remains until it is canceled outside `event consume`. These keys require `--as user`.
15
+
16
+ ## Listener and subscription selection
17
+
18
+ At the raw CLI level, each `event consume` process accepts exactly one EventKey. `approval.instance.status_changed_v4` and `approval.task.status_changed_v4` have different output shapes, so listening to both still means two processes.
19
+
20
+ For Approval only, `subscription_type` is an optional setup param used by PreConsume to register server-side Approval subscription relations before the local listener starts. It is **not** an output field, a local event filter, or a local subscription identity. The pushed event does not say which subscription relation caused delivery, and one business event can match both relations; deduplicate with `event_id` when needed.
21
+
22
+ `subscription_type` may be omitted, a single value, a comma-separated list, or a JSON string array:
23
+
24
+ ```bash
25
+ # Omitted: register both INVOLVED_APPROVAL and MANAGED_APPROVAL for this EventKey
26
+ lark-cli event consume approval.instance.status_changed_v4 --as user
27
+
28
+ # Single relation
29
+ lark-cli event consume approval.instance.status_changed_v4 \
30
+ -p subscription_type=INVOLVED_APPROVAL \
31
+ --as user
32
+
33
+ # Explicit multi-relation registration for one local consumer
34
+ lark-cli event consume approval.task.status_changed_v4 \
35
+ -p subscription_type=INVOLVED_APPROVAL,MANAGED_APPROVAL \
36
+ --as user
37
+
38
+ # JSON array form; quote it for the shell
39
+ lark-cli event consume approval.task.status_changed_v4 \
40
+ -p 'subscription_type=["INVOLVED_APPROVAL","MANAGED_APPROVAL"]' \
41
+ --as user
42
+ ```
43
+
44
+ | Value | Meaning |
45
+ |---|---|
46
+ | `INVOLVED_APPROVAL` | Receive events where the current user is the approval requester or approver |
47
+ | `MANAGED_APPROVAL` | Receive events under approval definitions managed by the current user |
48
+
49
+ User-intent inference:
50
+
51
+ | User intent | EventKey(s) | `subscription_type` |
52
+ |---|---|---|
53
+ | Mentions approval instances, approval forms, approval order/status, or "instance status" | `approval.instance.status_changed_v4` | infer from relation words below |
54
+ | Mentions approval tasks, approval todo items, approver operations, or "task status" | `approval.task.status_changed_v4` | infer from relation words below |
55
+ | Says "approval status changes/events" without saying task vs instance | both EventKeys | infer from relation words below |
56
+ | Says "my approvals", "approvals involving me", "I requested/approved", "待我审批", "我发起/我参与" | requested EventKey(s) | `INVOLVED_APPROVAL` |
57
+ | Says "approvals I manage", "managed definitions", "definitions managed by me", "我管理的审批定义" | requested EventKey(s) | `MANAGED_APPROVAL` |
58
+ | Explicitly asks for both involved and managed, or says "all approval subscriptions" | requested EventKey(s), or both if EventKey is also ambiguous | omit `subscription_type`, or pass both values in one `-p` |
59
+ | Relation is ambiguous and the user wants broad coverage | requested EventKey(s), or both if EventKey is also ambiguous | omit `subscription_type` so PreConsume registers both |
60
+
61
+ If the user's wording omits the relation and broad listening is acceptable, omit `subscription_type`. Ask only when registering both relations would be materially harmful.
62
+
63
+ ## Scopes & auth
64
+
65
+ | EventKey | Scope | Auth |
66
+ |---|---|---|
67
+ | `approval.instance.status_changed_v4` | `approval:instance:read` | user |
68
+ | `approval.task.status_changed_v4` | `approval:task:read` | user |
69
+
70
+ ## Subscription behavior
71
+
72
+ Startup calls the endpoint for the selected EventKey:
73
+
74
+ ```text
75
+ POST /open-apis/approval/v4/instances/subscription
76
+ POST /open-apis/approval/v4/tasks/subscription
77
+ ```
78
+
79
+ For each resolved `subscription_type`, PreConsume sends one request body:
80
+
81
+ ```json
82
+ {"subscription_type":"INVOLVED_APPROVAL"}
83
+ ```
84
+
85
+ If `subscription_type` is omitted, PreConsume sends two registration requests for that EventKey: one with `INVOLVED_APPROVAL`, then one with `MANAGED_APPROVAL`. If listening to both instance and task events, run two consumers; each consumer may omit `subscription_type` to register both relations for its own EventKey.
86
+
87
+ Do not start two consumers for the same Approval EventKey merely to split `INVOLVED_APPROVAL` and `MANAGED_APPROVAL`. The server push and flattened output are keyed by EventKey and cannot be distinguished by subscription relation.
88
+
89
+ Shutdown behavior:
90
+
91
+ `event consume` does not call the Approval unsubscribe APIs when it exits. This applies to graceful exit, Ctrl+C / SIGTERM, stdin EOF, `--timeout`, and `--max-events`.
92
+
93
+ To stop future delivery for a user, cancel the Approval subscription relation outside this consumer. The unsubscribe APIs are separate operations and are not called by `event consume`.
94
+
95
+ ## Output fields
96
+
97
+ Common fields:
98
+
99
+ | Field | Type | Description |
100
+ |---|---|---|
101
+ | `type` | string | Event type |
102
+ | `event_id` | string | Globally unique event ID; use for deduplication |
103
+ | `timestamp` | string (timestamp_ms) | Event delivery time in milliseconds, taken from `header.create_time` |
104
+
105
+ Instance event fields:
106
+
107
+ | Field | Type | Description |
108
+ |---|---|---|
109
+ | `approval_code` | string | Approval definition code; not a subscription dimension |
110
+ | `instance_code` | string | Approval instance code |
111
+ | `external_id` | string | Third-party approval instance id, when present |
112
+ | `status` | string enum | `PENDING`, `APPROVED`, `REJECTED`, `CANCELED`, `DELETED`, `REVERTED`, `OVERTIME_CLOSE`, `OVERTIME_RECOVER` |
113
+ | `operate_time` | string (timestamp_ms) | Status change time |
114
+ | `start_user` | object | Instance starter user IDs, omitted when unavailable |
115
+ | `start_user.open_id` | string (open_id) | Instance starter open_id, when present |
116
+ | `start_user.union_id` | string (union_id) | Instance starter union_id, when present |
117
+ | `start_user.user_id` | string (user_id) | Instance starter tenant user_id, when present |
118
+
119
+ Task event fields:
120
+
121
+ | Field | Type | Description |
122
+ |---|---|---|
123
+ | `approval_code` | string | Approval definition code; not a subscription dimension |
124
+ | `instance_code` | string | Approval instance code |
125
+ | `task_id` | string | Approval task id |
126
+ | `external_id` | string | Third-party approval external id, when present |
127
+ | `task_external_id` | string | Third-party task external id, when emitted |
128
+ | `assigned_user` | object | Task assignee or operator user IDs, omitted for automatic flows without an operator |
129
+ | `assigned_user.open_id` | string (open_id) | Task assignee or operator open_id, when present |
130
+ | `assigned_user.union_id` | string (union_id) | Task assignee or operator union_id, when present |
131
+ | `assigned_user.user_id` | string (user_id) | Task assignee or operator tenant user_id, when present |
132
+ | `status` | string enum | `REVERTED`, `PENDING`, `APPROVED`, `REJECTED`, `TRANSFERRED`, `ROLLBACK`, `DONE`, `OVERTIME_CLOSE`, `OVERTIME_RECOVER` |
133
+ | `operate_time` | string (timestamp_ms) | Status change time |
134
+
135
+ ## Examples
136
+
137
+ ```bash
138
+ # Stream approval instance updates broadly; registers both involved and managed relations
139
+ lark-cli event consume approval.instance.status_changed_v4 \
140
+ --as user
141
+
142
+ # Stream approval instance updates only for approvals involving the current user
143
+ lark-cli event consume approval.instance.status_changed_v4 \
144
+ -p subscription_type=INVOLVED_APPROVAL \
145
+ --as user
146
+
147
+ # Stream approval task updates for definitions managed by the current user
148
+ lark-cli event consume approval.task.status_changed_v4 \
149
+ -p subscription_type=MANAGED_APPROVAL \
150
+ --as user
151
+
152
+ # Broad approval status listening:
153
+ # run both EventKeys as separate processes; omit subscription_type so each registers both relations.
154
+ lark-cli event consume approval.instance.status_changed_v4 \
155
+ --as user > approval-instance.ndjson &
156
+ lark-cli event consume approval.task.status_changed_v4 \
157
+ --as user > approval-task.ndjson &
158
+ wait
159
+
160
+ # Listen to both involved and managed task subscriptions with one local consumer.
161
+ lark-cli event consume approval.task.status_changed_v4 \
162
+ -p subscription_type=INVOLVED_APPROVAL,MANAGED_APPROVAL \
163
+ --as user > approval-task.ndjson
164
+
165
+ # Project a compact approval-task record
166
+ lark-cli event consume approval.task.status_changed_v4 \
167
+ -p subscription_type=INVOLVED_APPROVAL \
168
+ --as user \
169
+ --jq '{event_id, task_id, status, at: .operate_time}'
170
+ ```
@@ -1464,6 +1464,7 @@
1464
1464
  <xs:annotation>
1465
1465
  <xs:documentation>
1466
1466
  表格元素, 用于展示结构化数据
1467
+ 宽高分配规则参考 HTML table 的整体值 / 子项值处理逻辑, 但在 SXSD 中做确定化约束, 以保证跨端实现一致。
1467
1468
  边框规则:
1468
1469
  - 后设置优先:相邻单元格线条只有一个颜色, 如果均设置, 则右下单元格的设置覆盖左上单元格
1469
1470
  - 不设置边框属性时使用默认样式
@@ -1476,6 +1477,8 @@
1476
1477
  - id: 表格唯一标识符(可选)
1477
1478
  - topLeftX/topLeftY: 左上角坐标
1478
1479
  - flipX/flipY: 水平/垂直翻转
1480
+ - width: 表格目标总宽度(可选)。若设置, 优先用于为未填写列宽的列分配剩余宽度; 当所有列宽均为空时, 所有列均分该值; 当所有列均已填写且该值大于已填写列宽总和时, 多出空间继续分配给现有列, 默认按各列当前宽度作为权重分配; 当已填写列宽之和超过或无法容纳该值时, 保留已填写列宽, 并以最终列宽总和回写 table.width
1481
+ - height: 表格目标总高度(可选)。若设置, 优先用于为未填写行高的行分配剩余高度; 当所有行高均为空时, 所有行均分该值; 当所有行均已填写且该值大于已填写行高总和时, 多出空间继续分配给现有行, 默认按各行当前高度作为权重分配; 当已填写行高之和超过或无法容纳该值时, 保留已填写行高, 并以最终行高总和回写 table.height
1479
1482
  table 子元素:
1480
1483
  - colgroup: 列组元素, 用于定义列的宽度
1481
1484
  - tr: 行元素, 包含多个单元格
@@ -1484,10 +1487,10 @@
1484
1487
  - col: 列元素
1485
1488
  col 属性:
1486
1489
  - span: 列跨数, 默认为1, 可选
1487
- - width: 列宽度, 默认值为110, 可选
1490
+ - width: 列宽度输入值, 默认值为110, 可选。无 table.width 时, 已填写列保持原值, 空列使用默认值; 有 table.width 时, 已填写列保持原值, 空列优先均分剩余宽度; 若不存在空列且 table.width 大于已填写列宽总和, 则多出空间按各列当前宽度作为权重分配到所有列; 若剩余宽度不足则空列回退为默认值, 并以最终列宽总和作为 table.width
1488
1491
 
1489
1492
  tr 属性:
1490
- - height: 行高, 默认为单元格高度
1493
+ - height: 行高输入值, 默认值为37, 可选。无 table.height 时, 已填写行保持原值, 空行使用默认值; 有 table.height 时, 已填写行保持原值, 空行优先均分剩余高度; 若不存在空行且 table.height 大于已填写行高总和, 则多出空间按各行当前高度作为权重分配到所有行; 若剩余高度不足则空行回退为默认值, 并以最终行高总和作为 table.height。若行高低于内容高度, 需要手动修改行高
1491
1494
  tr 子元素:
1492
1495
  - td: 单元格元素, 用于显示数据
1493
1496
 
@@ -1543,6 +1546,8 @@
1543
1546
  <xs:attribute name="topLeftY" type="sml:YType" use="required"/>
1544
1547
  <xs:attribute name="flipX" type="xs:boolean" use="optional" default="false"/>
1545
1548
  <xs:attribute name="flipY" type="xs:boolean" use="optional" default="false"/>
1549
+ <xs:attribute name="width" type="sml:PositiveSize" use="optional"/>
1550
+ <xs:attribute name="height" type="sml:PositiveSize" use="optional"/>
1546
1551
  </xs:complexType>
1547
1552
  </xs:element>
1548
1553
 
@@ -248,6 +248,21 @@
248
248
  - `<tr>` 内为 `<td>`
249
249
  - `<td>` 内可放 `<content>`
250
250
 
251
+ `<table>` 可选设置 `width` 和 `height`,分别表示表格的目标总宽度和总高度:
252
+
253
+ ```xml
254
+ <table topLeftX="80" topLeftY="120" width="800" height="300">
255
+ <colgroup>
256
+ <col width="240"/>
257
+ <col/>
258
+ </colgroup>
259
+ <tr height="80">
260
+ <td><content textType="body"><p>表头 1</p></content></td>
261
+ <td><content textType="body"><p>表头 2</p></content></td>
262
+ </tr>
263
+ </table>
264
+ ```
265
+
251
266
  ### `<chart>`
252
267
 
253
268
  图表元素必须至少包含: