cloud-web-corejs 1.0.54-dev.688 → 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.
Files changed (24) hide show
  1. package/package.json +1 -1
  2. package/src/components/fileLibrary/index.vue +113 -33
  3. 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" +210 -305
  4. 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
  5. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +80 -14
  6. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +18 -13
  7. package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +11 -8
  8. package/src/components/xform/form-designer/form-widget/field-widget/script-input-widget.vue +143 -0
  9. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +87 -25
  10. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +5 -0
  11. package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +80 -34
  12. package/src/components/xform/form-designer/setting-panel/property-editor/field-script-input/script-input-editor.vue +54 -0
  13. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +1 -0
  14. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +56 -1
  15. package/src/components/xform/form-render/container-item/data-table-mixin.js +296 -118
  16. package/src/components/xform/form-render/container-item/dynamicFieldMixin.js +25 -37
  17. package/src/components/xform/form-render/container-item/list-h5-item.vue +5 -1
  18. package/src/components/xform/form-render/indexMixin.js +175 -6
  19. package/src/components/xform/lang/en-US.js +1 -0
  20. package/src/components/xform/lang/zh-CN.js +1 -0
  21. package/src/components/xform/utils/dynamicSchemaUtil.js +312 -0
  22. package/src/components/xform/utils/tableCellValidateUtil.js +148 -0
  23. package/src/components/xform/utils/tableColumnHelper.js +21 -1
  24. package/src/components/xform/utils/util.js +126 -0
@@ -1,4 +1,10 @@
1
1
  import { generateId } from "../../../../components/xform/utils/util";
2
+ import {
3
+ buildDynamicSchemaRequestData,
4
+ getDynamicSchemaOption,
5
+ normalizeDynamicFieldKey,
6
+ resolveDynamicSchemaResponse,
7
+ } from "../../utils/dynamicSchemaUtil";
2
8
 
