cloud-web-corejs 1.0.54-dev.687 → 1.0.54-dev.689
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 +1 -1
- package/src/components/fileLibrary/index.vue +113 -33
- package/src/components/table/CellSlot.vue +12 -10
- package/src/components/xform/docs//345/220/216/345/217/260/345/255/227/346/256/265/357/274/210/345/212/250/346/200/201/347/224/237/346/210/220/357/274/211JSON /350/257/264/346/230/216.md" +1261 -0
- package/src/components/xform/docs//346/225/260/346/215/256/350/241/250/346/240/274/345/212/250/346/200/201/345/210/227 JSON /350/257/264/346/230/216.md" +657 -0
- package/src/components/xform/form-designer/designer.js +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/cascader-widget.vue +157 -105
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +98 -18
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +18 -13
- package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +11 -8
- package/src/components/xform/form-designer/form-widget/field-widget/script-input-widget.vue +143 -0
- package/src/components/xform/form-designer/indexMixin.js +837 -13
- package/src/components/xform/form-designer/setting-panel/option-items-setting.vue +69 -21
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +87 -25
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +5 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +80 -34
- package/src/components/xform/form-designer/setting-panel/property-editor/field-cascader/checkStrictly-editor.vue +11 -13
- package/src/components/xform/form-designer/setting-panel/property-editor/field-cascader/showAllLevels-editor.vue +21 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-script-input/script-input-editor.vue +54 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +15 -4
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +2 -0
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +117 -2
- package/src/components/xform/form-render/container-item/data-table-mixin.js +296 -118
- package/src/components/xform/form-render/container-item/dynamicFieldMixin.js +50 -36
- package/src/components/xform/form-render/container-item/list-h5-item.vue +5 -1
- package/src/components/xform/form-render/indexMixin.js +197 -12
- package/src/components/xform/lang/en-US.js +1 -0
- package/src/components/xform/lang/zh-CN.js +86 -99
- package/src/components/xform/utils/dynamicSchemaUtil.js +312 -0
- package/src/components/xform/utils/tableCellValidateUtil.js +148 -0
- package/src/components/xform/utils/tableColumnHelper.js +21 -1
- package/src/components/xform/utils/util.js +126 -0
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
document: "文档",
|
|
8
8
|
qqGroup: "技术WX群",
|
|
9
9
|
deployment: "私有部署",
|
|
10
|
-
subscription: "订阅Pro"
|
|
10
|
+
subscription: "订阅Pro",
|
|
11
11
|
},
|
|
12
12
|
designer: {
|
|
13
13
|
componentLib: "组件库",
|
|
@@ -37,8 +37,9 @@ export default {
|
|
|
37
37
|
"vf-dialog": "弹出窗口",
|
|
38
38
|
"vf-drawer": "侧滑抽屉",
|
|
39
39
|
input: "单行输入",
|
|
40
|
-
|
|
40
|
+
"input-batch": "批量输入",
|
|
41
41
|
textarea: "多行输入",
|
|
42
|
+
"script-input": "脚本输入框",
|
|
42
43
|
number: "计数器",
|
|
43
44
|
radio: "单选项",
|
|
44
45
|
checkbox: "多选项",
|
|
@@ -57,46 +58,46 @@ export default {
|
|
|
57
58
|
"vue-page": "Vue页面",
|
|
58
59
|
button: "按钮",
|
|
59
60
|
divider: "分隔线",
|
|
60
|
-
census:
|
|
61
|
-
|
|
61
|
+
census: "统计",
|
|
62
|
+
"title-head": "标题头",
|
|
62
63
|
"picture-upload": "图片",
|
|
63
64
|
"file-upload": "文件",
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
65
|
+
vabUpload: "凭证",
|
|
66
|
+
vabUpload2: "凭证(海信)",
|
|
67
|
+
vabsearch: "搜索框",
|
|
68
|
+
search_button: "搜索按钮",
|
|
69
|
+
save_button: "保存按钮",
|
|
70
|
+
reset_button: "刷新按钮",
|
|
71
|
+
add_button: "新增按钮",
|
|
72
|
+
export_button: "导出按钮",
|
|
73
|
+
import_button: "导入按钮",
|
|
73
74
|
"import-button": "导入按钮",
|
|
74
75
|
"import2-button": "明细导入按钮",
|
|
75
76
|
"print-button": "导出/打印(列表)",
|
|
76
77
|
"print-detail-button": "导出/打印(详情)",
|
|
77
|
-
|
|
78
|
+
copy_button: "复制按钮",
|
|
78
79
|
"rich-editor": "富文本",
|
|
79
80
|
cascader: "级联选择",
|
|
80
81
|
"area-select": "地区选择",
|
|
81
82
|
slot: "插槽",
|
|
82
|
-
echart:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
echart: "图表",
|
|
84
|
+
"echart-pie": "饼图",
|
|
85
|
+
"echart-bar": "柱状图",
|
|
86
|
+
"echart-category": "折线图",
|
|
86
87
|
custom: "Custom Component",
|
|
87
|
-
|
|
88
|
-
descriptions:
|
|
89
|
-
panel:
|
|
90
|
-
query:
|
|
88
|
+
"news-list": "列表",
|
|
89
|
+
descriptions: "描述列表",
|
|
90
|
+
panel: "面板",
|
|
91
|
+
query: "查询模块",
|
|
91
92
|
detail: "详情模块",
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
"detail-pane": "详情tab",
|
|
94
|
+
"detail-h5": "H5详情",
|
|
95
|
+
"list-h5": "H5列表",
|
|
96
|
+
text: "文本",
|
|
97
|
+
"tree-pane": "树/列表布局",
|
|
98
|
+
"h5-card": "h5卡片",
|
|
99
|
+
"h5-card-pane": "h5卡片选项卡",
|
|
100
|
+
"h5-table": "h5表格",
|
|
100
101
|
tree: "树形",
|
|
101
102
|
"table-export-button": "列表导出",
|
|
102
103
|
"select-export-item-button": "列表导出(明细)",
|
|
@@ -104,8 +105,8 @@ export default {
|
|
|
104
105
|
status: "状态",
|
|
105
106
|
"a-link": "超链接按钮",
|
|
106
107
|
"a-text": "超链接文本",
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
"project-tag": "标签",
|
|
109
|
+
dropdown: "下拉按钮",
|
|
109
110
|
|
|
110
111
|
"create_by-text": "创建人",
|
|
111
112
|
"modify_by-text": "更新人",
|
|
@@ -115,10 +116,12 @@ export default {
|
|
|
115
116
|
"saleOrg-vabsearch": "机构(单选)",
|
|
116
117
|
"user-project-tag": "用户(多选)",
|
|
117
118
|
"saleOrg-project-tag": "机构(多选)",
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
tempStorage: "暂存按钮",
|
|
120
|
+
oplog: "操作日志",
|
|
121
|
+
gantt: "甘特图",
|
|
121
122
|
"download-button": "附件下载",
|
|
123
|
+
cascader: "级联选择",
|
|
124
|
+
childrenKeyName: "子节点属性名称",
|
|
122
125
|
},
|
|
123
126
|
hint: {
|
|
124
127
|
formulaSetting: "公式设置",
|
|
@@ -146,60 +149,42 @@ export default {
|
|
|
146
149
|
formulaObject: "对象",
|
|
147
150
|
formulaDate: "日期",
|
|
148
151
|
formulaChar: "文字",
|
|
149
|
-
formulaPleaseSelect:
|
|
150
|
-
"请选择组件名和函数",
|
|
152
|
+
formulaPleaseSelect: "请选择组件名和函数",
|
|
151
153
|
formulaSample: "公式编辑举例",
|
|
152
154
|
formulaPara: "参数",
|
|
153
|
-
formulaINT:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
formulaMAX:
|
|
164
|
-
"返回一组数中的最大值,举例:MAX(1,2,3,...)=3",
|
|
165
|
-
formulaMIN:
|
|
166
|
-
"返回一组数中的最小值,举例:MIN(1,2,3,...)=1",
|
|
167
|
-
formulaABS:
|
|
168
|
-
"求一个数的绝对值,举例:ABS(-5)=5",
|
|
169
|
-
formulaROUND:
|
|
170
|
-
"将数值保留指定小数位,举例:ROUND(8.999,2)=9.00",
|
|
171
|
-
formulaCEILING:
|
|
172
|
-
"将一个数向上取整,举例:CEILING(8.9)=9",
|
|
155
|
+
formulaINT: "将数值去掉小数,举例:INT(-8.9)=-9",
|
|
156
|
+
formulaSUM: "返回一组数据的和,举例:SUM(1,2,3,...)=6",
|
|
157
|
+
formulaSUMIF: `根据单个条件对指定区域内的数值求和,举例:SUMIF([10, 20, 30], ">10", [80, 120, 90])=210`,
|
|
158
|
+
formulaSUMIFS: `根据多个条件对指定区域内的数值求和(条件需同时满足),举例:SUMIFS([1000, 2000, 1500, 3000], [400, 600, 700, 800], '>500', [2022, 2023, 2023, 2024], 2023)=3500`,
|
|
159
|
+
formulaAVERAGE: "返回一组数据的平均数,举例:AVERAGE(1,2,3,...)=2",
|
|
160
|
+
formulaMAX: "返回一组数中的最大值,举例:MAX(1,2,3,...)=3",
|
|
161
|
+
formulaMIN: "返回一组数中的最小值,举例:MIN(1,2,3,...)=1",
|
|
162
|
+
formulaABS: "求一个数的绝对值,举例:ABS(-5)=5",
|
|
163
|
+
formulaROUND: "将数值保留指定小数位,举例:ROUND(8.999,2)=9.00",
|
|
164
|
+
formulaCEILING: "将一个数向上取整,举例:CEILING(8.9)=9",
|
|
173
165
|
formulaLOG:
|
|
174
166
|
"返回以参数2为底参数1的对数,举例:LOG(8,2)=3,以2为底8的对数为3",
|
|
175
|
-
formulaMOD:
|
|
176
|
-
|
|
177
|
-
formulaPOWER:
|
|
178
|
-
"求数字的N次方,举例:POWER(5, 3)=125",
|
|
167
|
+
formulaMOD: "求两数相除的余数,举例:MOD(2,6)=2",
|
|
168
|
+
formulaPOWER: "求数字的N次方,举例:POWER(5, 3)=125",
|
|
179
169
|
formulaAND:
|
|
180
170
|
"当所有条件都符合时,返回true,否则返回false,举例:AND(1>0,2>1,...)=TRUE",
|
|
181
171
|
formulaIF:
|
|
182
172
|
"判断一个条件能否满足,如果满足则返回一个值,如果不满足则返回另一个值,举例:IF(1>2,1,0)=0",
|
|
183
|
-
formulaIFS:
|
|
184
|
-
|
|
185
|
-
formulaIFERROR:
|
|
186
|
-
"举例:IFERROR('#DIV/0!', 'Error')",
|
|
173
|
+
formulaIFS: "举例:IFS(false, 'Hello!', true, 'Goodbye!')=Goodbye!",
|
|
174
|
+
formulaIFERROR: "举例:IFERROR('#DIV/0!', 'Error')",
|
|
187
175
|
formulaIFNA: "举例:IFNA('#N/A', 'Error')",
|
|
188
176
|
formulaNOT: "举例:NOT(true)=false",
|
|
189
177
|
formulaOR: "举例: OR (true, false, true)=true",
|
|
190
178
|
formulaSWITCH:
|
|
191
179
|
"SWITCH(参数值,条件1,'条件值1',条件2,'条件值2'[,条件N,'条件值N',]),举例:SWITCH(7, 9, 'Nine', 7, 'Seven')=Seven",
|
|
192
|
-
formulaXOR:
|
|
193
|
-
"举例:XOR(true, false, true)=false",
|
|
180
|
+
formulaXOR: "举例:XOR(true, false, true)=false",
|
|
194
181
|
formulaYEAR: '举例:YEAR("2022-10-1")=2022',
|
|
195
182
|
formulaMONTH: '举例:MONTH("2022-10-1")=10',
|
|
196
183
|
formulaDAY: '举例:DAY("2022-10-11")=11',
|
|
197
184
|
formulaTODAY: '举例: TODAY()="2022-10-11"',
|
|
198
185
|
formulaNOW: '举例: NOW="2022-10-11 17:04:33"',
|
|
199
|
-
formulaEMONTH:
|
|
200
|
-
|
|
201
|
-
formulaEDAY:
|
|
202
|
-
"举例: EMONTH ('2022-12-13 ', -1)='2022-12-12 '",
|
|
186
|
+
formulaEMONTH: "举例: EMONTH ('2022-12-13 ', -1)='2022-11-13 '",
|
|
187
|
+
formulaEDAY: "举例: EMONTH ('2022-12-13 ', -1)='2022-12-12 '",
|
|
203
188
|
formulaFIND: `查找字符串(参数:
|
|
204
189
|
1、查找句柄 2、查找目标字符串 3、开始查找下标),
|
|
205
190
|
举例:FIND('M', 'Miriam McGovern', 3)=8`,
|
|
@@ -207,20 +192,16 @@ export default {
|
|
|
207
192
|
"获取字符串左侧N个字符,LEFT(字符串,截取长度),举例:LEFT('Sale Price', 4)=Sale",
|
|
208
193
|
formulaRIGHT:
|
|
209
194
|
"获取字符串右侧N个字符 RIGHT(字符串,截取长度),举例:RIGHT('Sale Price', 5)=Price",
|
|
210
|
-
formulaLEN:
|
|
211
|
-
"统计字符串长度,举例:LEN('abcdefgh')=8",
|
|
195
|
+
formulaLEN: "统计字符串长度,举例:LEN('abcdefgh')=8",
|
|
212
196
|
formulaLOWER:
|
|
213
197
|
"字符串转小写,举例:LOWER('E. E. Cummings')=e. e. cummings",
|
|
214
|
-
formulaUPPER:
|
|
215
|
-
"字符串转大写,举例:UPPER('total')=TOTAL",
|
|
198
|
+
formulaUPPER: "字符串转大写,举例:UPPER('total')=TOTAL",
|
|
216
199
|
formulaMID:
|
|
217
200
|
"截取字符串 MID(字符串,开始下标,截取长度),举例:MID('Fluid Flow', 7, 20)=Flow",
|
|
218
201
|
formulaTRIM:
|
|
219
202
|
"字符串去除多余空格 TRIM(字符串),举例:TRIM(' First Quarter ')=First Quarter",
|
|
220
|
-
formulaDateError:
|
|
221
|
-
|
|
222
|
-
formulaDateErrorMsg:
|
|
223
|
-
"日期转换错误明细",
|
|
203
|
+
formulaDateError: "日期格式不正确",
|
|
204
|
+
formulaDateErrorMsg: "日期转换错误明细",
|
|
224
205
|
|
|
225
206
|
selectParentWidget: "选中父组件",
|
|
226
207
|
moveUpWidget: "上移组件",
|
|
@@ -269,7 +250,8 @@ export default {
|
|
|
269
250
|
sampleLoadedSuccess: "表单示例加载成功",
|
|
270
251
|
sampleLoadedFail: "表单示例加载失败",
|
|
271
252
|
loadFormTemplate: "加载此模板",
|
|
272
|
-
loadFormTemplateHint:
|
|
253
|
+
loadFormTemplateHint:
|
|
254
|
+
"是否加载这个模板?加载后会覆盖设计器当前表单,你可以使用“撤销”功能恢复。",
|
|
273
255
|
loadFormTemplateSuccess: "表单模板加载成功",
|
|
274
256
|
loadFormTemplateFailed: "表单模板加载失败",
|
|
275
257
|
currentNodeCannotBeSelected: "当前组件节点不可选择",
|
|
@@ -293,12 +275,16 @@ export default {
|
|
|
293
275
|
urlValidator: "网址",
|
|
294
276
|
noChineseValidator: "非中文字符",
|
|
295
277
|
chineseValidator: "仅中文字符",
|
|
296
|
-
rowspanNotConsistentForMergeEntireRow:
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
278
|
+
rowspanNotConsistentForMergeEntireRow:
|
|
279
|
+
"存在行高不一致的单元格, 无法合并整行.",
|
|
280
|
+
colspanNotConsistentForMergeEntireColumn:
|
|
281
|
+
"存在列宽不一致的单元格, 无法合并整列.",
|
|
282
|
+
rowspanNotConsistentForDeleteEntireRow:
|
|
283
|
+
"存在行高不一致的单元格, 不可删除整行.",
|
|
284
|
+
colspanNotConsistentForDeleteEntireColumn:
|
|
285
|
+
"存在列宽不一致的单元格, 不可删除整列.",
|
|
300
286
|
lastColCannotBeDeleted: "最后一列不可删除.",
|
|
301
|
-
lastRowCannotBeDeleted: "最后一行不可删除."
|
|
287
|
+
lastRowCannotBeDeleted: "最后一行不可删除.",
|
|
302
288
|
},
|
|
303
289
|
toolbar: {
|
|
304
290
|
undoHint: "撤销",
|
|
@@ -314,7 +300,7 @@ export default {
|
|
|
314
300
|
exportJson: "导出JSON",
|
|
315
301
|
exportCode: "导出代码",
|
|
316
302
|
generateCode: "生成代码",
|
|
317
|
-
generateSFC: "生成SFC"
|
|
303
|
+
generateSFC: "生成SFC",
|
|
318
304
|
},
|
|
319
305
|
setting: {
|
|
320
306
|
basicSetting: "基本属性",
|
|
@@ -351,7 +337,7 @@ export default {
|
|
|
351
337
|
disabled: "禁用",
|
|
352
338
|
hidden: "隐藏",
|
|
353
339
|
textContent: "静态文字",
|
|
354
|
-
preWrap:
|
|
340
|
+
preWrap: "自动换行",
|
|
355
341
|
htmlContent: "HTML",
|
|
356
342
|
clearable: "可清除",
|
|
357
343
|
areaDataType: "地区层级",
|
|
@@ -372,12 +358,13 @@ export default {
|
|
|
372
358
|
multiple: "选项可多选",
|
|
373
359
|
multipleLimit: "多选数量限制",
|
|
374
360
|
checkStrictly: "任意级节点可选",
|
|
361
|
+
showAllLevels: "显示完整路径",
|
|
375
362
|
contentPosition: "文字位置",
|
|
376
363
|
dividerDirection: "分割线方向",
|
|
377
364
|
plain: "朴素按钮",
|
|
378
365
|
round: "圆角按钮",
|
|
379
366
|
circle: "圆形按钮",
|
|
380
|
-
space:
|
|
367
|
+
space: "间隔(px)",
|
|
381
368
|
icon: "图标",
|
|
382
369
|
optionsSetting: "选项设置",
|
|
383
370
|
addOption: "增加选项",
|
|
@@ -406,12 +393,12 @@ export default {
|
|
|
406
393
|
colOffsetTitle: "左侧间隔格数",
|
|
407
394
|
colPushTitle: "右移栅格数",
|
|
408
395
|
colPullTitle: "左移栅格数",
|
|
409
|
-
colHeight:
|
|
396
|
+
colHeight: "栅格高度(px或%)",
|
|
410
397
|
addColumn: "增加栅格",
|
|
411
398
|
responsive: "响应式布局",
|
|
412
399
|
tabPaneSetting: "选项卡设置",
|
|
413
400
|
addTabPane: "增加选项卡页",
|
|
414
|
-
tabClass:
|
|
401
|
+
tabClass: "选项卡样式",
|
|
415
402
|
paneActive: "激活",
|
|
416
403
|
customLabelIcon: "定制字段标签",
|
|
417
404
|
labelIconClass: "标签Icon样式",
|
|
@@ -422,7 +409,7 @@ export default {
|
|
|
422
409
|
precision: "精度",
|
|
423
410
|
step: "增减步长",
|
|
424
411
|
controlsPosition: "控制按钮位置",
|
|
425
|
-
showbutton:
|
|
412
|
+
showbutton: "是否显示按钮",
|
|
426
413
|
minLength: "最小长度",
|
|
427
414
|
maxLength: "最大长度",
|
|
428
415
|
showWordLimit: "显示字数统计",
|
|
@@ -476,10 +463,10 @@ export default {
|
|
|
476
463
|
formCss: "表单全局CSS",
|
|
477
464
|
addCss: "编写CSS",
|
|
478
465
|
customClass: "自定义CSS样式",
|
|
479
|
-
containerClass:
|
|
466
|
+
containerClass: "容器样式",
|
|
480
467
|
styleTitClass: "样式选择",
|
|
481
468
|
styleTableClass: "表格样式",
|
|
482
|
-
iconClass:
|
|
469
|
+
iconClass: "图标样式",
|
|
483
470
|
globalFunctions: "表单全局函数",
|
|
484
471
|
addEventHandler: "编写代码",
|
|
485
472
|
editWidgetEventHandler: "组件事件处理",
|
|
@@ -591,8 +578,8 @@ export default {
|
|
|
591
578
|
dsRequestBooleanTypeError: "布尔类型值错误",
|
|
592
579
|
dsValidationError: "数据源设置存在错误,请修改",
|
|
593
580
|
dsDuplicatedNameError: "数据源名称重复,请修改!",
|
|
594
|
-
echartHeight:
|
|
595
|
-
isFullscreen:
|
|
581
|
+
echartHeight: "高度",
|
|
582
|
+
isFullscreen: "是否全屏",
|
|
596
583
|
widgetWidth: "组件宽度",
|
|
597
584
|
isFixbottom: "是否固定到最底",
|
|
598
585
|
|
|
@@ -621,7 +608,7 @@ export default {
|
|
|
621
608
|
enterForQuery: "输入关键字进行过滤",
|
|
622
609
|
add: "添加",
|
|
623
610
|
delete: "删除",
|
|
624
|
-
censusClass:
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
}
|
|
611
|
+
censusClass: "统计样式",
|
|
612
|
+
},
|
|
613
|
+
},
|
|
614
|
+
};
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 后台动态定义(表头后台字段 / 数据表格动态列)共用协议。
|
|
3
|
+
*
|
|
4
|
+
* 单条定义顶层字段:
|
|
5
|
+
* - 通用:keyName、type、label、optionItems、required 等字段级属性、options
|
|
6
|
+
* - 表头:colspan
|
|
7
|
+
* - 数据表格:width、formatS(展示列)、children(多级表头)、dropdownItems(dropdown 操作列)
|
|
8
|
+
*
|
|
9
|
+
* 请求体:{ formData, ...extra }
|
|
10
|
+
* 响应体:objx 数组,或 { fields: [] } / { columns: [] }
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** 顶层字段白名单 */
|
|
14
|
+
export const DYNAMIC_SCHEMA_CORE_KEYS = [
|
|
15
|
+
"keyName",
|
|
16
|
+
"type",
|
|
17
|
+
"label",
|
|
18
|
+
"optionItems",
|
|
19
|
+
"options",
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
/** 字段级属性:写顶层,不写 options(与表头 dynamicFieldMixin 一致) */
|
|
23
|
+
export const DYNAMIC_SCHEMA_WIDGET_FLAG_KEYS = [
|
|
24
|
+
"required",
|
|
25
|
+
"readonly",
|
|
26
|
+
"disabled",
|
|
27
|
+
"hidden",
|
|
28
|
+
"defaultValue",
|
|
29
|
+
"placeholder",
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
export const DYNAMIC_SCHEMA_TABLE_HEADER_KEYS = ["colspan"];
|
|
33
|
+
|
|
34
|
+
export const DYNAMIC_SCHEMA_COLUMN_EXTRA_KEYS = [
|
|
35
|
+
"width",
|
|
36
|
+
"align",
|
|
37
|
+
"sortable",
|
|
38
|
+
"filterable",
|
|
39
|
+
"show",
|
|
40
|
+
"fixed",
|
|
41
|
+
"formatS",
|
|
42
|
+
"render",
|
|
43
|
+
"utcTransformEnabled",
|
|
44
|
+
"children",
|
|
45
|
+
"dropdownItems",
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
export const DYNAMIC_SCHEMA_OPTION_KEYS = {
|
|
49
|
+
scriptCode: ["dynamicSchemaScriptCode", "dynamicColumnScriptCode"],
|
|
50
|
+
scriptParam: ["dynamicSchemaScriptParam", "dynamicColumnScriptParam"],
|
|
51
|
+
convert: ["dynamicSchemaConvert"],
|
|
52
|
+
mode: ["dynamicSchemaMode", "dynamicColumnMode"],
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const widgetTypeToEditFormatMap = {
|
|
56
|
+
input: "editInput",
|
|
57
|
+
number: "editNumber",
|
|
58
|
+
date: "editDate",
|
|
59
|
+
select: "editSelect",
|
|
60
|
+
vabsearch: "editSearch",
|
|
61
|
+
baseAttachment: "editAttachment",
|
|
62
|
+
status: "editStatus",
|
|
63
|
+
text: "text",
|
|
64
|
+
checkbox: "checkbox",
|
|
65
|
+
radio: "radio",
|
|
66
|
+
textarea: "textarea",
|
|
67
|
+
"script-input": "editScriptInput",
|
|
68
|
+
"a-text": "aText",
|
|
69
|
+
"a-link": "aLink",
|
|
70
|
+
button: "button",
|
|
71
|
+
dropdown: "dropdown",
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const ACTION_COLUMN_FORMATS = new Set(["aLink", "button", "dropdown"]);
|
|
75
|
+
|
|
76
|
+
export function buildDropdownWidgetFromDef(def, index = 0) {
|
|
77
|
+
const options = def?.options;
|
|
78
|
+
const dropdownItems = def?.dropdownItems;
|
|
79
|
+
if (!Array.isArray(dropdownItems) || !dropdownItems.length) return null;
|
|
80
|
+
|
|
81
|
+
const ts = `${Date.now()}_${index}`;
|
|
82
|
+
const widgetList = dropdownItems.map((entry, i) => ({
|
|
83
|
+
type: "dropdown-item",
|
|
84
|
+
id: `dropdownitem_${ts}_${i}`,
|
|
85
|
+
options: {
|
|
86
|
+
label: entry.label || "",
|
|
87
|
+
onClick: entry.onClick || "",
|
|
88
|
+
disabled: !!entry.disabled,
|
|
89
|
+
hidden: !!entry.hidden,
|
|
90
|
+
},
|
|
91
|
+
}));
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
type: "dropdown",
|
|
95
|
+
id: `dropdown_${ts}`,
|
|
96
|
+
options: {
|
|
97
|
+
label: def.label || "操作",
|
|
98
|
+
dropdownType: options?.dropdownType || "link",
|
|
99
|
+
dropdownTrigger: options?.dropdownTrigger || "hover",
|
|
100
|
+
dropdownFlag: 1,
|
|
101
|
+
},
|
|
102
|
+
widgetList,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function isActionColumn(item, formatS) {
|
|
107
|
+
return isActionColumnFormat(formatS, item?.type);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function isActionColumnFormat(formatS, type) {
|
|
111
|
+
if (ACTION_COLUMN_FORMATS.has(formatS)) return true;
|
|
112
|
+
return ["a-link", "button", "dropdown"].includes(type);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function isActionOrGroupColumn(item, formatS) {
|
|
116
|
+
if (Array.isArray(item.children) && item.children.length) return true;
|
|
117
|
+
return isActionColumn(item, formatS);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function buildWidgetOptions(item, formatS, label) {
|
|
121
|
+
let widgetOptions =
|
|
122
|
+
item.options && typeof item.options === "object"
|
|
123
|
+
? { ...item.options }
|
|
124
|
+
: null;
|
|
125
|
+
|
|
126
|
+
if (widgetOptions) {
|
|
127
|
+
delete widgetOptions.dropdownItems;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
DYNAMIC_SCHEMA_WIDGET_FLAG_KEYS.forEach((key) => {
|
|
131
|
+
if (item[key] !== undefined) {
|
|
132
|
+
widgetOptions = widgetOptions || {};
|
|
133
|
+
widgetOptions[key] = item[key];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
if (label) {
|
|
138
|
+
widgetOptions = widgetOptions || {};
|
|
139
|
+
if (!widgetOptions.label) {
|
|
140
|
+
widgetOptions.label = label;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (!isActionColumn(item, formatS)) {
|
|
145
|
+
widgetOptions = widgetOptions || {};
|
|
146
|
+
widgetOptions.labelHidden = true;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return widgetOptions;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function getDynamicSchemaOption(options, key) {
|
|
153
|
+
if (!options) return null;
|
|
154
|
+
const keys = DYNAMIC_SCHEMA_OPTION_KEYS[key] || [];
|
|
155
|
+
for (let i = 0; i < keys.length; i++) {
|
|
156
|
+
const val = options[keys[i]];
|
|
157
|
+
if (val !== undefined && val !== null && val !== "") {
|
|
158
|
+
return val;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function resolveDynamicSchemaExtra(paramScript, handleCustomEvent) {
|
|
165
|
+
if (!paramScript || !handleCustomEvent) return {};
|
|
166
|
+
const result = handleCustomEvent(paramScript);
|
|
167
|
+
return result && typeof result === "object" && !Array.isArray(result)
|
|
168
|
+
? result
|
|
169
|
+
: {};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function buildDynamicSchemaRequestData(
|
|
173
|
+
formModel,
|
|
174
|
+
paramScript,
|
|
175
|
+
handleCustomEvent,
|
|
176
|
+
wrapContext
|
|
177
|
+
) {
|
|
178
|
+
const extra = resolveDynamicSchemaExtra(paramScript, handleCustomEvent);
|
|
179
|
+
const payload = {
|
|
180
|
+
formData: formModel || {},
|
|
181
|
+
...extra,
|
|
182
|
+
};
|
|
183
|
+
if (!wrapContext) {
|
|
184
|
+
return payload;
|
|
185
|
+
}
|
|
186
|
+
const { formCode, formVersion, taBm, dataId } = wrapContext;
|
|
187
|
+
return {
|
|
188
|
+
formCode,
|
|
189
|
+
formVersion,
|
|
190
|
+
taBm,
|
|
191
|
+
formData: payload.formData,
|
|
192
|
+
dataId,
|
|
193
|
+
data: {
|
|
194
|
+
dataId,
|
|
195
|
+
...payload,
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** 从 objx 或转换脚本结果中提取定义数组 */
|
|
201
|
+
export function extractDynamicSchemaItems(source) {
|
|
202
|
+
if (!source) return [];
|
|
203
|
+
if (Array.isArray(source)) return source;
|
|
204
|
+
if (typeof source !== "object") return [];
|
|
205
|
+
if (Array.isArray(source.fields)) return source.fields;
|
|
206
|
+
if (Array.isArray(source.columns)) return source.columns;
|
|
207
|
+
return [];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export function resolveDynamicSchemaResponse(res, convertScript, handleCustomEvent) {
|
|
211
|
+
if (convertScript && handleCustomEvent) {
|
|
212
|
+
const result = handleCustomEvent(convertScript, ["res"], [res]);
|
|
213
|
+
return extractDynamicSchemaItems(result);
|
|
214
|
+
}
|
|
215
|
+
return extractDynamicSchemaItems(res && res.objx);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export function normalizeDynamicFieldKey(item) {
|
|
219
|
+
if (!item || typeof item !== "object") return undefined;
|
|
220
|
+
return item.keyName;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export function normalizeDynamicColumnItem(item, index) {
|
|
224
|
+
if (!item || typeof item !== "object") {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const keyName = normalizeDynamicFieldKey(item);
|
|
229
|
+
const label = item.label;
|
|
230
|
+
let formatS = item.formatS || null;
|
|
231
|
+
if (!formatS && item.type) {
|
|
232
|
+
formatS = widgetTypeToEditFormatMap[item.type] || item.type;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
let editFormatS = null;
|
|
236
|
+
if (formatS && String(formatS).startsWith("edit")) {
|
|
237
|
+
editFormatS = formatS;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const widgetOptions = buildWidgetOptions(item, formatS, label);
|
|
241
|
+
|
|
242
|
+
let widget = null;
|
|
243
|
+
let widgetList = null;
|
|
244
|
+
if (
|
|
245
|
+
(item.type === "dropdown" || formatS === "dropdown") &&
|
|
246
|
+
Array.isArray(item.dropdownItems) &&
|
|
247
|
+
item.dropdownItems.length
|
|
248
|
+
) {
|
|
249
|
+
widget = buildDropdownWidgetFromDef(item, index);
|
|
250
|
+
if (widget && label) {
|
|
251
|
+
widget.options.label = label;
|
|
252
|
+
}
|
|
253
|
+
if (widget?.widgetList?.length) {
|
|
254
|
+
widgetList = widget.widgetList;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (!keyName && !isActionOrGroupColumn(item, formatS)) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const isAction = isActionColumn(item, formatS);
|
|
263
|
+
|
|
264
|
+
const widgetFlags = {};
|
|
265
|
+
DYNAMIC_SCHEMA_WIDGET_FLAG_KEYS.forEach((key) => {
|
|
266
|
+
if (item[key] !== undefined) {
|
|
267
|
+
widgetFlags[key] = item[key];
|
|
268
|
+
} else if (widgetOptions?.[key] !== undefined) {
|
|
269
|
+
widgetFlags[key] = widgetOptions[key];
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
const children = Array.isArray(item.children)
|
|
274
|
+
? item.children
|
|
275
|
+
.map((child, childIndex) =>
|
|
276
|
+
normalizeDynamicColumnItem(child, index * 1000 + childIndex)
|
|
277
|
+
)
|
|
278
|
+
.filter(Boolean)
|
|
279
|
+
: item.children;
|
|
280
|
+
|
|
281
|
+
return {
|
|
282
|
+
columnId: item.columnId || `${Date.now()}_${index}`,
|
|
283
|
+
type: item.type,
|
|
284
|
+
prop: keyName || undefined,
|
|
285
|
+
label,
|
|
286
|
+
width: item.width ?? 150,
|
|
287
|
+
show: item.show !== false,
|
|
288
|
+
sortable: isAction ? item.sortable === true : item.sortable !== false,
|
|
289
|
+
filterable: isAction ? item.filterable === true : item.filterable !== false,
|
|
290
|
+
...(item.align ? { align: item.align } : {}),
|
|
291
|
+
fixed: item.fixed,
|
|
292
|
+
formatS,
|
|
293
|
+
editFormatS: editFormatS || undefined,
|
|
294
|
+
optionItems: item.optionItems,
|
|
295
|
+
widget,
|
|
296
|
+
widgetList,
|
|
297
|
+
widgetOptions,
|
|
298
|
+
children: children,
|
|
299
|
+
render: item.render,
|
|
300
|
+
utcTransformEnabled: item.utcTransformEnabled,
|
|
301
|
+
...widgetFlags,
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export function normalizeDynamicColumns(columns) {
|
|
306
|
+
if (!Array.isArray(columns)) {
|
|
307
|
+
return [];
|
|
308
|
+
}
|
|
309
|
+
return columns
|
|
310
|
+
.map((item, index) => normalizeDynamicColumnItem(item, index))
|
|
311
|
+
.filter(Boolean);
|
|
312
|
+
}
|