lan-low-code-cli 2.5.0 → 2.6.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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: lan-low-code-cli
3
- version: 2.5.0
3
+ version: 2.6.0
4
4
  author: Pig George
5
5
  description: Operate the Landray low-code form engine through the `llc` CLI. Use when the user asks to create, inspect, modify, publish, or delete low-code apps and forms; generate field configs; configure layouts (grid/tabs), field permissions, options, i18n, or control actions (onChange/onLoad); or run pre-publish validation. Also use for troubleshooting form loading/rendering errors.
6
6
  tags:
@@ -91,13 +91,18 @@ Always run `llc <command> --help` before inventing flags — the CLI is the sour
91
91
  | Command | Purpose |
92
92
  |---|---|
93
93
  | `llc app list / create / forms / delete / delete-data` | business apps (`--code` allows letters/digits/hyphen only, **no underscore**) |
94
- | `llc form create / list / get / publish / autofill / delete / delete-data` | form lifecycle |
94
+ | `llc form create / list / get / publish / autofill / delete / delete-data` | form lifecycle; `create --type category\|simpleCategory` builds a category form (no business fields; templates are created in the platform designer) |
95
95
  | `llc field list / gen-key / library` | available fields |
96
+ | `llc operation list / get / create / update / delete / attach / detach` | form business operations (link, script, dialog), including attaching to list/view pages |
97
+ | `llc template list / create / add-fields / delete` | category-form templates: create/append/delete templates, porting fields/views/permissions from an existing form (auto category node, bypasses official init) |
96
98
  | `llc control list / show` | controls installed in the environment (basis for `--add-field` third segment) |
97
99
  | `llc locale list` | languages with translations available (from control i18n resources) |
98
100
  | `llc config set / show / clear` | global credentials and defaults |
99
101
 
100
102
  > Full per-command options, spec-string syntax and exit codes: **§7 CLI contract**. When in doubt, `llc <command> --help` is authoritative.
103
+ >
104
+ > Runtime `context` of operation scripts (selected rows, list refresh, query, navigation, event bus,
105
+ > `window.MKXFORM`) is documented in [references/operation-script-context.md](references/operation-script-context.md) (Chinese).
101
106
 
102
107
  ## 2. Core workflow
103
108
 
@@ -181,7 +186,7 @@ llc form autofill --id <fdId> --apply --publish \
181
186
  is accepted), so an unsupported event saves fine but never fires. Confirm in this order: the designer's
182
187
  "控件动作" event dropdown (authoritative) → `llc control show --element <pkg> --json`, i.e. event
183
188
  declarations in `meta` if the package has any (not shown in human output) → the keys of
184
- `controlAction.control['<table>.<uuid>']` on an existing form. See §7 of
189
+ `controlAction.control['<table>.<uuid>']` on an existing form. See §8 of
185
190
  [references/cli-contract.md](references/cli-contract.md).
186
191
  - `source` is function **source code** (evaluated via
187
192
  `new Function('MKXFORM', 'return (fn)')`); `@path` reads it from a file.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: lan-low-code-cli
3
- version: 2.5.0
3
+ version: 2.6.0
4
4
  author: Pig George
5
5
  description: 通过 `llc` CLI 操作蓝凌低代码表单引擎。适用于:创建、查看、修改、发布或删除低代码应用与表单;生成字段配置;配置布局(栅格/页签)、字段权限、选项、多语言、控件动作(onChange/onLoad);或执行发布前校验、排查表单加载/渲染报错。
6
6
  tags:
@@ -88,13 +88,18 @@ llc config set --base-url http://<host>/data --token <X-AUTH-TOKEN> # 一次
88
88
  | 命令 | 用途 |
89
89
  |---|---|
90
90
  | `llc app list / create / forms / delete / delete-data` | 业务应用(`--code` 仅允许字母/数字/连字符,**不允许下划线**) |
91
- | `llc form create / list / get / publish / autofill / delete / delete-data` | 表单生命周期 |
91
+ | `llc form create / list / get / publish / autofill / delete / delete-data` | 表单生命周期;`create --type category\|simpleCategory` 建分类表单(无业务字段,模板需在平台设计器创建) |
92
92
  | `llc field list / gen-key / library` | 可用字段 |
