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.
Files changed (32) hide show
  1. package/package.json +1 -1
  2. package/src/components/fileLibrary/index.vue +113 -33
  3. package/src/components/table/CellSlot.vue +12 -10
  4. 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
  5. 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
  6. package/src/components/xform/form-designer/designer.js +1 -1
  7. package/src/components/xform/form-designer/form-widget/field-widget/cascader-widget.vue +157 -105
  8. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +98 -18
  9. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +18 -13
  10. package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +11 -8
  11. package/src/components/xform/form-designer/form-widget/field-widget/script-input-widget.vue +143 -0
  12. package/src/components/xform/form-designer/indexMixin.js +837 -13
  13. package/src/components/xform/form-designer/setting-panel/option-items-setting.vue +69 -21
  14. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +87 -25
  15. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +5 -0
  16. package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +80 -34
  17. package/src/components/xform/form-designer/setting-panel/property-editor/field-cascader/checkStrictly-editor.vue +11 -13
  18. package/src/components/xform/form-designer/setting-panel/property-editor/field-cascader/showAllLevels-editor.vue +21 -0
  19. package/src/components/xform/form-designer/setting-panel/property-editor/field-script-input/script-input-editor.vue +54 -0
  20. package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +15 -4
  21. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +2 -0
  22. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +117 -2
  23. package/src/components/xform/form-render/container-item/data-table-mixin.js +296 -118
  24. package/src/components/xform/form-render/container-item/dynamicFieldMixin.js +50 -36
  25. package/src/components/xform/form-render/container-item/list-h5-item.vue +5 -1
  26. package/src/components/xform/form-render/indexMixin.js +197 -12
  27. package/src/components/xform/lang/en-US.js +1 -0
  28. package/src/components/xform/lang/zh-CN.js +86 -99
  29. package/src/components/xform/utils/dynamicSchemaUtil.js +312 -0
  30. package/src/components/xform/utils/tableCellValidateUtil.js +148 -0
  31. package/src/components/xform/utils/tableColumnHelper.js +21 -1
  32. 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) {
@@ -180,6 +168,21 @@ const dynamicFieldMixin = {
180
168
  this.widget.rows.push(...rows);
181
169
  }
182
170
  this._generatedRowIds = rows.map((r) => r.id);
171
+ this.afterDynamicSchemaBuilt(widgets, formRef);
172
+ },
173
+
174
+ afterDynamicSchemaBuilt(widgets, formRef) {
175
+ if (!formRef || !widgets || !widgets.length) return;
176
+ widgets.forEach(({ widget }) => {
177
+ if (widget && widget.formItemFlag && formRef.buildDataFromWidget) {
178
+ formRef.buildDataFromWidget(widget);
179
+ }
180
+ });
181
+ this.$nextTick(() => {
182
+ if (formRef.hanldeCommonWidget2) {
183
+ formRef.hanldeCommonWidget2();
184
+ }
185
+ });
183
186
  },
184
187
 
