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
@@ -0,0 +1,148 @@
1
+ import {
2
+ isEmptyStr,
3
+ isEmptyArrayFieldValue,
4
+ isArrayValueWidgetType,
5
+ isVabsearchWidgetType,
6
+ isVabsearchMultiWidget,
7
+ } from "./util";
8
+ import { resolveColumnRequiredFlag } from "./tableColumnHelper";
9
+
10
+ /** 数据表格行内字段候选 key(column.prop 为权威存储字段) */
11
+ export function getCellFieldKeys(fieldWidget, columnConfig) {
12
+ const keys = [];
13
+ const addKey = (key) => {
14
+ if (key && !keys.includes(key)) {
15
+ keys.push(key);
16
+ }
17
+ };
18
+
19
+ addKey(columnConfig?.prop);
20
+
21
+ if (!fieldWidget) {
22
+ return keys;
23
+ }
24
+
25
+ const options = fieldWidget.options || {};
26
+ if (
27
+ isVabsearchWidgetType(fieldWidget.type) &&
28
+ !isVabsearchMultiWidget(fieldWidget)
29
+ ) {
30
+ addKey(options.vabSearchName);
31
+ addKey(getWidgetFieldKey(fieldWidget));
32
+ } else {
33
+ addKey(getWidgetFieldKey(fieldWidget));
34
+ }
35
+
36
+ return keys;
37
+ }
38
+
39
+ export function getCellFieldKey(fieldWidget, columnConfig) {
40
+ const keys = getCellFieldKeys(fieldWidget, columnConfig);
41
+ return keys.length ? keys[0] : null;
42
+ }
43
+
44
+ export function getWidgetFieldKey(widget) {
45
+ if (!widget?.options) {
46
+ return null;
47
+ }
48
+ const o = widget.options.name;
49
+ return (widget.options.keyNameEnabled && widget.options.keyName) || o;
50
+ }
51
+
52
+ export function isCellFieldRequired(columnConfig, fieldWidget) {
53
+ if (!fieldWidget || fieldWidget.options?.hidden) {
54
+ return false;
55
+ }
56
+ if (fieldWidget.options?.required) {
57
+ return true;
58
+ }
59
+ return resolveColumnRequiredFlag(columnConfig);
60
+ }
61
+
62
+ export function shouldSkipCellValidation(fieldWidget) {
63
+ if (!fieldWidget) {
64
+ return true;
65
+ }
66
+ if (fieldWidget.options?.hidden) {
67
+ return true;
68
+ }
69
+ if (fieldWidget.options?.disabled) {
70
+ return true;
71
+ }
72
+ return false;
73
+ }
74
+
75
+ export function isEmptyCellValue(fieldWidget, value) {
76
+ if (!fieldWidget) {
77
+ return false;
78
+ }
79
+ const type = fieldWidget.type;
80
+ const options = fieldWidget.options || {};
81
+
82
+ if (type === "number") {
83
+ return value === null || value === undefined || value === "";
84
+ }
85
+
86
+ if (isArrayValueWidgetType(type, options)) {
87
+ return isEmptyArrayFieldValue(value, type, options);
88
+ }
89
+
90
+ if (type === "select" || type === "radio" || type === "status") {
91
+ if (value === null || value === undefined || value === "") {
92
+ return true;
93
+ }
94
+ if (typeof value === "string" && !/[^\s]/.test(value)) {
95
+ return true;
96
+ }
97
+ return false;
98
+ }
99
+
100
+ return isEmptyStr(value);
101
+ }
102
+
103
+ /** 从行数据中读取单元格值(兼容 column.prop 与 widget 字段名不一致) */
104
+ export function getCellValueFromRow(row, fieldWidget, columnConfig) {
105
+ if (!row) {
106
+ return undefined;
107
+ }
108
+ const keys = getCellFieldKeys(fieldWidget, columnConfig);
109
+ if (!keys.length) {
110
+ return undefined;
111
+ }
112
+ let fallbackValue;
113
+ for (const key of keys) {
114
+ const value = row[key];
115
+ if (fallbackValue === undefined) {
116
+ fallbackValue = value;
117
+ }
118
+ if (!isEmptyCellValue(fieldWidget, value)) {
119
+ return value;
120
+ }
121
+ }
122
+ return fallbackValue;
123
+ }
124
+
125
+ export function isEmptyCellValueInRow(row, fieldWidget, columnConfig) {
126
+ return isEmptyCellValue(
127
+ fieldWidget,
128
+ getCellValueFromRow(row, fieldWidget, columnConfig)
129
+ );
130
+ }
131
+
132
+ export function buildCellRequiredHint(fieldWidget, columnConfig, t1Fn) {
133
+ const options = fieldWidget?.options || {};
134
+ if (options.requiredHint) {
135
+ return t1Fn(options.requiredHint);
136
+ }
137
+ const label = t1Fn(
138
+ options.label || columnConfig?.label || columnConfig?.prop || ""
139
+ );
140
+ return t1Fn("[{label}]不能为空", { label });
141
+ }
142
+
143
+ export function buildTableCellFormProp(tableFieldKeyName, rowIndex, fieldKey) {
144
+ if (!tableFieldKeyName || !fieldKey || rowIndex < 0) {
145
+ return null;
146
+ }
147
+ return `${tableFieldKeyName}.${rowIndex}.${fieldKey}`;
148
+ }
@@ -43,6 +43,26 @@ function enrichColumnList(columns, configMap) {
43
43
  /**
44
44
  * Apply data-table column header icon config to vxe-table column definition.
45
45
  */
46
+ export function resolveColumnRequiredFlag(columnConfig) {
47
+ if (!columnConfig) {
48
+ return false;
49
+ }
50
+ if (columnConfig.required) {
51
+ return true;
52
+ }
53
+ if (columnConfig.editWidget?.options?.required) {
54
+ return true;
55
+ }
56
+ if (columnConfig.widget?.options?.required) {
57
+ return true;
58
+ }
59
+ const widgetOptions =
60
+ columnConfig.widgetOptions ?? columnConfig.columnOption;
61
+ const editWidgetOptions =
62
+ columnConfig.editWidgetOptions ?? columnConfig.editColumnOption;
63
+ return !!(widgetOptions?.required || editWidgetOptions?.required);
64
+ }
65
+
46
66
  export function applyColumnLabelIcon(col, columnConfig) {
47
67
  if (!col || !columnConfig) {
48
68
  return col;
@@ -51,7 +71,7 @@ export function applyColumnLabelIcon(col, columnConfig) {
51
71
  const iconClass = columnConfig.labelIconClass;
52
72
  const position = columnConfig.labelIconPosition || "rear";
53
73
  const tooltip = columnConfig.labelTooltip;
54
- const required = !!columnConfig.required;
74
+ const required = resolveColumnRequiredFlag(columnConfig);
55
75
  const title = col.title;
56
76
 
57
77
  if (!iconClass && !required) {
@@ -19,6 +19,92 @@ export function isNotNull(value) {
19
19
  return value !== null && value !== undefined;
20
20
  }
21
21
 
22
+ const ATTACHMENT_WIDGET_TYPES = ["vabUpload", "baseAttachment", "vabUpload2"];
23
+
24
+ const PROJECT_TAG_WIDGET_TYPES = [
25
+ "project-tag",
26
+ "user-project-tag",
27
+ "saleOrg-project-tag",
28
+ ];
29
+
30
+ const VABSEARCH_WIDGET_TYPES = ["vabsearch", "singerSearch", "multiSearch"];
31
+
32
+ export function isAttachmentWidgetType(type) {
33
+ return ATTACHMENT_WIDGET_TYPES.includes(type);
34
+ }
35
+
36
+ export function isVabsearchWidgetType(type) {
37
+ return VABSEARCH_WIDGET_TYPES.includes(type);
38
+ }
39
+
40
+ export function isVabsearchMultiWidget(widget) {
41
+ if (!widget) {
42
+ return false;
43
+ }
44
+ const type = widget.type;
45
+ if (type === "multiSearch") {
46
+ return true;
47
+ }
48
+ if (!isVabsearchWidgetType(type)) {
49
+ return false;
50
+ }
51
+ const options = widget.options || {};
52
+ return !!(
53
+ options.multipleChoices || options.searchDialogConfig?.multipleChoices
54
+ );
55
+ }
56
+
57
+ /** 绑定值为数组的字段组件(含附件) */
58
+ export function isArrayValueWidgetType(type, options = {}) {
59
+ if (isAttachmentWidgetType(type)) {
60
+ return true;
61
+ }
62
+ if (type === "checkbox") {
63
+ return true;
64
+ }
65
+ if (type === "select" && options.multiple) {
66
+ return true;
67
+ }
68
+ if (type === "time-range" || type === "date-range") {
69
+ return true;
70
+ }
71
+ if (type === "date" && options.type === "dates") {
72
+ return true;
73
+ }
74
+ if (PROJECT_TAG_WIDGET_TYPES.includes(type)) {
75
+ return true;
76
+ }
77
+ if (type === "multiSearch") {
78
+ return true;
79
+ }
80
+ if (
81
+ type === "vabsearch" &&
82
+ (options.multipleChoices || options.searchDialogConfig?.multipleChoices)
83
+ ) {
84
+ return true;
85
+ }
86
+ return false;
87
+ }
88
+
89
+ /** 数组类字段值是否为空(用于必填校验) */
90
+ export function isEmptyArrayFieldValue(value, type, options = {}) {
91
+ if (value === null || value === undefined) {
92
+ return true;
93
+ }
94
+ if (type === "time-range" || type === "date-range") {
95
+ if (!Array.isArray(value) || value.length === 0) {
96
+ return true;
97
+ }
98
+ return value.every(
99
+ (item) => item === null || item === undefined || item === ""
100
+ );
101
+ }
102
+ if (!Array.isArray(value)) {
103
+ return true;
104
+ }
105
+ return value.length === 0;
106
+ }
107
+
22
108
  export function isEmptyStr(str) {
23
109
  //return (str === undefined) || (!str) || (!/[^\s]/.test(str));
24
110
  return (
@@ -700,6 +786,7 @@ export const columnFormatMap = {
700
786
  radio: "radio",
701
787
  dropdown: "dropdown",
702
788
  textarea: "textarea",
789
+ editScriptInput: "script-input",
703
790
  };
704
791
 
705
792
  /** 列 widget 扩展选项:动态列 widgetOptions;设计器静态列 columnOption */
@@ -713,6 +800,45 @@ export function getColumnWidgetOptions(row, isEdit = false) {
713
800
  return row.widgetOptions ?? row.columnOption;
714
801
  }
715
802
 
803
+ /** 将列级 label / keyName / required 同步到列内 field widget(动态列 label 在列顶层) */
804
+ export function applyColumnMetaToFieldWidget(fieldWidget, row, isEdit = false) {
805
+ if (!fieldWidget || !row) {
806
+ return fieldWidget;
807
+ }
808
+ const widgetOptions = getColumnWidgetOptions(row, isEdit);
809
+ if (fieldWidget.options.hasOwnProperty("required")) {
810
+ fieldWidget.options.required = !!(row.required || widgetOptions?.required);
811
+ }
812
+ if (!fieldWidget.options.label && row.label) {
813
+ fieldWidget.options.label = row.label;
814
+ }
815
+ if (row.prop) {
816
+ if (fieldWidget.options.hasOwnProperty("keyName")) {
817
+ fieldWidget.options.keyName = row.prop;
818
+ fieldWidget.options.keyNameEnabled = true;
819
+ } else if (!fieldWidget.options.name) {
820
+ fieldWidget.options.name = row.prop;
821
+ }
822
+ }
823
+ if (fieldWidget.type !== "button" && fieldWidget.type !== "a-link") {
824
+ fieldWidget.options.labelHidden = true;
825
+ }
826
+ return fieldWidget;
827
+ }
828
+
829
+ /** 同步列 widget / editWidget 的列级元数据(含 labelHidden) */
830
+ export function applyColumnMetaToColumnRow(row) {
831
+ if (!row) {
832
+ return;
833
+ }
834
+ if (row.widget) {
835
+ applyColumnMetaToFieldWidget(row.widget, row, false);
836
+ }
837
+ if (row.editWidget) {
838
+ applyColumnMetaToFieldWidget(row.editWidget, row, true);
839
+ }
840
+ }
841
+
716
842
  export function getFieldWidgetById(widgetList, fieldId, staticWidgetsIncluded) {
717
843
  if (!widgetList) {
718
844
  return null;