93
+ | `llc operation list / get / create / update / delete / attach / detach` | 表单业务操作(链接、脚本、对话框),含挂载到列表/查看视图 |
94
+ | `llc template list / create / add-fields / delete` | 分类表单模板:创建模板并把既有表单的字段/视图/权限移植进来,追加字段,或清理模板(自动建分类节点、跳过官方 init) |
93
95
  | `llc control list / show` | 环境已安装控件(`--add-field` 第三段的取值依据) |
94
96
  | `llc locale list` | 环境中有现成译文的语言(来自控件多语言资源) |
95
97
  | `llc config set / show / clear` | 全局凭据与默认值 |
96
98
 
97
99
  > 每个命令的完整参数、规格字符串语法与退出码见**第 7 节 CLI 契约**;不确定时以 `llc <命令> --help` 为准。
100
+ >
101
+ > 业务操作「脚本模式」的运行时 `context`(选中数据、刷新列表、查询、跳转、事件总线、`window.MKXFORM`)
102
+ > 见 [references/operation-script-context.md](references/operation-script-context.md)。
98
103
 
99
104
  ## 2. 核心流程
100
105
 
@@ -174,7 +179,7 @@ llc form autofill --id <fdId> --apply --publish \
174
179
  - **控件支持哪些事件**:CLI 不内置白名单、也不校验(只要求标识符),写错不会报错但不会触发。
175
180
  按序确认:设计器「控件动作」事件下拉(权威)→ `llc control show --element <pkg> --json` 的 `meta`
176
181
  (若包内声明了事件;人类可读输出不展示)→ 已有表单 `controlAction.control['<表名>.<uuid>']` 的键名。
177
- 详见 [references/cli-contract.zh-CN.md](references/cli-contract.zh-CN.md) 第 7 节。
182
+ 详见 [references/cli-contract.zh-CN.md](references/cli-contract.zh-CN.md) 第 8 节。
178
183
  - `source` 是函数**源码**(运行时经 `new Function('MKXFORM', 'return (fn)')` 求值);
179
184
  `@路径` 表示从文件读取。
180
185
  - 落库位置:`fdConfig.attribute.formAttr.controlAction.control['<表名>.<uuid>'][<事件>]`。