3
9
  /**
4
10
  * 表格布局容器(table/h5-table)专用混入。
@@ -75,20 +81,21 @@ const dynamicFieldMixin = {
75
81
  if (
76
82
  this.designState
77
83
  || !options.dynamicSchemaEnabled
78
- || !options.dynamicSchemaScriptCode
84
+ || !getDynamicSchemaOption(options, "scriptCode")
79
85
  || !this.supportsRowLayout()
80
86
  ) {
81
87
  return Promise.resolve();
82
88
  }
83
- const extra = this.handleCustomEvent(options.dynamicSchemaScriptParam) || {};
89
+ const requestData = buildDynamicSchemaRequestData(
90
+ this.formModel,
91
+ getDynamicSchemaOption(options, "scriptParam"),
92
+ this.handleCustomEvent.bind(this)
93
+ );
84
94
  return new Promise((resolve) => {
85
95
  this.formHttp({
86
- scriptCode: options.dynamicSchemaScriptCode,
96
+ scriptCode: getDynamicSchemaOption(options, "scriptCode"),
87
97
  isLoading: false,
88
- data: {
89
- formData: this.formModel,
90
- ...extra,
91
- },
98
+ data: requestData,
92
99
  success: (res) => {
93
100
  const defs = this.resolveSchemaDefs(res);
94
101
  this.buildDynamicRows(defs);
@@ -101,30 +108,11 @@ const dynamicFieldMixin = {
101
108
  },
102
109
 
103
110
  resolveSchemaDefs(res) {
104
- const options = this.widget.options;
105
- let defs = [];
106
- if (options.dynamicSchemaConvert) {
107
- const result = this.handleCustomEvent(
108
- options.dynamicSchemaConvert,
109
- ["res"],
110
- [res]
111
- );
112
- if (Array.isArray(result)) {
113
- defs = result;
114
- } else if (result && Array.isArray(result.fields)) {
115
- defs = result.fields;
116
- }
117
- } else {
118
- const objx = res && res.objx;
119
- if (Array.isArray(objx)) {
120
- defs = objx;
121
- } else if (objx && Array.isArray(objx.fields)) {
122
- defs = objx.fields;
123
- } else if (objx && Array.isArray(objx.columns)) {
124
- defs = objx.columns;
125
- }
126
- }
127
- return defs || [];
111
+ return resolveDynamicSchemaResponse(
112
+ res,
113
+ getDynamicSchemaOption(this.widget.options, "convert"),
114
+ this.handleCustomEvent.bind(this)
115
+ );
128
116
  },
129
117
 
130
118
  buildDynamicRows(defs) {
@@ -269,13 +257,18 @@ const dynamicFieldMixin = {
269
257
  const type = def.type || "input";
270
258
  const template = formRef.getFieldWidgetByType(type);
271
259
  if (!template) return null;
272
- const key = def.keyName || def.field || def.name;
260
+ const key = normalizeDynamicFieldKey(def);
273
261
  if (!key) return null;
274
262
  const widget = formRef.copyNewFieldWidget(template);
275
263
  widget.options.name = key;
276
264
  widget.options.keyName = key;
277
265
  widget.options.keyNameEnabled = true;
278
266
  if (def.label !== undefined) widget.options.label = def.label;
267
+ if (def.options && typeof def.options === "object") {
268
+ Object.keys(def.options).forEach((k) => {
269
+ widget.options[k] = def.options[k];
270
+ });
271
+ }
279
272
  if (def.required !== undefined) widget.options.required = !!def.required;
280
273
  if (def.readonly !== undefined) widget.options.readonly = !!def.readonly;
281
274
  if (def.disabled !== undefined) widget.options.disabled = !!def.disabled;
@@ -289,11 +282,6 @@ const dynamicFieldMixin = {
289
282
  if (Array.isArray(def.optionItems) && "optionItems" in widget.options) {
290
283
  widget.options.optionItems = def.optionItems;
291
284
  }
292
- if (def.options && typeof def.options === "object") {
293
- Object.keys(def.options).forEach((k) => {
294
- widget.options[k] = def.options[k];
295
- });
296
- }
297
285
  if (def.tableField !== undefined) {
298
286
  widget.tableField = def.tableField;
299
287
  } else if (
@@ -746,6 +746,7 @@ import {
746
746
  assembleAxiosConfig,
747
747
  generateId,
748
748
  getReportGlobalMap,
749
+ isVabsearchMultiWidget,
749
750
  } from "../../../../components/xform/utils/util";
750
751
  import * as formatUtil from "../../../../components/xform/utils/format";
751
752
  import { extendDeeply } from "../../../../utils/index.js";
@@ -1601,7 +1602,10 @@ export default {
1601
1602
  obj.rowIndex +
1602
1603
  "." +
1603
1604
  obj.column.field;
1604
- if (this.isVabsearchFlagWidget(widget)) {
1605
+ if (
1606
+ this.isVabsearchFlagWidget(widget) &&
1607
+ !isVabsearchMultiWidget(widget)
1608
+ ) {
1605
1609
  let vabSearchName = obj.column.params.widget.options.vabSearchName;
1606
1610
  propName =
1607
1611
  this.getFieldKeyName(widget) +
@@ -23,6 +23,10 @@ import {
23
23
  traverseAllWidgetsNew,
24
24
  columnFormatMap,
25
25
  getColumnWidgetOptions,
26
+ applyColumnMetaToFieldWidget,
27
+ applyColumnMetaToColumnRow,
28
+ isArrayValueWidgetType,
29
+ isEmptyArrayFieldValue,
26
30
  } from "../../../components/xform/utils/util";
27
31
  import {
28
32
  containers,
@@ -583,6 +587,8 @@ modules = {
583
587
  if (!t.widget) {
584
588
  let fieldWidget = this.getColumnWidget(t, false);
585
589
  t.widget = fieldWidget;
590
+ } else {
591
+ applyColumnMetaToFieldWidget(t.widget, t, false);
586
592
  }
587
593
  if (t.widget) t.widget.columnType = t.formatS;
588
594
  }
@@ -591,6 +597,8 @@ modules = {
591
597
  if (!t.editWidget) {
592
598
  let fieldWidget = this.getColumnWidget(t, true);
593
599
  t.editWidget = fieldWidget;
600
+ } else {
601
+ applyColumnMetaToFieldWidget(t.editWidget, t, true);
594
602
  }
595
603
  if (t.editWidget) t.editWidget.columnType = t.editFormatS;
596
604
  }
@@ -653,6 +661,44 @@ modules = {
653
661
 
654
662
  this.wfModifyEnabled = hasModifyItem;
655
663
  },
664
+ hanldeCommonWidgetForTableColumns(tableColumns) {
665
+ if (!tableColumns || !tableColumns.length) return;
666
+ let wfParam = this.wfParam || {};
667
+ let wfInfo = wfParam?.wfInfo || {};
668
+ let taskDefinitionKey = wfInfo?.taskDefinitionKey || wfInfo?.nodeCode;
669
+ let toModify = wfInfo?.toModify || false;
670
+ let widgetEditOnWf = this.widgetEditOnWf;
671
+ if (widgetEditOnWf === undefined) {
672
+ widgetEditOnWf = this.hanldeWfWidgetNew0();
673
+ this.widgetEditOnWf = widgetEditOnWf;
674
+ }
675
+
676
+ const processWidget = (widget) => {
677
+ if (!widget) return;
678
+ this.handleWidgetShowRule(widget);
679
+ if (!wfParam.hasWf || widgetEditOnWf) return;
680
+ this.hanldeWfWidgetNew1(widget);
681
+ if (wfInfo.taskStep === "9999") {
682
+ this.hanldeWfWidgetItemNew(widget);
683
+ } else if (toModify && taskDefinitionKey) {
684
+ this.hanldeWfWidgetItemNew(widget);
685
+ }
686
+ };
687
+
688
+ const columnLoopDo = (column) => {
689
+ if (column.children && column.children.length) {
690
+ column.children.forEach(columnLoopDo);
691
+ return;
692
+ }
693
+ processWidget(column.widget);
694
+ processWidget(column.editWidget);
695
+ if (column.widgetList && column.widgetList.length) {
696
+ traverseAllWidgetsNew(column.widgetList, processWidget);
697
+ }
698
+ };
699
+
700
+ tableColumns.forEach(columnLoopDo);
701
+ },
656
702
  getIsSaveAtWfAgree() {
657
703
  //流程通过的时候是否可以执行保存
658
704
  let wfParam = this.wfParam || {};
@@ -1830,9 +1876,16 @@ modules = {
1830
1876
  });
1831
1877
  return (
1832
1878
  this.$refs["renderForm"].validate(function (t) {
1833
- t
1834
- ? i(e.formDataModel)
1835
- : i(e.formDataModel, e.i18nt("render.hint.validationFailed"));
1879
+ if (t) {
1880
+ const extraError = e.runExtraFormValidations();
1881
+ if (extraError) {
1882
+ i(e.formDataModel, extraError);
1883
+ return;
1884
+ }
1885
+ i(e.formDataModel);
1886
+ } else {
1887
+ i(e.formDataModel, e.i18nt("render.hint.validationFailed"));
1888
+ }
1836
1889
  }),
1837
1890
  n
1838
1891
  );
@@ -1945,8 +1998,22 @@ modules = {
1945
1998
  this.$refs.renderForm.clearValidate(e);
1946
1999
  },
1947
2000
  validateForm: function (e) {
1948
- this.$refs["renderForm"].$baseValidate(function (t) {
1949
- e(t);
2001
+ this.$refs["renderForm"].$baseValidate((valid) => {
2002
+ if (!valid) {
2003
+ e(valid);
2004
+ return;
2005
+ }
2006
+ const extraError = this.runExtraFormValidations();
2007
+ if (extraError) {
2008
+ this.$message({
2009
+ message: extraError,
2010
+ type: "error",
2011
+ duration: 2000,
2012
+ });
2013
+ e(false);
2014
+ return;
2015
+ }
2016
+ e(true);
1950
2017
  });
1951
2018
  },
1952
2019
  validateFields: function () {},
@@ -2180,6 +2247,87 @@ modules = {
2180
2247
  let o = widget.options.name;
2181
2248
  return (widget.options.keyNameEnabled && widget.options.keyName) || o;
2182
2249
  },
2250
+ validateDataTableDatasetRequired() {
2251
+ let error = null;
2252
+ const refList = this.widgetRefList || {};
2253
+ Object.keys(refList).forEach((name) => {
2254
+ if (error) {
2255
+ return;
2256
+ }
2257
+ const ref = refList[name];
2258
+ if (ref && typeof ref.validateDatasetRequired === "function") {
2259
+ error = ref.validateDatasetRequired();
2260
+ }
2261
+ });
2262
+ return error;
2263
+ },
2264
+ validateDataTableCellsRequired() {
2265
+ let error = null;
2266
+ const refList = this.widgetRefList || {};
2267
+ Object.keys(refList).forEach((name) => {
2268
+ if (error) {
2269
+ return;
2270
+ }
2271
+ const ref = refList[name];
2272
+ if (ref && typeof ref.validateCellsRequired === "function") {
2273
+ error = ref.validateCellsRequired();
2274
+ }
2275
+ });
2276
+ return error;
2277
+ },
2278
+ validateArrayValueFieldsRequired() {
2279
+ let error = null;
2280
+ const refList = this.widgetRefList || {};
2281
+ const renderForm = this.$refs.renderForm;
2282
+ Object.keys(refList).forEach((name) => {
2283
+ if (error) {
2284
+ return;
2285
+ }
2286
+ const ref = refList[name];
2287
+ if (!ref || ref.designState || !ref.field) {
2288
+ return;
2289
+ }
2290
+ const field = ref.field;
2291
+ if (
2292
+ !field.formItemFlag ||
2293
+ field.options.hidden ||
2294
+ !field.options.required
2295
+ ) {
2296
+ return;
2297
+ }
2298
+ if (!isArrayValueWidgetType(field.type, field.options)) {
2299
+ return;
2300
+ }
2301
+ const actualValue =
2302
+ typeof ref.getCurrentValue === "function"
2303
+ ? ref.getCurrentValue()
2304
+ : undefined;
2305
+ if (
2306
+ isEmptyArrayFieldValue(actualValue, field.type, field.options)
2307
+ ) {
2308
+ error = ref.getRequiredHintMsg
2309
+ ? ref.getRequiredHintMsg()
2310
+ : this.$t2("必填项不能为空", "system.message.required");
2311
+ const prop =
2312
+ typeof ref.getPropName === "function" ? ref.getPropName() : null;
2313
+ if (prop && renderForm) {
2314
+ renderForm.validateField(prop, () => {});
2315
+ }
2316
+ }
2317
+ });
2318
+ return error;
2319
+ },
2320
+ runExtraFormValidations() {
2321
+ const arrayError = this.validateArrayValueFieldsRequired();
2322
+ if (arrayError) {
2323
+ return arrayError;
2324
+ }
2325
+ const cellsError = this.validateDataTableCellsRequired();
2326
+ if (cellsError) {
2327
+ return cellsError;
2328
+ }
2329
+ return this.validateDataTableDatasetRequired();
2330
+ },
2183
2331
  isVabsearchFlagWidget(widget) {
2184
2332
  let type = widget?.type;
2185
2333
  return (
@@ -2757,6 +2905,7 @@ modules = {
2757
2905
  if (!type) return null;
2758
2906
  if (isEdit) {
2759
2907
  if (row.editWidget) {
2908
+ applyColumnMetaToFieldWidget(row.editWidget, row, true);
2760
2909
  return row.editWidget;
2761
2910
  }
2762
2911
  const editWidgetOptions = getColumnWidgetOptions(row, true);
@@ -2765,10 +2914,12 @@ modules = {
2765
2914
  this.getFieldWidgetByType(type)
2766
2915
  );
2767
2916
  fieldWidget.options = editWidgetOptions;
2917
+ applyColumnMetaToFieldWidget(fieldWidget, row, true);
2768
2918
  return fieldWidget;
2769
2919
  }
2770
2920
  } else {
2771
2921
  if (row.widget) {
2922
+ applyColumnMetaToFieldWidget(row.widget, row, false);
2772
2923
  return row.widget;
2773
2924
  }
2774
2925
  const widgetOptions = getColumnWidgetOptions(row);
@@ -2777,6 +2928,7 @@ modules = {
2777
2928
  this.getFieldWidgetByType(type)
2778
2929
  );
2779
2930
  fieldWidget.options = widgetOptions;
2931
+ applyColumnMetaToFieldWidget(fieldWidget, row, false);
2780
2932
  return fieldWidget;
2781
2933
  }
2782
2934
  }
@@ -2794,7 +2946,12 @@ modules = {
2794
2946
  );
2795
2947
 
2796
2948
  if (columnSelectedWidget.options.hasOwnProperty("required")) {
2797
- columnSelectedWidget.options.required = row.required || false;
2949
+ const widgetOptions = isEdit
2950
+ ? getColumnWidgetOptions(row, true)
2951
+ : getColumnWidgetOptions(row);
2952
+ columnSelectedWidget.options.required = !!(
2953
+ row.required || widgetOptions?.required
2954
+ );
2798
2955
  }
2799
2956
 
2800
2957
  if ("editDelete" === formatS) {
@@ -2885,6 +3042,18 @@ modules = {
2885
3042
  validate(callback) {
2886
3043
  this.$refs["renderForm"].$baseValidate(
2887
3044
  (valid, obj) => {
3045
+ if (valid) {
3046
+ const extraError = this.runExtraFormValidations();
3047
+ if (extraError) {
3048
+ this.$message({
3049
+ message: extraError,
3050
+ type: "error",
3051
+ duration: 2000,
3052
+ });
3053
+ callback && callback(false);
3054
+ return;
3055
+ }
3056
+ }
2888
3057
  if (!valid) {
2889
3058
  let message = null;
2890
3059
  let keys = Object.keys(obj);
@@ -34,6 +34,7 @@ export default {
34
34
  "vf-drawer": "Drawer",
35
35
  input: "Input",
36
36
  textarea: "Textarea",
37
+ "script-input": "Script Input",
37
38
  number: "InputNumber",
38
39
  radio: "Radio",
39
40
  checkbox: "Checkbox",
@@ -39,6 +39,7 @@ export default {
39
39
  input: "单行输入",
40
40
  "input-batch": "批量输入",
41
41
  textarea: "多行输入",
42
+ "script-input": "脚本输入框",
42
43
  number: "计数器",
43
44
  radio: "单选项",
44
45
  checkbox: "多选项",