185
188
  layoutByColumns(widgets, colCount) {
@@ -254,13 +257,18 @@ const dynamicFieldMixin = {
254
257
  const type = def.type || "input";
255
258
  const template = formRef.getFieldWidgetByType(type);
256
259
  if (!template) return null;
257
- const key = def.keyName || def.field || def.name;
260
+ const key = normalizeDynamicFieldKey(def);
258
261
  if (!key) return null;
259
262
  const widget = formRef.copyNewFieldWidget(template);
260
263
  widget.options.name = key;
261
264
  widget.options.keyName = key;
262
265
  widget.options.keyNameEnabled = true;
263
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
+ }
264
272
  if (def.required !== undefined) widget.options.required = !!def.required;
265
273
  if (def.readonly !== undefined) widget.options.readonly = !!def.readonly;
266
274
  if (def.disabled !== undefined) widget.options.disabled = !!def.disabled;
@@ -274,10 +282,16 @@ const dynamicFieldMixin = {
274
282
  if (Array.isArray(def.optionItems) && "optionItems" in widget.options) {
275
283
  widget.options.optionItems = def.optionItems;
276
284
  }
277
- if (def.options && typeof def.options === "object") {
278
- Object.keys(def.options).forEach((k) => {
279
- widget.options[k] = def.options[k];
280
- });
285
+ if (def.tableField !== undefined) {
286
+ widget.tableField = def.tableField;
287
+ } else if (
288
+ widget.hasOwnProperty("tableField") &&
289
+ !widget.tableField
290
+ ) {
291
+ widget.tableField = widget.id;
292
+ }
293
+ if (def.submitFlag !== undefined) {
294
+ widget.options.submitFlag = !!def.submitFlag;
281
295
  }
282
296
  return widget;
283
297
  },
@@ -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,
@@ -170,6 +174,12 @@ modules = {
170
174
  getObjectName: () => "",
171
175
  getHasWf: () => this.hasWf,
172
176
  hasConfig: this.hasConfig,
177
+ setCETriggerFlag: () => {
178
+ this.changeEventTriggerFlag = true;
179
+ },
180
+ clearCETriggerFlag: () => {
181
+ this.changeEventTriggerFlag = false;
182
+ },
173
183
  };
174
184
  },
175
185
  data() {
@@ -224,6 +234,7 @@ modules = {
224
234
  // 表格设计器-打开表格设计器弹窗
225
235
  univerDialogOption: null,
226
236
  showUniverDialog: false,
237
+ changeEventTriggerFlag: false, //记录onChange事件是否由用户操作触发
227
238
  };
228
239
  },
229
240
  computed: {
@@ -576,6 +587,8 @@ modules = {
576
587
  if (!t.widget) {
577
588
  let fieldWidget = this.getColumnWidget(t, false);
578
589
  t.widget = fieldWidget;
590
+ } else {
591
+ applyColumnMetaToFieldWidget(t.widget, t, false);
579
592
  }
580
593
  if (t.widget) t.widget.columnType = t.formatS;
581
594
  }
@@ -584,6 +597,8 @@ modules = {
584
597
  if (!t.editWidget) {
585
598
  let fieldWidget = this.getColumnWidget(t, true);
586
599
  t.editWidget = fieldWidget;
600
+ } else {
601
+ applyColumnMetaToFieldWidget(t.editWidget, t, true);
587
602
  }
588
603
  if (t.editWidget) t.editWidget.columnType = t.editFormatS;
589
604
  }
@@ -646,6 +661,44 @@ modules = {
646
661
 
647
662
  this.wfModifyEnabled = hasModifyItem;
648
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
+ },
649
702
  getIsSaveAtWfAgree() {
650
703
  //流程通过的时候是否可以执行保存
651
704
  let wfParam = this.wfParam || {};
@@ -737,7 +790,11 @@ modules = {
737
790
  let result =
738
791
  freeWidgetTypesOfWf.includes(widgetType) ||
739
792
  (sourceType && freeWidgetTypesOfWf.includes(sourceType));
740
- return widget.options.label === "重置" || result;
793
+ return (
794
+ widget.options.label === "重置" ||
795
+ widget.options.label === "刷新" ||
796
+ result
797
+ );
741
798
  },
742
799
  getIsHiddenWidgetTypesOfWf(widget) {
743
800
  if (!widget) return false;
@@ -1574,11 +1631,7 @@ modules = {
1574
1631
  let areaName = e.options.areaName;
1575
1632
  if (areaName) {
1576
1633
  let val = currentFormData[areaName] ?? null;
1577
- this.$set(
1578
- this.formDataModel,
1579
- areaName,
1580
- baseRefUtil.deepClone(val)
1581
- );
1634
+ this.$set(this.formDataModel, areaName, baseRefUtil.deepClone(val));
1582
1635
  }
1583
1636
  } else if ("table2-item" === e.type) {
1584
1637
  this.$set(this.formDataModel, fieldKeyName, []);
@@ -1823,9 +1876,16 @@ modules = {
1823
1876
  });
1824
1877
  return (
1825
1878
  this.$refs["renderForm"].validate(function (t) {
1826
- t
1827
- ? i(e.formDataModel)
1828
- : 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
+ }
1829
1889
  }),
1830
1890
  n
1831
1891
  );
@@ -1938,8 +1998,22 @@ modules = {
1938
1998
  this.$refs.renderForm.clearValidate(e);
1939
1999
  },
1940
2000
  validateForm: function (e) {
1941
- this.$refs["renderForm"].$baseValidate(function (t) {
1942
- 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);
1943
2017
  });
1944
2018
  },
1945
2019
  validateFields: function () {},
@@ -2173,6 +2247,87 @@ modules = {
2173
2247
  let o = widget.options.name;
2174
2248
  return (widget.options.keyNameEnabled && widget.options.keyName) || o;
2175
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
+ },
2176
2331
  isVabsearchFlagWidget(widget) {
2177
2332
  let type = widget?.type;
2178
2333
  return (
@@ -2738,6 +2893,9 @@ modules = {
2738
2893
  newWidget.type = newWidget.targetType || newWidget.type;
2739
2894
  let tempId = generateId();
2740
2895
  newWidget.id = newWidget.type.replace(/-/g, "") + tempId;
2896
+ if (newWidget.hasOwnProperty("tableField")) {
2897
+ newWidget.tableField = newWidget.id;
2898
+ }
2741
2899
  return newWidget;
2742
2900
  },
2743
2901
  getColumnWidget(row, isEdit) {
@@ -2747,6 +2905,7 @@ modules = {
2747
2905
  if (!type) return null;
2748
2906
  if (isEdit) {
2749
2907
  if (row.editWidget) {
2908
+ applyColumnMetaToFieldWidget(row.editWidget, row, true);
2750
2909
  return row.editWidget;
2751
2910
  }
2752
2911
  const editWidgetOptions = getColumnWidgetOptions(row, true);
@@ -2755,10 +2914,12 @@ modules = {
2755
2914
  this.getFieldWidgetByType(type)
2756
2915
  );
2757
2916
  fieldWidget.options = editWidgetOptions;
2917
+ applyColumnMetaToFieldWidget(fieldWidget, row, true);
2758
2918
  return fieldWidget;
2759
2919
  }
2760
2920
  } else {
2761
2921
  if (row.widget) {
2922
+ applyColumnMetaToFieldWidget(row.widget, row, false);
2762
2923
  return row.widget;
2763
2924
  }
2764
2925
  const widgetOptions = getColumnWidgetOptions(row);
@@ -2767,6 +2928,7 @@ modules = {
2767
2928
  this.getFieldWidgetByType(type)
2768
2929
  );
2769
2930
  fieldWidget.options = widgetOptions;
2931
+ applyColumnMetaToFieldWidget(fieldWidget, row, false);
2770
2932
  return fieldWidget;
2771
2933
  }
2772
2934
  }
@@ -2784,7 +2946,12 @@ modules = {
2784
2946
  );
2785
2947
 
2786
2948
  if (columnSelectedWidget.options.hasOwnProperty("required")) {
2787
- 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
+ );
2788
2955
  }
2789
2956
 
2790
2957
  if ("editDelete" === formatS) {
@@ -2875,6 +3042,18 @@ modules = {
2875
3042
  validate(callback) {
2876
3043
  this.$refs["renderForm"].$baseValidate(
2877
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
+ }
2878
3057
  if (!valid) {
2879
3058
  let message = null;
2880
3059
  let keys = Object.keys(obj);
@@ -3784,6 +3963,12 @@ modules = {
3784
3963
  openLuckysheetDialog(option) {
3785
3964
  openLuckysheetDialog(option);
3786
3965
  },
3966
+ /**
3967
+ * 获取onChange事件是否由用户操作触发标志
3968
+ */
3969
+ getCETriggerFlag() {
3970
+ return this.changeEventTriggerFlag;
3971
+ },
3787
3972
  },
3788
3973
  };
3789
3974
 
@@ -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",