@@ -73,7 +73,96 @@ The `general` family only supports `general` (approval-opinion) forms; `modeling
73
73
  `type=refer` does not store `fdConfig`.
74
74
  `--type` values: `common|general|config|modal|template|refer` (or `1..6`; Chinese names also work).
75
75
 
76
- ## 5. field
76
+ ### 4.1 Category forms / simple category forms (`--type category|simpleCategory`)
77
+
78
+ Uses the `categoryModel` family (`/data/sys-modeling/categoryModel/`), independent from normal forms:
79
+
80
+ | `--type` | `fdType` | Tables | Notes |
81
+ |---|---|---|---|
82
+ | `category` (alias `categoryForm`) | 1 | category + template + main | category tree with multiple templates |
83
+ | `simpleCategory` (alias `simpleCategoryForm`) | 2 | polymers + main | category and template merged; always multi-level; no shared category |
84
+
85
+ ```bash
86
+ llc form create --name "Purchase categories" --app-id <appId> --type category --publish
87
+ llc form create --name "Simple categories" --app-id <appId> --type simpleCategory --publish
88
+ ```
89
+
90
+ - Flow: `categoryModel/init` → `categoryModel/add` → (with `--publish`: `get` + `save` + `publish`);
91
+ - Extra options: `--category-table-name` `--template-table-name` `--polymers-table-name` `--share-category <fdCode>` `--no-support-hierarchy`;
92
+ - Table names default to `sysModelingXForm/generateTableName`; `--table-name` is still the main table;
93
+ - **Limits**: category forms carry no business fields, so `--add-field` / `--fields` / `--from-model` are rejected;
94
+ templates must be created in the platform's launch-page designer (the template table metadata is generated
95
+ there on first save), calling `categoryTemplate/init` directly returns a null-pointer error;
96
+ - deletion is platform-only (`categoryModel/delete` rejects direct client calls); `form get --id` reads category forms.
97
+
98
+ ### 4.2 Category form templates (`llc template`)
99
+
100
+ | Command | Required | Optional | Notes |
101
+ |---|---|---|---|
102
+ | `llc template list` | `--category-code` | `--json` | runtime tree (category nodes + template cards) |
103
+ | `llc template create` | `--category-code` `--name` | `--from-form <fdId>` `--fields <names>` `--table-name` `--category-node <fdId>` `--category-name` `--code` `--publish` `--dry-run` `--json` | creates a template, optionally porting fields/views/permissions from an existing form |
104
+ | `llc template add-fields` | `--template-id` `--add-field` | `--category-code` `--per-row` `--keep-layout` `--publish` `--dry-run` `--json` | appends fields to an existing template; rebuilds a grid layout by default, `--keep-layout` keeps the current one |
105
+ | `llc template delete` | `--category-code` | `--template-id <fdId>` (repeatable) `--all` `--yes` `--json` | deletes templates; `--all` wipes every template of that category form |
106
+
107
+ - Category forms (`fdType=1`) use `categoryTemplate/add`; simple category forms (`fdType=2`) use `virtualPolymers/add`;
108
+ read/write through `virtualCommonTemplate/get|save|publish`;
109
+ - **Skips the official `init`** (null pointer until the template table metadata exists): `add` carries
110
+ `mechanisms['sys-xform'].fdBuildNew=true` so the backend creates the table, then `sys-xform/sysXFormDesign/save` writes the design;
111
+ - `--from-form` clones the source form's main-table business fields, view layout (tabs/grid) and field permissions,
112
+ replacing table names and dropping detail nodes; `--fields` limits the ported fields;
113
+ - Category-form templates must sit under a category node: without `--category-node` one is created
114
+ (name from `--category-name`).
115
+
116
+ ## 5. operation (form business operations)
117
+
118
+ Adds buttons to a form's list/view page (the "业务操作" tab of a form). Built-in operations (`fdType=1`) are
119
+ maintained by the platform; the CLI only lists them and manages **custom** operations.
120
+
121
+ | Command | Required | Optional | Notes |
122
+ |---|---|---|---|
123
+ | `llc operation list` | `--form-id <fdId>` | `--keyword <kw>` `--page-no <n>=1` `--page-size <n>=100` `--json` | lists a form's operations (built-ins included) |
124
+ | `llc operation get` | `--id <fdId>` | `--json` | detail; prints the parsed `fdConfig` |
125
+ | `llc operation create` | `--form-id` `--name` `--code` `--type` | `--position list\|view` `--need-select` `--url` `--script <code\|@file>` `--dialog-id` `--desc` `--mobile-icon` `--dry-run` `--json` | creates an operation definition |
126
+ | `llc operation update` | `--id <fdId>` | `--name` `--code` `--desc` `--position` `--type` `--url` `--script <code\|@file>` `--dialog-id` `--need-select`/`--no-need-select` `--enable`/`--disable` `--mobile-icon` `--dry-run` `--json` | edits an existing operation; `--type script` switches a button to script mode |
127
+ | `llc operation delete` | `--id <fdId>` `--yes` | — | checks references (`listByRefer`) and refuses while still in use |
128
+ | `llc operation attach` | `--form-id` `--operation-id` | `--target list\|view` `--view-id` `--platform desktop\|mobile` `--position top\|rightHand\|rightSide` | writes the button into the view `operationList`; auto-detects the single view when `--view-id` is omitted |
129
+ | `llc operation detach` | `--form-id` `--operation-id` | `--target list\|view` `--view-id` `--platform` | removes the button from a view (definition kept) |
130
+
131
+ `--type` (P0 supports three):
132
+
133
+ | type | fdType | fdViewType | Required | Notes |
134
+ |---|---|---|---|---|
135
+ | `link` | 2 | 4 | `--url` | open a link |
136
+ | `script` | 3 | 5 | `--script` (`@file` supported) | run a script |
137
+ | `dialog` | 3 | 1 | `--dialog-id` | run a dialog |
138
+
139
+ ```bash
140
+ llc operation list --form-id <fdId>
141
+ llc operation create --form-id <fdId> --name 打开帮助 --code openHelp \
142
+ --type link --position view --url https://example.com
143
+ llc operation create --form-id <fdId> --name 批量归档 --code archive \
144
+ --type script --script @archive.js
145
+ llc operation get --id <operationId>
146
+ llc operation update --id <operationId> --type script --script @examples/operation-script-modal-table.js
147
+ llc operation delete --id <operationId> --yes
148
+ llc operation attach --form-id <fdId> --operation-id <operationId> # list view / desktop / top
149
+ llc operation attach --form-id <fdId> --operation-id <operationId> --target view --position rightHand
150
+ llc operation detach --form-id <fdId> --operation-id <operationId> # remove from list view
151
+ ```
152
+
153
+ - `--code`: starts with a letter, letters/digits/underscore/hyphen only, ≤15; `--name` ≤30; `--desc` ≤500.
154
+ - New operations are **admin-only by default**; set visitors on the platform's "业务操作" page.
155
+ - No row selection is required by default (`fdListViewIdValid=false`); pass `--need-select` when the button
156
+ must run on selected rows (for links this also sets `fdUrlType=2`, i.e. call the link as an API).
157
+ - `attach` / `detach` only touch view config: list views use `fdExtendConfig[platform].operationList`,
158
+ view pages use `fdConfig[platform].operationList`; the whole config is saved back, so other settings and
159
+ existing buttons are preserved, and re-attaching is idempotent.
160
+ - `--position`: `top` (toolbar), `rightHand` / `rightSide` (row actions); `--platform` accepts `desktop` / `mobile`.
161
+ - Permissions, display conditions and triggers are still out of scope; `attach` does not validate the
162
+ operation's `fdPosition` and only warns on a mismatch.
163
+ - `--dry-run` prints the payload (`fdConfig` is a JSON string) without sending it.
164
+
165
+ ## 6. field
77
166
 
78
167
  | Command | Options | Notes |
79
168
  |---|---|---|
@@ -81,7 +170,7 @@ The `general` family only supports `general` (approval-opinion) forms; `modeling
81
170
  | `llc field library` | `--keyword <kw>` (`fdName` contains), `--page-no <n>=1`, `--page-size <n>=20`, `--json` | environment field library |
