lan-low-code-cli 2.0.0 → 2.2.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.
- package/README.md +242 -7
- package/bin/llc.js +0 -0
- package/dist/api/formDefine.js +12 -0
- package/dist/commands/control.js +34 -3
- package/dist/commands/form.js +44 -4
- package/dist/constants.js +326 -2
- package/dist/generator/index.js +338 -33
- package/dist/index.js +10 -1
- package/dist/relation.js +130 -0
- package/dist/widgets.js +39 -4
- package/package.json +45 -43
package/dist/constants.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* 常量定义:与 sys-xform 前端 util/constant.ts 中的约定保持一致。
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.DEFAULT_MOBILE_THEME = exports.DEFAULT_DESKTOP_THEME = exports.DEFAULT_FORM_ICON_JSON = exports.DEFAULT_FORM_ICON = exports.FIELD_NAME_PREFIX = exports.LOCALE_PATTERN = exports.LOCALE_ALL = exports.LOCALES = exports.DEFAULT_LOCALE = exports.DEFAULT_SPAN = exports.OPTION_DICT_TYPE = exports.OPTION_CONTROL_TYPES = exports.DETAIL_CONTROL_DEFAULTS = exports.DETAIL_ROW_FLAGS = exports.DETAIL_OPERATIONS = exports.DETAIL_SYSTEM_FIELDS = exports.DETAIL_CONTROL = exports.CONTROL_DESIGNER_NOTES = exports.CONTROL_NOTE_WITHOUT_ERRORS = exports.RELATION_FRONT_EXTEND_PATHS = exports.CONTROL_DEFAULT_PROPS = exports.CONTROL_SEMANTIC_RULES = exports.PLACEHOLDER_LANG_KEY_CANDIDATES = exports.CONTROL_PLACEHOLDER_LANG_KEYS = exports.CONTAINER_CONTROL_TYPES = exports.CONTROL_TYPE_MAP = exports.FALLBACK_CONTROL = exports.DEFAULT_CONTROL_MAP = exports.ELEMENT_ARTIFACT_PREFIX = exports.DEFAULT_SCENE_NAME = exports.DEFAULT_SCENE_CODE = exports.MODELING_ENTITY_CODE = exports.MODELING_ENTITY_NAME = exports.ENTITY_CODE = exports.ENTITY_NAME = exports.MODULE = exports.REQUIRED_PROP_DEFAULTS = exports.I18N_PROP_TABS = exports.TAB_PANE_MOBILE = exports.TAB_PANE = exports.TABS_MOBILE = exports.TABS = exports.TAB_APPEARANCE_MOBILE = exports.TAB_APPEARANCE = exports.LAYOUT_GRID_ITEM = exports.LAYOUT_GRID = exports.LAYOUT = exports.ROW = exports.APPEARANCE = exports.MAIN = void 0;
|
|
7
|
+
exports.DEFAULT_DETAIL_CONTROL_STYLE = exports.DEFAULT_CONTROL_STYLE = void 0;
|
|
7
8
|
/** 设计器主容器 key */
|
|
8
9
|
exports.MAIN = 'main';
|
|
9
10
|
/** 外观容器 */
|
|
@@ -30,7 +31,17 @@ exports.TAB_PANE = '@elem/xform-tabpane';
|
|
|
30
31
|
exports.TAB_PANE_MOBILE = '@elem/xform-m-tabpane';
|
|
31
32
|
/** 页签标题的多语言 prop 取值(前端 EI18nProp.tabs) */
|
|
32
33
|
exports.I18N_PROP_TABS = 'tabs';
|
|
33
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* 控件必填属性的兜底默认值(键为 desktop 控件包名),取值依据见 README「控件必填属性校验」。
|
|
36
|
+
*
|
|
37
|
+
* 支持两个占位符(在 `buildFieldAttribute` 中按字段解析):
|
|
38
|
+
* - `$title`:字段的多语言 key(`langKey`),用于「描述文字」这类默认取标题的属性
|
|
39
|
+
* - `$name`:字段物理名(`fdName`)
|
|
40
|
+
*
|
|
41
|
+
* 高级控件部分只填**中立且安全**的取值(枚举默认值、空结构),
|
|
42
|
+
* 需要选择环境对象(主数据 / 配置项 / 关联范围 / 识别类型 …)的属性**不伪造**,
|
|
43
|
+
* 保持为空并在发布校验时提示(与设计器行为一致,可用 `--force` 跳过)。
|
|
44
|
+
*/
|
|
34
45
|
exports.REQUIRED_PROP_DEFAULTS = {
|
|
35
46
|
'@elem/xform-textarea': { height: '3' },
|
|
36
47
|
'@elem/xform-rate': { max: 5 },
|
|
@@ -38,10 +49,106 @@ exports.REQUIRED_PROP_DEFAULTS = {
|
|
|
38
49
|
'@elem/xform-rich-text': { height: 300 },
|
|
39
50
|
'@elem/xform-bar-code': { height: 80 },
|
|
40
51
|
'@elem/xform-hyperlinks': { largestSet: 'infinit' },
|
|
52
|
+
// address = 地址本(组织/人员选择器,非地址文本):orgTypeArr 位掩码
|
|
53
|
+
// 1=组织 2=部门 4=岗位 8=人员 16=用户组;默认仅人员、单选、全部范围
|
|
41
54
|
'@elem/xform-address': {
|
|
42
55
|
org: { orgTypeArr: ['8'], defaultValueType: 'null' },
|
|
43
56
|
multi: false,
|
|
44
57
|
},
|
|
58
|
+
// ---------- 高级控件 ----------
|
|
59
|
+
// 取值依据:控件 config.json 的枚举选项 + 真实表单落库数据(controlProps)
|
|
60
|
+
'@elem/xform-description': { defaultTextValue: '$title' },
|
|
61
|
+
'@elem/xform-tag': {
|
|
62
|
+
tabsRange: { categorys: [], targs: [], rangeType: 'all' },
|
|
63
|
+
multi: true,
|
|
64
|
+
},
|
|
65
|
+
'@elem/xform-location': {
|
|
66
|
+
allowed: false,
|
|
67
|
+
mapContent: { address: 'formattedAddress' },
|
|
68
|
+
searchNearBy: { isLocation: false, checkboxvalue: false, inputvalue: '' },
|
|
69
|
+
},
|
|
70
|
+
'@elem/xform-area': {
|
|
71
|
+
// 'null' 时精确定位(defaultValue)为非条件项,无需填写
|
|
72
|
+
defaultValueType: 'null',
|
|
73
|
+
precisionRegion: 'county',
|
|
74
|
+
showHierarchy: 'all',
|
|
75
|
+
showText: false,
|
|
76
|
+
passValue: false,
|
|
77
|
+
},
|
|
78
|
+
'@elem/xform-html': {
|
|
79
|
+
source: { html: '', css: '', javascript: '' },
|
|
80
|
+
hiddenLabel: true,
|
|
81
|
+
},
|
|
82
|
+
'@elem/xform-iframe': { heigth: 150, complexMode: false, expressionFormulaVO: {} },
|
|
83
|
+
'@elem/xform-file-edit': {
|
|
84
|
+
height: 600,
|
|
85
|
+
allowImport: true,
|
|
86
|
+
accept: { defaultFileType: 'docx', fileType: ['.doc,.docx'] },
|
|
87
|
+
supportList: false,
|
|
88
|
+
},
|
|
89
|
+
'@elem/xform-association': {
|
|
90
|
+
// mode / processStatus 为枚举,取真实表单的取值;xlistColumn(列表列配置)需设计器选择
|
|
91
|
+
mode: 'multiple',
|
|
92
|
+
processStatus: ['30'],
|
|
93
|
+
},
|
|
94
|
+
'@elem/xform-attach-demo': { supportTemplateData: true },
|
|
95
|
+
'@elem/xform-agency': { multi: false },
|
|
96
|
+
'@elem/xform-mdm': {
|
|
97
|
+
renderMode: 'singlelist',
|
|
98
|
+
direction: 'column',
|
|
99
|
+
rowCount: 3,
|
|
100
|
+
trace: false,
|
|
101
|
+
},
|
|
102
|
+
'@elem/xform-dynamic': { direction: 'column', rowCount: 3 },
|
|
103
|
+
'@elem/xform-calculate': {
|
|
104
|
+
statisticMode: 'SUM',
|
|
105
|
+
statisticData: [],
|
|
106
|
+
showText: false,
|
|
107
|
+
passValue: false,
|
|
108
|
+
defaultValueType: 'empty',
|
|
109
|
+
},
|
|
110
|
+
'@elem/xform-cfg': {
|
|
111
|
+
renderMode: 'select',
|
|
112
|
+
cascader: true,
|
|
113
|
+
direction: 'column',
|
|
114
|
+
rowCount: 3,
|
|
115
|
+
showLevel: 'lastLevel',
|
|
116
|
+
selectLevel: 'allLevel',
|
|
117
|
+
levelOption: 0,
|
|
118
|
+
showText: false,
|
|
119
|
+
passValue: false,
|
|
120
|
+
trace: false,
|
|
121
|
+
},
|
|
122
|
+
'@elem/xform-review': {
|
|
123
|
+
isOperation: false,
|
|
124
|
+
isAuditNote: true,
|
|
125
|
+
useType: 'node',
|
|
126
|
+
reviewOptConfig: { optType: 'simple', advancedOptions: ['handler_pass'] },
|
|
127
|
+
auditNoteConfig: {
|
|
128
|
+
isSet: false,
|
|
129
|
+
notShowEmpty: false,
|
|
130
|
+
notShowRejection: false,
|
|
131
|
+
showLastOnSameDept: false,
|
|
132
|
+
showLastOnSameHandler: false,
|
|
133
|
+
notShowCancelCommunicate: false,
|
|
134
|
+
ascTime: true,
|
|
135
|
+
descTime: false,
|
|
136
|
+
ascApproverOrder: false,
|
|
137
|
+
descApproverOrder: false,
|
|
138
|
+
showNodeNote: false,
|
|
139
|
+
showPrependSignNote: false,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
'@elem/xform-interval': {
|
|
143
|
+
controlWidth: 'default',
|
|
144
|
+
height: 16,
|
|
145
|
+
marginTop: 16,
|
|
146
|
+
marginBottom: 16,
|
|
147
|
+
maxColor: '#F8F8F8',
|
|
148
|
+
},
|
|
149
|
+
'@elem/xform-associated-fields': { showText: false, canChangeSpan: true },
|
|
150
|
+
'@elem/xform-time-axis': { showText: false },
|
|
151
|
+
'@elem/xform-button': { hiddenLabel: true },
|
|
45
152
|
};
|
|
46
153
|
/** 后端模块前缀(拼在 baseUrl 之后) */
|
|
47
154
|
exports.MODULE = 'sys-xform';
|
|
@@ -118,6 +225,223 @@ exports.CONTROL_TYPE_MAP = {
|
|
|
118
225
|
timeZone: { desktop: '@elem/xform-time-zone', mobile: '@elem/xform-m-time-zone', logicalType: 'timeZone', dataType: 'varchar' },
|
|
119
226
|
relation: { desktop: '@elem/xform-relation', mobile: '@elem/xform-m-relation', logicalType: 'relation', dataType: 'relation' },
|
|
120
227
|
relationQuery: { desktop: '@elem/xform-relation-query', mobile: '@elem/xform-relation-query', logicalType: 'relationQuery', dataType: 'relation' },
|
|
228
|
+
// ---------- 高级控件 ----------
|
|
229
|
+
// 下列条目的 dataType / dictType / defaultLength / isStored 均取自真实环境:
|
|
230
|
+
// 控件包 `config.json` 的 xform 元数据(`llc control list` 可查)+ 真实表单落库数据核对。
|
|
231
|
+
// 元素类控件(isStored=false)同样会写入 dataModel,但 `fdIsStored=false`(不建物理列)。
|
|
232
|
+
// 元素类(仅渲染)
|
|
233
|
+
desc: { desktop: '@elem/xform-description', mobile: '@elem/xform-m-description', logicalType: 'desc', dataType: 'varchar', isStored: false },
|
|
234
|
+
interval: { desktop: '@elem/xform-interval', mobile: '@elem/xform-m-interval', logicalType: 'interval', dataType: 'varchar', dictType: 'simpleDict', isStored: false },
|
|
235
|
+
button: { desktop: '@elem/xform-button', mobile: '@elem/xform-m-button', logicalType: 'button', dataType: 'varchar', dictType: 'simpleDict', isStored: false },
|
|
236
|
+
html: { desktop: '@elem/xform-html', mobile: '@elem/xform-html', logicalType: 'html', dataType: 'varchar', dictType: 'simpleDict', isStored: false },
|
|
237
|
+
iframe: { desktop: '@elem/xform-iframe', mobile: '@elem/xform-iframe', logicalType: 'iframe', dataType: 'varchar', dictType: 'simpleDict', isStored: false },
|
|
238
|
+
attdemo: { desktop: '@elem/xform-attach-demo', mobile: '@elem/xform-attach-demo', logicalType: 'attdemo', dataType: 'varchar', dictType: 'attachmentDict', isStored: false },
|
|
239
|
+
imageDemo: { desktop: '@elem/xform-image-demo', mobile: '@elem/xform-image-demo', logicalType: 'imageDemo', dataType: 'varchar', dictType: 'attachmentDict', isStored: false },
|
|
240
|
+
review: { desktop: '@elem/xform-review', mobile: '@elem/xform-review', logicalType: 'review', dataType: 'varchar', dictType: 'lbpmAuditDict', isStored: false },
|
|
241
|
+
timeAxis: { desktop: '@elem/xform-time-axis', mobile: '@elem/xform-m-time-axis', logicalType: 'timeAxis', dataType: 'clob', dictType: 'timeAxisDict', isStored: false },
|
|
242
|
+
associatedFields: { desktop: '@elem/xform-associated-fields', mobile: '@elem/xform-associated-fields', logicalType: 'associatedFields', dataType: 'clob', dictType: 'refFieldDict', defaultLength: 100, isStored: false },
|
|
243
|
+
'serial-number': { desktop: '@elem/xform-detail-table-serial-number', mobile: '@elem/xform-detail-table-serial-number', logicalType: 'serial-number', dataType: 'varchar', isStored: false },
|
|
244
|
+
// 编号类(落库,fdDictType=serialNumberDict)
|
|
245
|
+
mechnumber: { desktop: '@elem/xform-mechnumber', mobile: '@elem/xform-mechnumber', logicalType: 'mechnumber', dataType: 'varchar', dictType: 'serialNumberDict', defaultLength: 200, isStored: true },
|
|
246
|
+
manualNumber: { desktop: '@elem/xform-manual-number', mobile: '@elem/xform-manual-number', logicalType: 'manualNumber', dataType: 'varchar', dictType: 'serialNumberDict', defaultLength: 200, isStored: true },
|
|
247
|
+
reserveNumber: { desktop: '@elem/xform-reserve-number', mobile: '@elem/xform-reserve-number', logicalType: 'reserveNumber', dataType: 'varchar', dictType: 'serialNumberDict', defaultLength: 200, isStored: true },
|
|
248
|
+
// 关联 / 数据类
|
|
249
|
+
association: { desktop: '@elem/xform-association', mobile: '@elem/xform-m-association', logicalType: 'association', dataType: 'clob', dictType: 'simpleDict', isStored: true },
|
|
250
|
+
refTemplate: { desktop: '@elem/xform-association-template', mobile: '@elem/xform-m-association-template', logicalType: 'refTemplate', dataType: 'other', dictType: 'refTemplate', isStored: true },
|
|
251
|
+
foreignKey: { desktop: '@elem/xform-relation-foreignkey', mobile: '@elem/xform-m-relation-foreignkey', logicalType: 'foreignKey', dataType: 'object', dictType: 'foreignKeyDict', isStored: true },
|
|
252
|
+
cfg: { desktop: '@elem/xform-cfg', mobile: '@elem/xform-m-cfg', logicalType: 'cfg', dataType: 'other', dictType: 'baseCfgDict', isStored: true },
|
|
253
|
+
mdm: { desktop: '@elem/xform-mdm', mobile: '@elem/xform-mdm', logicalType: 'mdm', dataType: 'other', dictType: 'mdmDataDict', isStored: true },
|
|
254
|
+
dynamic: { desktop: '@elem/xform-dynamic', mobile: '@elem/xform-m-dynamic', logicalType: 'dynamic', dataType: 'other', dictType: 'dynamicDict', isStored: true },
|
|
255
|
+
component: { desktop: '@elem/xform-component', mobile: '@elem/xform-component', logicalType: 'component', dataType: 'other', dictType: 'componentDict', defaultLength: 100, isStored: true },
|
|
256
|
+
agency: { desktop: '@elem/xform-agency', mobile: '@elem/xform-m-agency', logicalType: 'agency', dataType: 'other', dictType: 'manyToManyDict', isStored: true },
|
|
257
|
+
area: { desktop: '@elem/xform-area', mobile: '@elem/xform-m-area', logicalType: 'area', dataType: 'other', dictType: 'areaDict', isStored: true },
|
|
258
|
+
tags: { desktop: '@elem/xform-tag', mobile: '@elem/xform-m-tag', logicalType: 'tags', dataType: 'other', dictType: 'manyToManyDict', defaultLength: 2000, isStored: true },
|
|
259
|
+
location: { desktop: '@elem/xform-location', mobile: '@elem/xform-m-location', logicalType: 'location', dataType: 'relation', dictType: 'mapDict', isStored: true },
|
|
260
|
+
calculate: { desktop: '@elem/xform-calculate', mobile: '@elem/xform-calculate', logicalType: 'calculate', dataType: 'number', dictType: 'numberDict', isStored: true },
|
|
261
|
+
fileEdit: { desktop: '@elem/xform-file-edit', mobile: '@elem/xform-file-edit', logicalType: 'fileEdit', dataType: 'varchar', dictType: 'attachmentDict', defaultLength: 2000, isStored: true },
|
|
262
|
+
invoice: { desktop: '@elem/xform-invoice', mobile: '@elem/xform-m-invoice', logicalType: 'invoice', dataType: 'varchar', dictType: 'attachmentDict', defaultLength: 200, isStored: true },
|
|
263
|
+
ocr: { desktop: '@elem/xform-ocr', mobile: '@elem/xform-m-ocr', logicalType: 'ocr', dataType: 'varchar', dictType: 'attachmentDict', defaultLength: 200, isStored: true },
|
|
264
|
+
auditNote: { desktop: '@elem/xform-audit-notes', mobile: '@elem/xform-audit-notes', logicalType: 'auditNote', dataType: 'varchar' },
|
|
265
|
+
template: { desktop: '@elem/xform-template', mobile: '@elem/xform-template', logicalType: 'template', dataType: 'varchar', dictType: 'simpleDict', isStored: true },
|
|
266
|
+
// 知识类(内容型组织组件)
|
|
267
|
+
'ikm-author': { desktop: '@elem/xform-ikm-author', mobile: '@elem/xform-ikm-author', logicalType: 'ikm-author', dataType: 'clob', dictType: 'simpleDict', defaultLength: 0, isStored: true },
|
|
268
|
+
'ikm-category': { desktop: '@elem/xform-ikm-category', mobile: '@elem/xform-ikm-category', logicalType: 'ikm-category', dataType: 'clob', dictType: 'simpleDict', defaultLength: 0, isStored: true },
|
|
269
|
+
'ikm-content': { desktop: '@elem/xform-ikm-content', mobile: '@elem/xform-ikm-content', logicalType: 'ikm-content', dataType: 'clob', dictType: 'simpleDict', defaultLength: 0, isStored: true },
|
|
270
|
+
'ikm-player': { desktop: '@elem/xform-ikm-player', mobile: '@elem/xform-ikm-player', logicalType: 'ikm-player', dataType: 'clob', dictType: 'simpleDict', defaultLength: 0, isStored: true },
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* 容器类控件:**不能**作为 `--add-field` 的数据项(它们在平台里是「数据模型」或视图容器,
|
|
274
|
+
* 而非字段)。用专用参数创建,或由设计器配置。
|
|
275
|
+
*
|
|
276
|
+
* 真实环境(1628 个表单)核对:模型 `fdType` 仅有 `main` / `detail` / `single`;
|
|
277
|
+
* `bigDetail`、`paged` 两个控件包存在但无任何表单使用。
|
|
278
|
+
*/
|
|
279
|
+
exports.CONTAINER_CONTROL_TYPES = {
|
|
280
|
+
detail: { pkg: '@elem/xform-detail-table', hint: '明细表:请用 --detail "标题=字段:标题[:类型],..." 创建' },
|
|
281
|
+
bigDetail: { pkg: '@elem/xform-big-data-detail-table', hint: '大数据明细表:暂不支持(环境中无使用样例可核对)' },
|
|
282
|
+
paged: { pkg: '@elem/xform-paged', hint: '分页容器:暂不支持(环境中无使用样例可核对)' },
|
|
283
|
+
};
|
|
284
|
+
/**
|
|
285
|
+
* 控件「提示文字」的多语言资源键名(资源键为 `{pkg}###langs###{键名}`)。
|
|
286
|
+
*
|
|
287
|
+
* 来源:各控件源码的 `defaultProps.placeholder`(如 `el-form/widget/xform-datetime` →
|
|
288
|
+
* `@elem/xform-datetime###langs###pleaseEnter`、`xform-m-datetime` → `...###langs###enter`、
|
|
289
|
+
* `xform-area` → `...###langs###pleaseSelect`;其余控件为 `placeholder`)。
|
|
290
|
+
* **键名不对就取不到文案**——日期控件提示文字缺失正是此前一律查 `placeholder` 所致。
|
|
291
|
+
*/
|
|
292
|
+
exports.CONTROL_PLACEHOLDER_LANG_KEYS = {
|
|
293
|
+
'@elem/xform-datetime': 'pleaseEnter',
|
|
294
|
+
'@elem/xform-m-datetime': 'enter',
|
|
295
|
+
'@elem/xform-timepicker': 'pleaseEnter',
|
|
296
|
+
'@elem/xform-m-timepicker': 'pleaseEnter',
|
|
297
|
+
'@elem/xform-area': 'pleaseSelect',
|
|
298
|
+
'@elem/xform-m-area': 'pleaseSelect',
|
|
299
|
+
};
|
|
300
|
+
/** 提示文字资源键的兜底探测顺序(映射表未命中时按序尝试;环境对不存在的键返回 null) */
|
|
301
|
+
exports.PLACEHOLDER_LANG_KEY_CANDIDATES = [
|
|
302
|
+
'placeholder',
|
|
303
|
+
'pleaseEnter',
|
|
304
|
+
'enter',
|
|
305
|
+
'pleaseSelect',
|
|
306
|
+
];
|
|
307
|
+
/** 业务关联(relation)的属性面板由平台拼装,故语义规则在此声明 */
|
|
308
|
+
exports.CONTROL_SEMANTIC_RULES = {
|
|
309
|
+
relation: [
|
|
310
|
+
{
|
|
311
|
+
// 关联表单(业务对象):必须选到表单并设置显示值
|
|
312
|
+
message: '关联表单不能为空:需在设计器中选择业务对象并设置显示值(relationCfg.appCode / relationCfg.refFieldName)',
|
|
313
|
+
ok: (get) => Boolean(get('relationCfg.appCode') && get('relationCfg.refFieldName')),
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
message: '列表设置为必填项:需在数据源配置中选择显示项(datasource.columns)',
|
|
317
|
+
renderModes: ['singlelist', 'mullist', 'treeList', 'multiTreeList'],
|
|
318
|
+
ok: (get) => {
|
|
319
|
+
const columns = get('datasource.columns');
|
|
320
|
+
return Array.isArray(columns) && columns.length > 0;
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
message: '卡片设置为必填项:需配置卡片标题、卡片封面与显示项(datasource.card.displayName / displayImage / datasource.columns)',
|
|
325
|
+
renderModes: ['card', 'multiCard', 'treeCard', 'multiTreeCard'],
|
|
326
|
+
ok: (get) => {
|
|
327
|
+
const columns = get('datasource.columns');
|
|
328
|
+
return Boolean(get('datasource.card.displayImage') && get('datasource.card.displayName')) &&
|
|
329
|
+
Array.isArray(columns) && columns.length > 0;
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
message: '导航设置为必填项:需配置连接设置与自循环字段(datasource.tree.conditionsFromTree / relationConditions / relationCfg)',
|
|
334
|
+
renderModes: ['treeCard', 'multiTreeCard', 'treeList', 'multiTreeList'],
|
|
335
|
+
ok: (get) => {
|
|
336
|
+
if (get('datasource.tree.navigationMode') === 'category')
|
|
337
|
+
return true;
|
|
338
|
+
const conditions = get('datasource.tree.relationConditions');
|
|
339
|
+
const valid = Array.isArray(conditions) &&
|
|
340
|
+
conditions.some((item) => item?.field?.name && item?.value?.field?.name);
|
|
341
|
+
return Boolean(get('datasource.tree.conditionsFromTree') &&
|
|
342
|
+
get('datasource.tree.relationCfg.refFieldName') &&
|
|
343
|
+
get('datasource.tree.relationCfg.modelId') &&
|
|
344
|
+
valid);
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
message: '树层级设置为必填项:需配置自循环字段(datasource.tree.relationConditions)',
|
|
349
|
+
renderModes: ['panel', 'multiPanel', 'tree', 'multiTree'],
|
|
350
|
+
ok: (get) => {
|
|
351
|
+
if (get('datasource.tree.treeLoop') === false)
|
|
352
|
+
return true;
|
|
353
|
+
const conditions = get('datasource.tree.relationConditions');
|
|
354
|
+
return Array.isArray(conditions) &&
|
|
355
|
+
conditions.some((item) => item?.field?.name && item?.value?.field?.name);
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
],
|
|
359
|
+
};
|
|
360
|
+
/**
|
|
361
|
+
* 设计器为新控件写入的默认属性(控件包 `config.json` 未声明、由设计器给定)。
|
|
362
|
+
*
|
|
363
|
+
* 取值依据:环境内该控件真实落库数据的分布(占比见注释),用于让 CLI 生成的控件
|
|
364
|
+
* 与设计器创建的控件保持一致。
|
|
365
|
+
*/
|
|
366
|
+
exports.CONTROL_DEFAULT_PROPS = {
|
|
367
|
+
// 环境内 1371 个业务关联字段:renderMode=singlelist 95%、direction=column 99%、rowCount=3 99%、isForwardView=no 98%
|
|
368
|
+
// (mappedType 仅 5% 字段有值,属按需配置,不做默认)
|
|
369
|
+
'@elem/xform-relation': {
|
|
370
|
+
renderMode: 'singlelist',
|
|
371
|
+
direction: 'column',
|
|
372
|
+
rowCount: 3,
|
|
373
|
+
isForwardView: 'no',
|
|
374
|
+
},
|
|
375
|
+
// 环境内 115 个金额字段:precision 出现率 100%(88% 为 2、9% 为 4);控件包 config.json
|
|
376
|
+
// 未声明该项默认值,平台数据迁移代码(sys-xform/src/components/ide/util/dataMigration.ts)
|
|
377
|
+
// 在缺省时按 0 位小数落库,故显式写 2 位,与设计器新建字段(如「参考单价」)一致。
|
|
378
|
+
// symbol(币种)属业务选择——环境内 69% 为 CNY、28% 为空——取中立的空值,不替用户假定币种。
|
|
379
|
+
'@elem/xform-money': { precision: 2, symbol: '' },
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* 业务关联控件的前端扩展数据路径。
|
|
383
|
+
*
|
|
384
|
+
* 来源:控件源码 JSDoc(`sys-modeling/src/elem/widget/xform-relation/index.tsx`)——
|
|
385
|
+
* `relationCfg` 声明 `@frontExtendData {children:['modelId','refFieldName','tableType','tableName']}`、
|
|
386
|
+
* `datasource` 声明 `@frontExtendData {children:['queryCondition','querySorters','columns','filters',
|
|
387
|
+
* 'tree','card','isForwardView','conditionSetting']}`,另有 `renderMode`、`outParams`。
|
|
388
|
+
* 运行时/公式依赖 `fdFontExtendData` 里的这些键(与 `controlProps` 两处并存)。
|
|
389
|
+
*/
|
|
390
|
+
exports.RELATION_FRONT_EXTEND_PATHS = [
|
|
391
|
+
'modelName',
|
|
392
|
+
'relationCfg.modelId',
|
|
393
|
+
'relationCfg.refFieldName',
|
|
394
|
+
'relationCfg.tableType',
|
|
395
|
+
'relationCfg.tableName',
|
|
396
|
+
'datasource.queryCondition',
|
|
397
|
+
'datasource.querySorters',
|
|
398
|
+
'datasource.columns',
|
|
399
|
+
'datasource.filters',
|
|
400
|
+
'datasource.tree',
|
|
401
|
+
'datasource.card',
|
|
402
|
+
'datasource.isForwardView',
|
|
403
|
+
'datasource.conditionSetting',
|
|
404
|
+
'renderMode',
|
|
405
|
+
'outParams',
|
|
406
|
+
];
|
|
407
|
+
/**
|
|
408
|
+
* 需要到设计器完成配置的控件(按键为控件逻辑类型)。
|
|
409
|
+
*
|
|
410
|
+
* 这些控件的关键属性是「环境对象选择」(选主数据 / 配置项 / 关联范围 / 编号规则 …),
|
|
411
|
+
* CLI 只创建控件骨架,无法替用户选择,因此生成时给出提示。
|
|
412
|
+
* 多数会在发布前校验中被拦下(缺必填属性);`associatedFields` 是例外——
|
|
413
|
+
* 它没有必填属性,但未配置关联源时**后端发布会直接失败**(HTTP 500,已实测)。
|
|
414
|
+
*/
|
|
415
|
+
/**
|
|
416
|
+
* 即使**没有**触发必填/语义校验错误也要提示「需设计器配置」的控件。
|
|
417
|
+
*
|
|
418
|
+
* 其余控件的关系是:提示仅在该字段确实缺配置(有校验错误)时输出——
|
|
419
|
+
* 例如已配置好的业务关联字段不该再被提示「只建骨架会得到不可用控件」。
|
|
420
|
+
* `associatedFields` 是例外:它没有必填属性,问题要到后端发布时才暴露(HTTP 500),
|
|
421
|
+
* 提示是唯一的信号,必须无条件给出。
|
|
422
|
+
*/
|
|
423
|
+
exports.CONTROL_NOTE_WITHOUT_ERRORS = new Set(['associatedFields']);
|
|
424
|
+
exports.CONTROL_DESIGNER_NOTES = {
|
|
425
|
+
associatedFields: '关联字段:需在设计器中指定关联源字段/引用表单;未配置时后端发布会失败',
|
|
426
|
+
// 业务关联:控件包本身被平台标记为 deprecated(xform.group='deprecated'),
|
|
427
|
+
// 且必须配置业务对象(relationCfg)/数据源(datasource)/传出参数(outParams)才有意义,
|
|
428
|
+
// 而它**没有必填属性**——只建骨架会静默产出一个不可用控件,必须在生成时提示。
|
|
429
|
+
relation: '业务关联:需在设计器中配置业务对象(relationCfg)、数据源(datasource)与传出参数(outParams)——只建骨架会得到一个没有数据源的控件(能保存能发布,但不可用)。控件包已被平台标记为废弃(group=deprecated),存量表单使用较多;新表单建议改用 association(关联选择)或 relationQuery(关联查询)',
|
|
430
|
+
relationQuery: '关联查询:需在设计器中配置查询页签与数据源(tabs)',
|
|
431
|
+
association: '关联选择:需在设计器中配置关联范围与列表列',
|
|
432
|
+
refTemplate: '关联模板:需在设计器中指定关联模板',
|
|
433
|
+
foreignKey: '外键关联:需在设计器中指定映射类型与目标模型',
|
|
434
|
+
cfg: '配置控件:需在设计器中指定配置项',
|
|
435
|
+
mdm: '主数据:需在设计器中指定主数据模型',
|
|
436
|
+
dynamic: '动态控件:需在设计器中指定接口',
|
|
437
|
+
mechnumber: '机制编号:需在设计器中配置编号规则',
|
|
438
|
+
manualNumber: '手工编号:需在设计器中配置编号规则',
|
|
439
|
+
reserveNumber: '预留编号:需在设计器中配置编号规则',
|
|
440
|
+
invoice: '票据识别:需在设计器中指定识别类型',
|
|
441
|
+
ocr: 'OCR 识别:需在设计器中指定识别类型',
|
|
442
|
+
auditNote: '审批意见:需在设计器中指定显示字段',
|
|
443
|
+
attdemo: '附件(模板):需在设计器中指定默认附件',
|
|
444
|
+
imageDemo: '图片(模板):需在设计器中指定默认图片',
|
|
121
445
|
};
|
|
122
446
|
/** 明细表控件(数据项类型为 varchar,控件逻辑类型 detail) */
|
|
123
447
|
exports.DETAIL_CONTROL = {
|