cloud-web-corejs 1.0.54-dev.203 → 1.0.54-dev.205
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/excelExport/mixins.js +1 -1
- package/src/components/xform/form-designer/designer.js +0 -1
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +245 -1
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +9 -4
- package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/index.vue +4 -0
- package/src/components/xform/form-designer/setting-panel/indexMixin.js +2 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +23 -4
- package/src/components/xform/form-designer/setting-panel/property-editor/formula-editor.vue +214 -129
- package/src/components/xform/form-render/container-item/data-table-item.vue +7 -4
- package/src/components/xform/form-render/container-item/data-table-mixin.js +225 -34
- package/src/components/xform/form-render/container-item/data-table-mixin2.js +2169 -0
- package/src/components/xform/form-render/indexMixin.js +65 -16
- package/src/components/xform/utils/formula-util.js +33 -12
- package/src/components/xform/utils/util.js +197 -76
- package/src/views/bd/setting/form_script/edit1.vue +9 -2
@@ -1125,25 +1125,67 @@ modules = {
|
|
1125
1125
|
n && n.setDisabled && n.setHidden(t);
|
1126
1126
|
});
|
1127
1127
|
},
|
1128
|
-
findWidgetNameInSubForm
|
1129
|
-
let
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1128
|
+
findWidgetNameInSubForm(widgetName) {
|
1129
|
+
let result = []
|
1130
|
+
let subFormName = null
|
1131
|
+
Object.keys(this.subFormRefList).forEach(sfName => {
|
1132
|
+
const fwHandler = (fw) => {
|
1133
|
+
if (fw.options.name === widgetName) {
|
1134
|
+
subFormName = sfName
|
1135
|
+
}
|
1136
|
+
}
|
1137
|
+
|
1138
|
+
const sfRef = this.subFormRefList[sfName]
|
1139
|
+
traverseFieldWidgetsOfContainer(sfRef.widget, fwHandler, true)
|
1140
|
+
})
|
1141
|
+
|
1142
|
+
if (!!subFormName) {
|
1143
|
+
let subFormRef = this.getWidgetRef(subFormName)
|
1144
|
+
if (!!subFormRef) {
|
1145
|
+
if(subFormRef.widget.type == "data-table"){
|
1146
|
+
let rows = subFormRef.getValue();
|
1147
|
+
if(rows){
|
1148
|
+
rows.forEach(row => {
|
1149
|
+
result.push( widgetName + '_' + row._X_ROW_KEY)
|
1150
|
+
})
|
1151
|
+
}
|
1152
|
+
|
1153
|
+
}else{
|
1154
|
+
let rowIds = subFormRef.getRowIdData()
|
1155
|
+
if (!!rowIds && (rowIds.length > 0)) {
|
1156
|
+
rowIds.forEach(rid => {
|
1157
|
+
result.push( widgetName + '@row' + rid)
|
1158
|
+
})
|
1159
|
+
}
|
1160
|
+
}
|
1161
|
+
|
1143
1162
|
}
|
1144
1163
|
}
|
1145
|
-
|
1164
|
+
|
1165
|
+
return result
|
1166
|
+
},
|
1167
|
+
|
1168
|
+
findFieldWidgetById(fieldId, staticWidgetsIncluded) {
|
1169
|
+
return getFieldWidgetById(this.formJsonObj.widgetList, fieldId, staticWidgetsIncluded)
|
1146
1170
|
},
|
1171
|
+
|
1172
|
+
getSubFormNameOfWidget(widgetName) {
|
1173
|
+
let result = []
|
1174
|
+
let subFormName = null
|
1175
|
+
Object.keys(this.subFormRefList).forEach(sfName => {
|
1176
|
+
const fwHandler = (fw) => {
|
1177
|
+
if (fw.options.name === widgetName) {
|
1178
|
+
subFormName = sfName
|
1179
|
+
}
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
const sfRef = this.subFormRefList[sfName]
|
1183
|
+
traverseFieldWidgetsOfContainer(sfRef.widget, fwHandler)
|
1184
|
+
})
|
1185
|
+
|
1186
|
+
return subFormName
|
1187
|
+
},
|
1188
|
+
|
1147
1189
|
changeLanguage: function (e) {
|
1148
1190
|
baseRefUtil.changeLocale(e);
|
1149
1191
|
},
|
@@ -2005,6 +2047,13 @@ modules = {
|
|
2005
2047
|
|
2006
2048
|
return foundWidget;
|
2007
2049
|
},
|
2050
|
+
copyNewFieldWidget(origin) {
|
2051
|
+
let newWidget = deepClone(origin);
|
2052
|
+
newWidget.type = (newWidget.targetType || newWidget.type);
|
2053
|
+
let tempId = generateId();
|
2054
|
+
newWidget.id = newWidget.type.replace(/-/g, '') + tempId;
|
2055
|
+
return newWidget
|
2056
|
+
},
|
2008
2057
|
doScriptAccess(scriptUuid, callback) {
|
2009
2058
|
if (scriptUuid) {
|
2010
2059
|
let scripts = this.formJson.formConfig.scriptList || [];
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import {evalFn, getFieldWidgetById, traverseFieldWidgetsOfContainer} from "@base/components/xform/utils/util";
|
3
3
|
import * as formulajs from '@formulajs/formulajs'
|
4
4
|
import {EditorView} from "codemirror"
|
5
|
-
import {MatchDecorator,Decoration,ViewPlugin,WidgetType} from "@codemirror/view"
|
5
|
+
import {MatchDecorator, Decoration, ViewPlugin, WidgetType} from "@codemirror/view"
|
6
6
|
import {translate} from "@base/components/xform/utils/i18n";
|
7
7
|
|
8
8
|
class PlaceholderWidget extends WidgetType {
|
@@ -44,9 +44,9 @@ export const FORMULA_REG_EXP = /\{\{(\w+\.[^.]+\.\w+)}}/g
|
|
44
44
|
const placeholderMatcher = new MatchDecorator({
|
45
45
|
regexp: /\{\{(.+?)}}/g,
|
46
46
|
decoration: (match) =>
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
Decoration.replace({
|
48
|
+
widget: new PlaceholderWidget(match[1])
|
49
|
+
})
|
50
50
|
});
|
51
51
|
|
52
52
|
|
@@ -93,7 +93,8 @@ export const baseTheme = EditorView.baseTheme({
|
|
93
93
|
});
|
94
94
|
|
95
95
|
export function calculateFormula(VFR, DSV, formulaJs, formulaFieldRef, changedFieldRef) {
|
96
|
-
if (
|
96
|
+
if (formulaFieldRef.tableParam) {
|
97
|
+
} else if (!!formulaFieldRef.subFormItemFlag && !!changedFieldRef.subFormItemFlag) {
|
97
98
|
/* 子表单字段变化,只能触发子表单同一行字段的计算公式重新计算!! */
|
98
99
|
if (changedFieldRef.subFormRowId !== formulaFieldRef.subFormRowId) {
|
99
100
|
return
|
@@ -129,7 +130,7 @@ export function calculateFormula(VFR, DSV, formulaJs, formulaFieldRef, changedFi
|
|
129
130
|
* @param formula
|
130
131
|
* @param VFR
|
131
132
|
*/
|
132
|
-
export function fieldIsUsedInFormula(fieldName, formula, VFR) {
|
133
|
+
export function fieldIsUsedInFormula(fieldName, formula, VFR, fieldTarget) {
|
133
134
|
const matchResult = formula.match(FORMULA_REG_EXP)
|
134
135
|
if (!matchResult) {
|
135
136
|
return false
|
@@ -138,14 +139,14 @@ export function fieldIsUsedInFormula(fieldName, formula, VFR) {
|
|
138
139
|
let foundResult = false
|
139
140
|
matchResult.forEach(mi => {
|
140
141
|
const thirdPart = mi.split('.')[2]
|
141
|
-
const nodeType = thirdPart.substring(0, thirdPart.length -2)
|
142
|
+
const nodeType = thirdPart.substring(0, thirdPart.length - 2)
|
142
143
|
if (nodeType === 'func') {
|
143
144
|
return
|
144
145
|
}
|
145
146
|
|
146
147
|
const firstPart = mi.split('.')[0]
|
147
148
|
const fieldId = firstPart.substring(2, firstPart.length)
|
148
|
-
|
149
|
+
let fieldSchema = getFieldWidgetById(VFR.formJsonObj.widgetList, fieldId, false)
|
149
150
|
if (!fieldSchema) {
|
150
151
|
console.error('The field used by formula not found: ', fieldId)
|
151
152
|
console.error('The formula is: ', formula)
|
@@ -175,7 +176,7 @@ export function replaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef) {
|
|
175
176
|
let quitFlag = false
|
176
177
|
matchResult.forEach(mi => {
|
177
178
|
const thirdPart = mi.split('.')[2]
|
178
|
-
const nodeType = thirdPart.substring(0, thirdPart.length -2)
|
179
|
+
const nodeType = thirdPart.substring(0, thirdPart.length - 2)
|
179
180
|
if (nodeType === 'func') {
|
180
181
|
const funcName = mi.split('.')[1]
|
181
182
|
resultFormula = resultFormula.replace(mi, funcName)
|
@@ -192,9 +193,20 @@ export function replaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef) {
|
|
192
193
|
resultFormula = resultFormula.replace(mi, fieldRef.getValue())
|
193
194
|
} else { //getWidgetRef找不到,则可能是子表单字段
|
194
195
|
const subFormNameOfField = VFR.getSubFormNameOfWidget(fieldSchema.options.name)
|
195
|
-
if (!!formulaFieldRef.subFormItemFlag) {
|
196
|
+
if (!!formulaFieldRef.subFormItemFlag || formulaFieldRef.tableParam) {
|
196
197
|
/* 如果当前计算字段是子表单字段,要判断公式中的子表单字段是否和当前计算字段是否属于同一子表单!! */
|
197
|
-
|
198
|
+
|
199
|
+
|
200
|
+
if (subFormNameOfField === formulaFieldRef?.parentWidget?.options?.name) {
|
201
|
+
let subFormRowId = formulaFieldRef.tableParam.row._X_ROW_KEY
|
202
|
+
fieldRef = VFR.getWidgetRef(fieldSchema.options.name + '_' + subFormRowId)
|
203
|
+
if (!!fieldRef) {
|
204
|
+
resultFormula = resultFormula.replaceAll(mi, fieldRef.getValue())
|
205
|
+
} else {
|
206
|
+
quitFlag = true
|
207
|
+
console.error('Field not found: ' + fieldSchema.options.label)
|
208
|
+
}
|
209
|
+
} else if (subFormNameOfField === formulaFieldRef.subFormName) {
|
198
210
|
fieldRef = VFR.getWidgetRef(fieldSchema.options.name + '@row' + formulaFieldRef.subFormRowId)
|
199
211
|
if (!!fieldRef) {
|
200
212
|
resultFormula = resultFormula.replaceAll(mi, fieldRef.getValue())
|
@@ -206,10 +218,12 @@ export function replaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef) {
|
|
206
218
|
console.error('Invalid formula!')
|
207
219
|
}
|
208
220
|
} else {
|
221
|
+
debugger
|
209
222
|
/* 在主表单字段的计算公式中使用子表单字段,应将子表单所有记录同字段的值代入!! */
|
210
223
|
const subFormValue = VFR.formDataModel[subFormNameOfField]
|
211
224
|
let allSubFieldValues = ''
|
212
|
-
const subFieldName = fieldSchema.options.name
|
225
|
+
// const subFieldName = fieldSchema.options.name
|
226
|
+
const subFieldName = fieldKeyName(fieldSchema)
|
213
227
|
subFormValue.forEach((vi, idx) => {
|
214
228
|
allSubFieldValues = (idx === 0) ? vi[subFieldName] : allSubFieldValues + ', ' + vi[subFieldName]
|
215
229
|
})
|
@@ -222,6 +236,13 @@ export function replaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef) {
|
|
222
236
|
return quitFlag ? null : resultFormula
|
223
237
|
}
|
224
238
|
|
239
|
+
function fieldKeyName(widget) {
|
240
|
+
let o = widget.options.name;
|
241
|
+
return (
|
242
|
+
(widget.options.keyNameEnabled && widget.options.keyName) || o
|
243
|
+
);
|
244
|
+
}
|
245
|
+
|
225
246
|
/**
|
226
247
|
* 获取字段值
|
227
248
|
*/
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import Clipboard from "clipboard";
|
2
2
|
import axios from "axios";
|
3
3
|
import request from "../../../utils/request.js";
|
4
|
-
import {
|
4
|
+
import {decode} from "js-base64";
|
5
5
|
|
6
6
|
export function getAccessUrl() {
|
7
7
|
return SUPPORT_PREFIX + "/report_ins/getData";
|
@@ -176,7 +176,13 @@ export function traverseFieldWidgets(
|
|
176
176
|
return;
|
177
177
|
}
|
178
178
|
|
179
|
-
widgetList
|
179
|
+
loopHandleWidget(widgetList, (w, parent) => {
|
180
|
+
if (w.formItemFlag || ((w.formItemFlag === false) && staticWidgetsIncluded)) {
|
181
|
+
handler(w, parent)
|
182
|
+
}
|
183
|
+
});
|
184
|
+
|
185
|
+
/* widgetList.forEach((w) => {
|
180
186
|
if (w.formItemFlag || (w.formItemFlag === false && staticWidgetsIncluded)) {
|
181
187
|
handler(w, parent);
|
182
188
|
} else if (w.type === "grid") {
|
@@ -204,7 +210,7 @@ export function traverseFieldWidgets(
|
|
204
210
|
//自定义容器
|
205
211
|
traverseFieldWidgets(w.widgetList, handler, w, staticWidgetsIncluded);
|
206
212
|
}
|
207
|
-
});
|
213
|
+
}); */
|
208
214
|
}
|
209
215
|
|
210
216
|
export function traverseContainerWidgets(
|
@@ -216,7 +222,20 @@ export function traverseContainerWidgets(
|
|
216
222
|
return;
|
217
223
|
}
|
218
224
|
|
219
|
-
widgetList
|
225
|
+
loopHandleWidget(widgetList, (w, parent) => {
|
226
|
+
if (w.category === "container") {
|
227
|
+
if (
|
228
|
+
skipDialogAndDrawer &&
|
229
|
+
(w.type === "vf-dialog" || w.type === "vf-drawer")
|
230
|
+
) {
|
231
|
+
//什么也不做
|
232
|
+
} else {
|
233
|
+
handler(w);
|
234
|
+
}
|
235
|
+
}
|
236
|
+
});
|
237
|
+
|
238
|
+
/* widgetList.forEach((w) => {
|
220
239
|
if (w.category === "container") {
|
221
240
|
if (
|
222
241
|
skipDialogAndDrawer &&
|
@@ -255,7 +274,7 @@ export function traverseContainerWidgets(
|
|
255
274
|
traverseContainerWidgets(w.widgetList, handler);
|
256
275
|
}
|
257
276
|
}
|
258
|
-
});
|
277
|
+
}); */
|
259
278
|
}
|
260
279
|
|
261
280
|
export function traverseAllWidgets(widgetList, handler) {
|
@@ -263,7 +282,11 @@ export function traverseAllWidgets(widgetList, handler) {
|
|
263
282
|
return;
|
264
283
|
}
|
265
284
|
|
266
|
-
widgetList
|
285
|
+
loopHandleWidget(widgetList, (w, parent) => {
|
286
|
+
handler(w);
|
287
|
+
});
|
288
|
+
|
289
|
+
/* widgetList.forEach((w) => {
|
267
290
|
handler(w);
|
268
291
|
|
269
292
|
if (w.type === "grid") {
|
@@ -288,7 +311,7 @@ export function traverseAllWidgets(widgetList, handler) {
|
|
288
311
|
//自定义容器
|
289
312
|
traverseAllWidgets(w.widgetList, handler);
|
290
313
|
}
|
291
|
-
});
|
314
|
+
}); */
|
292
315
|
}
|
293
316
|
|
294
317
|
function handleWidgetForTraverse(
|
@@ -303,6 +326,24 @@ function handleWidgetForTraverse(
|
|
303
326
|
}
|
304
327
|
}
|
305
328
|
|
329
|
+
export const itemFieldMap = {
|
330
|
+
grid: "cols",
|
331
|
+
table: "rows",
|
332
|
+
"table-cell": "widgetList",
|
333
|
+
'h5-table': "rows",
|
334
|
+
"h5-table-cell": "widgetList",
|
335
|
+
tab: "tabs",
|
336
|
+
"tab-pane": "widgetList",
|
337
|
+
"grid-col": "widgetList",
|
338
|
+
"vf-box": "widgetList",
|
339
|
+
"card": "widgetList",
|
340
|
+
"detail": "panes",
|
341
|
+
"detail-pane": "widgetList",
|
342
|
+
"detail-h5": "panes",
|
343
|
+
"h5-card": "panes",
|
344
|
+
"h5-card-pane": "widgetList",
|
345
|
+
}
|
346
|
+
|
306
347
|
/**
|
307
348
|
* 遍历容器内的字段组件
|
308
349
|
* @param con
|
@@ -314,6 +355,10 @@ export function traverseFieldWidgetsOfContainer(
|
|
314
355
|
handler,
|
315
356
|
staticWidgetsIncluded = false
|
316
357
|
) {
|
358
|
+
|
359
|
+
/*loopHandleWidget([con],(w, parent)=>{
|
360
|
+
handleWidgetForTraverse(w, handler, staticWidgetsIncluded);
|
361
|
+
});*/
|
317
362
|
if (con.type === "grid") {
|
318
363
|
con.cols.forEach((col) => {
|
319
364
|
col.widgetList.forEach((cw) => {
|
@@ -338,11 +383,36 @@ export function traverseFieldWidgetsOfContainer(
|
|
338
383
|
con.widgetList.forEach((cw) => {
|
339
384
|
handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
|
340
385
|
});
|
386
|
+
} else if (con.type === "data-table") {
|
387
|
+
/*con.widgetList.forEach((cw) => {
|
388
|
+
handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
|
389
|
+
});*/
|
390
|
+
for (let column of con.options.tableColumns) {
|
391
|
+
if (column.widget) {
|
392
|
+
handleWidgetForTraverse(column.widget, handler, staticWidgetsIncluded);
|
393
|
+
}
|
394
|
+
if (column.widgetList) {
|
395
|
+
loopHandleWidget(column.widgetList, (cw) => {
|
396
|
+
handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
|
397
|
+
});
|
398
|
+
}
|
399
|
+
}
|
341
400
|
} else if (con.category === "container") {
|
342
401
|
//自定义容器
|
343
|
-
con.
|
402
|
+
/*let key = itemFieldMap[con.type]
|
403
|
+
con[key].forEach((cw) => {
|
344
404
|
handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
|
345
|
-
})
|
405
|
+
});*/
|
406
|
+
|
407
|
+
|
408
|
+
/*con.widgetList.forEach(cw => {
|
409
|
+
handleWidgetForTraverse(cw, handler, staticWidgetsIncluded)
|
410
|
+
})*/
|
411
|
+
loopHandleWidgetItem(con, null, (w) => {
|
412
|
+
if (con.id != w.id)
|
413
|
+
handleWidgetForTraverse(w, handler, staticWidgetsIncluded)
|
414
|
+
})
|
415
|
+
|
346
416
|
}
|
347
417
|
}
|
348
418
|
|
@@ -387,6 +457,18 @@ export function traverseWidgetsOfContainer(
|
|
387
457
|
containerHandler(con);
|
388
458
|
}
|
389
459
|
|
460
|
+
/*loopHandleWidget([con], (cw, parent) => {
|
461
|
+
if (con.id !== cw.id) {
|
462
|
+
handleContainerTraverse(
|
463
|
+
cw,
|
464
|
+
fieldHandler,
|
465
|
+
containerHandler,
|
466
|
+
internalContainerCallFlag,
|
467
|
+
staticWidgetsIncluded
|
468
|
+
);
|
469
|
+
}
|
470
|
+
});*/
|
471
|
+
|
390
472
|
if (con.type === "grid") {
|
391
473
|
con.cols.forEach((col) => {
|
392
474
|
if (internalContainerCallFlag) {
|
@@ -449,7 +531,8 @@ export function traverseWidgetsOfContainer(
|
|
449
531
|
});
|
450
532
|
} else if (con.category === "container") {
|
451
533
|
//自定义容器
|
452
|
-
con.
|
534
|
+
let key = itemFieldMap[con.type]
|
535
|
+
con[key].forEach((cw) => {
|
453
536
|
handleContainerTraverse(
|
454
537
|
cw,
|
455
538
|
fieldHandler,
|
@@ -545,6 +628,29 @@ export function getFieldWidgetByName(
|
|
545
628
|
return foundWidget;
|
546
629
|
}
|
547
630
|
|
631
|
+
export const columnFormatMap = {
|
632
|
+
editInput: "input",
|
633
|
+
editNumber: "number",
|
634
|
+
editDate: "date",
|
635
|
+
editSelect: "select",
|
636
|
+
editSearch: "vabsearch",
|
637
|
+
editAttachment: "baseAttachment",
|
638
|
+
editStatus: "status",
|
639
|
+
aText: "a-text",
|
640
|
+
aLink: "a-link",
|
641
|
+
editDelete: "a-link",
|
642
|
+
editButton: "a-link",
|
643
|
+
button: "button",
|
644
|
+
addSiblingEditRow: "a-link",
|
645
|
+
addChildTreeRow: "a-link",
|
646
|
+
moveUpRow: "a-link",
|
647
|
+
moveDownRow: "a-link",
|
648
|
+
removeTreeRow: "a-link",
|
649
|
+
text: "text",
|
650
|
+
checkbox: "checkbox",
|
651
|
+
radio: "radio",
|
652
|
+
};
|
653
|
+
|
548
654
|
export function getFieldWidgetById(widgetList, fieldId, staticWidgetsIncluded) {
|
549
655
|
if (!widgetList) {
|
550
656
|
return null;
|
@@ -554,6 +660,19 @@ export function getFieldWidgetById(widgetList, fieldId, staticWidgetsIncluded) {
|
|
554
660
|
let handlerFn = (widget) => {
|
555
661
|
if (widget.id === fieldId) {
|
556
662
|
foundWidget = widget;
|
663
|
+
} else if (widget.type == "data-table") {
|
664
|
+
for (let column of widget.options.tableColumns) {
|
665
|
+
if (column?.widget?.id + "" === fieldId) {
|
666
|
+
foundWidget = column.widget;
|
667
|
+
break
|
668
|
+
} else if (column.widgetList) {
|
669
|
+
loopHandleWidget(column.widgetList, (item1) => {
|
670
|
+
if (item1.id === fieldId) {
|
671
|
+
foundWidget = item1;
|
672
|
+
}
|
673
|
+
});
|
674
|
+
}
|
675
|
+
}
|
557
676
|
}
|
558
677
|
};
|
559
678
|
|
@@ -707,14 +826,14 @@ export function translateOptionItems(e, t, i, n) {
|
|
707
826
|
var o = [];
|
708
827
|
return (
|
709
828
|
e &&
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
829
|
+
e.length > 0 &&
|
830
|
+
e.forEach(function (e) {
|
831
|
+
o.push({
|
832
|
+
[i]: e[i],
|
833
|
+
[n]: e[n],
|
834
|
+
});
|
835
|
+
}),
|
836
|
+
o
|
718
837
|
);
|
719
838
|
}
|
720
839
|
|
@@ -730,8 +849,8 @@ export function assembleAxiosConfig(arrayObj, DSV, VFR) {
|
|
730
849
|
"false" === ai.value.toLowerCase() || "0" === ai.value
|
731
850
|
? (result[ai.name] = !1)
|
732
851
|
: "true" === ai.value.toLowerCase() || "1" === ai.value
|
733
|
-
|
734
|
-
|
852
|
+
? (result[ai.name] = !0)
|
853
|
+
: (result[ai.name] = null);
|
735
854
|
} else if ("Variable" === ai.type) {
|
736
855
|
result[ai.name] = eval(ai.value);
|
737
856
|
} else if ("FormData" === ai.type) {
|
@@ -901,11 +1020,11 @@ export function getDSByName(e, t) {
|
|
901
1020
|
var i = null;
|
902
1021
|
return (
|
903
1022
|
t &&
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
1023
|
+
e.dataSources &&
|
1024
|
+
e.dataSources.forEach(function (e) {
|
1025
|
+
e.uniqueName === t && (i = e);
|
1026
|
+
}),
|
1027
|
+
i
|
909
1028
|
);
|
910
1029
|
}
|
911
1030
|
|
@@ -929,9 +1048,9 @@ export function getSubFormNameByFieldId(o, e) {
|
|
929
1048
|
u.id === e && (n = s.name);
|
930
1049
|
};
|
931
1050
|
(s.type === "sub-form" || s.type === "grid-sub-form") &&
|
932
|
-
|
1051
|
+
traverseFieldWidgetsOfContainer(s.container, c);
|
933
1052
|
}),
|
934
|
-
|
1053
|
+
n
|
935
1054
|
);
|
936
1055
|
}
|
937
1056
|
|
@@ -948,9 +1067,9 @@ export function fieldIsUsedInFormula(o, e, n) {
|
|
948
1067
|
const g = c.split(".")[0],
|
949
1068
|
y = g.substring(2, g.length);
|
950
1069
|
getFieldWidgetById(n.formJsonObj.widgetList, y, !1).options.name === o &&
|
951
|
-
|
1070
|
+
(s = !0);
|
952
1071
|
}),
|
953
|
-
|
1072
|
+
s
|
954
1073
|
);
|
955
1074
|
}
|
956
1075
|
|
@@ -965,12 +1084,12 @@ export function calculateFormula(o, e, n, l, s) {
|
|
965
1084
|
c = replaceFieldsAndFunctionsOfFormula(o, l);
|
966
1085
|
const u = c.match(/[A-Za-z]*/g);
|
967
1086
|
u &&
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
1087
|
+
u.forEach((g) => {
|
1088
|
+
if (!!g && findCalFunStartIndex(g) !== -1) {
|
1089
|
+
const y = g.toUpperCase();
|
1090
|
+
c = c.replace(g, "formulaJs." + y);
|
1091
|
+
}
|
1092
|
+
}),
|
974
1093
|
console.log("formula: ", c),
|
975
1094
|
console.log("formulaFieldRef: ", l);
|
976
1095
|
const $ = evalFn(c, e, o, n);
|
@@ -1001,7 +1120,7 @@ export function replaceFieldsAndFunctionsOfFormula(o, e) {
|
|
1001
1120
|
if (e.subFormItemFlag)
|
1002
1121
|
w === e.subFormName
|
1003
1122
|
? ((v = o.getWidgetRef(f.options.name + "@row" + e.subFormRowId)),
|
1004
|
-
|
1123
|
+
v && (s = s.replaceAll(c, v.getValue())))
|
1005
1124
|
: console.error("Invalid formula!");
|
1006
1125
|
else {
|
1007
1126
|
const _ = o.formDataModel[w];
|
@@ -1015,7 +1134,7 @@ export function replaceFieldsAndFunctionsOfFormula(o, e) {
|
|
1015
1134
|
}
|
1016
1135
|
}
|
1017
1136
|
}),
|
1018
|
-
|
1137
|
+
s
|
1019
1138
|
);
|
1020
1139
|
}
|
1021
1140
|
|
@@ -1142,8 +1261,8 @@ export function trimEx(o, e, n) {
|
|
1142
1261
|
? n === "left"
|
1143
1262
|
? o.replace(new RegExp("^%%" + e + "+", "g"), "")
|
1144
1263
|
: n === "right"
|
1145
|
-
|
1146
|
-
|
1264
|
+
? o.replace(new RegExp("%%" + e + "+$", "g"), "")
|
1265
|
+
: o.replace(new RegExp("^%%" + e + "+|%%" + e + "+$", "g"), "")
|
1147
1266
|
: o.replace(/^%s+|%s+$/g, "");
|
1148
1267
|
}
|
1149
1268
|
|
@@ -1167,22 +1286,23 @@ export function objectKeysToArray(o) {
|
|
1167
1286
|
Object.keys(o).forEach((n) => {
|
1168
1287
|
e.push(n);
|
1169
1288
|
}),
|
1170
|
-
|
1289
|
+
e
|
1171
1290
|
);
|
1172
1291
|
}
|
1173
1292
|
|
1174
1293
|
//begin
|
1175
|
-
function loopHandleWidget(widgetList, callback) {
|
1294
|
+
export function loopHandleWidget(widgetList, callback) {
|
1176
1295
|
widgetList &&
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1296
|
+
widgetList.length > 0 &&
|
1297
|
+
widgetList.forEach(function (e) {
|
1298
|
+
loopHandleWidgetItem(e, null, callback);
|
1299
|
+
});
|
1181
1300
|
}
|
1301
|
+
|
1182
1302
|
function loopHandleWidgetItem(e, p, callback) {
|
1183
1303
|
if ("container" === e.category) {
|
1184
1304
|
callback(e, p);
|
1185
|
-
if ("vf-dialog" === e.type || "vf-drawer" === e.type);
|
1305
|
+
if ("vf-dialog" === e.type || "vf-drawer" === e.type) ;
|
1186
1306
|
else if ("data-table" === e.type) {
|
1187
1307
|
if (!!e.widgetList) {
|
1188
1308
|
e.widgetList.forEach((childItem) => {
|
@@ -1202,40 +1322,40 @@ function loopHandleWidgetItem(e, p, callback) {
|
|
1202
1322
|
}
|
1203
1323
|
} else if ("grid" === e.type) {
|
1204
1324
|
e.cols &&
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1325
|
+
e.cols.length > 0 &&
|
1326
|
+
e.cols.forEach(function (childItem) {
|
1327
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1328
|
+
});
|
1209
1329
|
} else if ("table" === e.type) {
|
1210
1330
|
e.rows &&
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
});
|
1331
|
+
e.rows.length > 0 &&
|
1332
|
+
e.rows.forEach(function (rowItem) {
|
1333
|
+
rowItem.cols &&
|
1334
|
+
rowItem.cols.length > 0 &&
|
1335
|
+
rowItem.cols.forEach(function (childItem) {
|
1336
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1218
1337
|
});
|
1338
|
+
});
|
1219
1339
|
} else if ("h5-table" === e.type) {
|
1220
1340
|
e.rows &&
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
});
|
1341
|
+
e.rows.length > 0 &&
|
1342
|
+
e.rows.forEach(function (rowItem) {
|
1343
|
+
rowItem.cols &&
|
1344
|
+
rowItem.cols.length > 0 &&
|
1345
|
+
rowItem.cols.forEach(function (childItem) {
|
1346
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1228
1347
|
});
|
1348
|
+
});
|
1229
1349
|
} else if ("tab" === e.type) {
|
1230
1350
|
e.tabs &&
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
});
|
1351
|
+
e.tabs.length > 0 &&
|
1352
|
+
e.tabs.forEach(function (tabItem) {
|
1353
|
+
tabItem.widgetList &&
|
1354
|
+
tabItem.widgetList.length > 0 &&
|
1355
|
+
tabItem.widgetList.forEach(function (childItem) {
|
1356
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1238
1357
|
});
|
1358
|
+
});
|
1239
1359
|
} else if ("detail" === e.type) {
|
1240
1360
|
if (e.panes) {
|
1241
1361
|
e.panes.forEach(function (childItem) {
|
@@ -1260,14 +1380,15 @@ function loopHandleWidgetItem(e, p, callback) {
|
|
1260
1380
|
}
|
1261
1381
|
} else {
|
1262
1382
|
"grid-col" === e.type || e.type,
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1383
|
+
e.widgetList &&
|
1384
|
+
e.widgetList.length > 0 &&
|
1385
|
+
e.widgetList.forEach(function (childItem) {
|
1386
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1387
|
+
});
|
1268
1388
|
}
|
1269
1389
|
} else {
|
1270
1390
|
callback && callback(e);
|
1271
1391
|
}
|
1272
1392
|
}
|
1393
|
+
|
1273
1394
|
//end
|