82
171
  | `llc field gen-key` | `--name <name>`, `--table <table>` | generates the physical field key |
83
172
 
84
- ## 6. control / locale
173
+ ## 7. control / locale
85
174
 
86
175
  | Command | Options | Notes |
87
176
  |---|---|---|
@@ -89,7 +178,7 @@ The `general` family only supports `general` (approval-opinion) forms; `modeling
89
178
  | `llc control show` | `--element <@elem/xform-xxx>` or `--type <moneytext>`, `--json` | widget metadata plus property-panel items and defaults |
90
179
  | `llc locale list` | `--element <pkg>` (default `@elem/xform-input`), `--json` | returns the raw code (e.g. `zh-cn`) and the normalized code (e.g. `Cn`, usable in `--locale`); all environment locales are not exposed by any API |
91
180
 
92
- ## 7. Which events a control supports
181
+ ## 8. Which events a control supports
93
182
 
94
183
  `$global` actions are fixed to `onLoad` / `onBeforeSubmit` / `onAfterSubmit` (validated by the CLI).
95
184
 
@@ -115,7 +204,7 @@ without error but never fires, so confirm it first:
115
204
  > §8 of `references/mkxform-api.md` (`MKXFORM.onChange/beforeSubmit/afterSubmit`) is the **runtime
116
205
  > listener API**, not the same event set as control actions — do not mix them up.
117
206
 
118
- ## 8. Spec strings
207
+ ## 9. Spec strings
119
208
 
120
209
  | Option | Syntax | Notes |
121
210
  |---|---|---|
@@ -126,13 +215,13 @@ without error but never fires, so confirm it first:
126
215
  | `--tabs` | `"Title:field1,field2\|Title2:field3"` | `--layout tabs` only; unlisted fields go to a trailing "其它" tab |
127
216
  | `--required`/`--readonly`/`--hidden` | `"field1,field2"` | add/edit required, add/edit read-only, add/edit/view hidden |
128
217
  | `--auth-file` | `{"add":{"fd_col_a":{"required":true}}}` | keys `add`/`edit`/`view`, merged with the flags above |
129
- | `--action` | `"field:event:source"` or `"field:event:@file.js"` | repeatable; `$global` accepts only `onLoad`/`onBeforeSubmit`/`onAfterSubmit`; see §7 for how to find control events |
218
+ | `--action` | `"field:event:source"` or `"field:event:@file.js"` | repeatable; `$global` accepts only `onLoad`/`onBeforeSubmit`/`onAfterSubmit`; see §8 for how to find control events |
130
219
  | `--action-file` | `{"field":{"onChange":"source"},"$global":{"onLoad":"source"}}` or `[{target,event,source,name?}]` | merged with `--action` |
131
220
  | `--relation` | `"field=TargetForm[:显示值=field][:显示项=field1,field2]"` | target may be a form name or `fdId`; writes `relationCfg` + `datasource` |
132
221
  | `--locale` | `"Cn,Us,Tw"` or `all` | comma-separated, **first entry is primary**; `all` = `Cn,Us,Tw` |
133
222
  | `--lang-file` | `{"Us":{"姓名":"Name"}}` | inner keys may be field labels or field names; options support `field#value` |
134
223
 
135
- ## 9. Common failures
224
+ ## 10. Common failures
136
225
 
137
226
  | Message | Cause / fix |
138
227
  |---|---|
@@ -68,7 +68,95 @@ llc -v | --version # 版本号
68
68
  `general` 族只支持 `general`(审批意见表单);`modeling` 必须给 `--app-id`;`type=refer` 不保存 `fdConfig`。
69
69
  `--type` 取值:`common|general|config|modal|template|refer`(数字 `1..6`,中文名亦可)。
70
70
 
71
- ## 5. field
71
+ ### 4.1 分类表单 / 简单分类表单(`--type category|simpleCategory`)
72
+
73
+ 走 `categoryModel` 接口族(`/data/sys-modeling/categoryModel/`),与普通表单完全独立:
74
+
75
+ | `--type` | `fdType` | 表结构 | 说明 |
76
+ |---|---|---|---|
77
+ | `category`(别名 `categoryForm`) | 1 | 分类表 + 模板表 + 主表 | 分类树 + 多个模板 |
78
+ | `simpleCategory`(别名 `simpleCategoryForm`) | 2 | 聚合表 + 主表 | 分类与模板合一,强制多层级,不支持共享分类 |
79
+
80
+ ```bash
81
+ llc form create --name "采购分类表单" --app-id <appId> --type category --publish
82
+ llc form create --name "简版分类表单" --app-id <appId> --type simpleCategory --publish
83
+ ```
84
+
85
+ - 链路:`categoryModel/init` → `categoryModel/add` →(`--publish` 时 `get` + `save` + `publish`);
86
+ - 专属选项:`--category-table-name` `--template-table-name` `--polymers-table-name` `--share-category <fdCode>` `--no-support-hierarchy`;
87
+ - 表名缺省逐个调用 `sysModelingXForm/generateTableName`;`--table-name` 仍是主表名;
88
+ - **限制**:分类表单本身没有业务字段,`--add-field` / `--fields` / `--from-model` 会被拒绝;
89
+ 模板(模板表单)需在平台「发起页设计器」创建——模板表元数据由设计器首次保存生成,
90
+ CLI 直接调用 `categoryTemplate/init` 会返回空指针异常;
91
+ - 删除只能在平台操作(`categoryModel/delete` 禁止前端调用);`form get --id` 可读取分类表单详情。
92
+
93
+ ### 4.2 分类表单模板(`llc template`)
94
+
95
+ | 命令 | 必需 | 可选 | 说明 |
96
+ |---|---|---|---|
97
+ | `llc template list` | `--category-code` | `--json` | 运行时分类树(分类节点 + 模板卡片) |
98
+ | `llc template create` | `--category-code` `--name` | `--from-form <fdId>` `--fields <names>` `--table-name` `--category-node <fdId>` `--category-name` `--code` `--publish` `--dry-run` `--json` | 创建模板,可把来源表单的业务字段/视图/权限移植进来 |
99
+ | `llc template add-fields` | `--template-id` `--add-field` | `--category-code` `--per-row` `--keep-layout` `--publish` `--dry-run` `--json` | 向已有模板追加字段;默认重建为栅格布局(新字段可见),`--keep-layout` 保留原布局 |
100
+ | `llc template delete` | `--category-code` | `--template-id <fdId>`(可重复) `--all` `--yes` `--json` | 删除模板;`--all` 清空该分类表单下的全部模板 |
101
+
102
+ - 分类表单(`fdType=1`)走 `categoryTemplate/add`,简单分类(`fdType=2`)走 `virtualPolymers/add`;
103
+ 读写统一用 `virtualCommonTemplate/get|save|publish`;
104
+ - **跳过官方 `init`**(模板表元数据未就绪时必空指针):`add` 时带 `mechanisms['sys-xform'].fdBuildNew=true`
105
+ 让后端建表并注册元数据,再用 `sys-xform/sysXFormDesign/save` 写入设计;
106
+ - `--from-form` 克隆来源表单主表的业务字段、视图布局(页签/栅格)与字段权限,
107
+ 表名替换为模板表,**明细节点剔除**;`--fields` 可只取部分字段;
108
+ - 分类表单的模板必须挂在分类节点下:不传 `--category-node` 时自动新建节点(`--category-name` 指定名称)。
109
+
110
+ ## 5. operation(表单业务操作)
111
+
112
+ 在表单的列表页/查看页上增加按钮(对应平台「表单 → 业务操作」Tab)。内置按钮(`fdType=1`)由平台维护,
113
+ 这里只负责查询与**自定义**操作的增删。
114
+
115
+ | 命令 | 必需 | 可选 | 说明 |
116
+ |---|---|---|---|
117
+ | `llc operation list` | `--form-id <fdId>` | `--keyword <kw>` `--page-no <n>=1` `--page-size <n>=100` `--json` | 按表单列出操作(含内置) |
118
+ | `llc operation get` | `--id <fdId>` | `--json` | 详情;默认展开 `fdConfig` JSON |
119
+ | `llc operation create` | `--form-id` `--name` `--code` `--type` | `--position list\|view` `--need-select` `--url` `--script <code\|@file>` `--dialog-id` `--desc` `--mobile-icon` `--dry-run` `--json` | 新建操作定义 |
120
+ | `llc operation update` | `--id <fdId>` | `--name` `--code` `--desc` `--position` `--type` `--url` `--script <code\|@file>` `--dialog-id` `--need-select`/`--no-need-select` `--enable`/`--disable` `--mobile-icon` `--dry-run` `--json` | 修改已有操作;`--type script` 可把按钮切换为脚本模式 |
121
+ | `llc operation delete` | `--id <fdId>` `--yes` | — | 先查引用(`listByRefer`),被引用时拒绝删除 |
122
+ | `llc operation attach` | `--form-id` `--operation-id` | `--target list\|view` `--view-id` `--platform desktop\|mobile` `--position top\|rightHand\|rightSide` | 把按钮写入视图 `operationList`;省略 `--view-id` 时自动定位唯一视图 |
123
+ | `llc operation detach` | `--form-id` `--operation-id` | `--target list\|view` `--view-id` `--platform` | 从视图移除按钮(保留操作定义) |
124
+
125
+ `--type` 取值(P0 仅三种):
126
+
127
+ | type | fdType | fdViewType | 必填参数 | 说明 |
128
+ |---|---|---|---|---|
129
+ | `link` | 2 | 4 | `--url` | 打开链接 |
130
+ | `script` | 3 | 5 | `--script`(`@file` 读文件) | 执行脚本 |
131
+ | `dialog` | 3 | 1 | `--dialog-id` | 执行对话框(业务操作) |
132
+
133
+ ```bash
134
+ llc operation list --form-id <fdId>
135
+ llc operation create --form-id <fdId> --name 打开帮助 --code openHelp \
136
+ --type link --position view --url https://example.com
137
+ llc operation create --form-id <fdId> --name 批量归档 --code archive \
138
+ --type script --script @archive.js
139
+ llc operation get --id <operationId>
140
+ llc operation update --id <operationId> --type script --script @examples/operation-script-modal-table.js
141
+ llc operation delete --id <operationId> --yes
142
+ llc operation attach --form-id <fdId> --operation-id <operationId> # 列表视图 / desktop / top
143
+ llc operation attach --form-id <fdId> --operation-id <operationId> --target view --position rightHand
144
+ llc operation detach --form-id <fdId> --operation-id <operationId> # 从列表视图移除
145
+ ```
146
+
147
+ 约束与说明:
148
+
149
+ - `--code`:字母开头,仅字母/数字/下划线/连字符,≤15;`--name` ≤30;`--desc` ≤500。
150
+ - 新建操作**默认仅管理员可用**,可访问者需到平台「业务操作」中设置。
151
+ - 默认**不要求勾选数据**(`fdListViewIdValid=false`);需要“先勾选数据再执行”时加 `--need-select`
152
+ (链接类型会同时把 `fdUrlType` 置为 `2`,按接口调用)。
153
+ - `attach` / `detach` 只改视图配置:列表视图写 `fdExtendConfig[platform].operationList`,查看视图写
154
+ `fdConfig[platform].operationList`;整体覆盖保存时会保留其它配置与已有按钮,重复挂载幂等。
155
+ - `--position`:`top`(工具栏)、`rightHand` / `rightSide`(行右侧);`--platform` 支持 `desktop` / `mobile`。
156
+ - 仍不处理权限公式、显示条件、触发器;`attach` 不校验操作的 `fdPosition`,目标页面不匹配时仅告警。
157
+ - `--dry-run` 打印请求体(`fdConfig` 为 JSON 字符串),建议先在测试环境核对再提交。
158
+
159
+ ## 6. field
72
160
 
73
161
  | 命令 | 选项 | 说明 |
74
162
  |---|---|---|
@@ -76,7 +164,7 @@ llc -v | --version # 版本号
76
164
  | `llc field library` | `--keyword <kw>`(模糊匹配 fdName)、`--page-no <n>=1`、`--page-size <n>=20`、`--json` | 环境字段库 |
77
165
  | `llc field gen-key` | `--name <name>`、`--table <table>` | 生成字段物理名(fdKey) |
78
166
 
79
- ## 6. control / locale
167
+ ## 7. control / locale
80
168
 
81
169
  | 命令 | 选项 | 说明 |
82
170
  |---|---|---|
@@ -84,7 +172,7 @@ llc -v | --version # 版本号
84
172
  | `llc control show` | `--element <@elem/xform-xxx>` 或 `--type <moneytext>`、`--json` | 控件元数据 + 属性面板配置项与默认值 |
85
173
  | `llc locale list` | `--element <pkg>`(默认 `@elem/xform-input`)、`--json` | 返回原始码(如 `zh-cn`)与归一化码(如 `Cn`,可直接用于 `--locale`);环境全量语言无接口暴露 |
86
174
 
87
- ## 7. 控件动作支持的事件(如何获取)
175
+ ## 8. 控件动作支持的事件(如何获取)
88
176
 
89
177
  `$global` 全局动作固定 3 个:`onLoad` / `onBeforeSubmit` / `onAfterSubmit`(CLI 会校验,写错直接报错)。
90
178
 
@@ -106,7 +194,7 @@ llc -v | --version # 版本号
106
194
  > `references/mkxform-api.md` 第 8 节的 `MKXFORM.onChange/beforeSubmit/afterSubmit` 是**运行时监听 API**,
107
195
  > 与这里的「控件动作」不是同一套事件,不要混用。
108
196
 
109
- ## 8. 规格字符串(spec)速查
197
+ ## 9. 规格字符串(spec)速查
110
198
 
111
199
  | 选项 | 语法 | 说明 |
112
200
  |---|---|---|
@@ -117,13 +205,13 @@ llc -v | --version # 版本号
117
205
  | `--tabs` | `"标题:字段1,字段2\|标题2:字段3"` | 仅 `--layout tabs`;未列出的字段归入末尾「其它」页 |
118
206
  | `--required`/`--readonly`/`--hidden` | `"字段1,字段2"` | 分别写入 add/edit 必填、add/edit 只读、add/edit/view 隐藏 |
119
207
  | `--auth-file` | `{"add":{"fd_col_a":{"required":true}}}` | 键为 `add`/`edit`/`view`,与上述开关合并 |
120
- | `--action` | `"字段名:事件:函数源码"` 或 `"字段名:事件:@file.js"` | 可重复;`$global` 仅 `onLoad`/`onBeforeSubmit`/`onAfterSubmit`;控件级事件如何获取见第 7 节 |
208
+ | `--action` | `"字段名:事件:函数源码"` 或 `"字段名:事件:@file.js"` | 可重复;`$global` 仅 `onLoad`/`onBeforeSubmit`/`onAfterSubmit`;控件级事件如何获取见第 8 节 |
121
209
  | `--action-file` | `{"字段名":{"onChange":"源码"},"$global":{"onLoad":"源码"}}` 或 `[{target,event,source,name?}]` | 与 `--action` 合并 |
122
210
  | `--relation` | `"字段名=目标表单[:显示值=字段][:显示项=字段1,字段2]"` | 目标可写表单名或 `fdId`;写入 `relationCfg` + `datasource` |
123
211
  | `--locale` | `"Cn,Us,Tw"` 或 `all` | 逗号分隔,**第一个为主语言**;`all` = `Cn,Us,Tw` |
124
212
  | `--lang-file` | `{"Us":{"姓名":"Name"}}` | 内层 key 可为字段标题或字段名;选项支持 `字段名#值` |
125
213
 
126
- ## 9. 常见失败提示
214
+ ## 10. 常见失败提示
127
215
 
128
216
  | 提示 | 原因与处理 |
129
217
  |---|---|