cloud-web-corejs 1.0.246 → 1.0.248

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.246",
4
+ "version": "1.0.248",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -90,6 +90,12 @@
90
90
  <th>{{ $t2("文件编码", "components.fileLibrary.fileSn") }}</th>
91
91
  <td colspan="3">{{ attachmentDTO.fileSn }}</td>
92
92
  </tr>
93
+ <tr>
94
+ <th>{{ $t1("作者") }}</th>
95
+ <td>{{ attachmentDTO.fileAuthor }}</td>
96
+ <th>{{ $t1("修订人") }}</th>
97
+ <td>{{ attachmentDTO.fileReviser }}</td>
98
+ </tr>
93
99
  <tr>
94
100
  <th>{{ $t2("创建人", "system.label.createBy") }}</th>
95
101
  <td>{{ attachmentDTO._createBy }}</td>
@@ -11,10 +11,100 @@ export function isNull(value) {
11
11
  return value === null || value === undefined;
12
12
  }
13
13
 
14
+ export function isNilOrEmptyStr(value) {
15
+ return value === null || value === undefined || value === "";
16
+ }
17
+
14
18
  export function isNotNull(value) {
15
19
  return value !== null && value !== undefined;
16
20
  }
17
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
+
18
108
  export function isEmptyStr(str) {
19
109
  //return (str === undefined) || (!str) || (!/[^\s]/.test(str));
20
110
  return (
@@ -34,7 +124,7 @@ export const createUUID = function () {
34
124
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
35
125
  .replace(/[xy]/g, function (c) {
36
126
  var r = (Math.random() * 16) | 0,
37
- v = c == "x" ? r : (r & 0x3) | 0x8;
127
+ v = c === "x" ? r : (r & 0x3) | 0x8;
38
128
  return v.toString(16);
39
129
  })
40
130
  .replaceAll("-", "");
@@ -303,7 +393,7 @@ export function traverseAllWidgetsNew(widgetList, callback) {
303
393
  loopHandleWidget(widgetList, (widget, parentWidget) => {
304
394
  if (callback) {
305
395
  callback(widget, parentWidget);
306
- if (widget.type == "data-table") {
396
+ if (widget.type === "data-table") {
307
397
  for (let item of widget.options.tableColumns) {
308
398
  columnLoopDo(item, parentWidget);
309
399
  }
@@ -696,8 +786,59 @@ export const columnFormatMap = {
696
786
  radio: "radio",
697
787
  dropdown: "dropdown",
698
788
  textarea: "textarea",
789
+ editScriptInput: "script-input",
699
790
  };
700
791
 
792
+ /** 列 widget 扩展选项:动态列 widgetOptions;设计器静态列 columnOption */
793
+ export function getColumnWidgetOptions(row, isEdit = false) {
794
+ if (!row) {
795
+ return undefined;
796
+ }
797
+ if (isEdit) {
798
+ return row.editWidgetOptions ?? row.editColumnOption;
799
+ }
800
+ return row.widgetOptions ?? row.columnOption;
801
+ }
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
+
701
842
  export function getFieldWidgetById(widgetList, fieldId, staticWidgetsIncluded) {
702
843
  if (!widgetList) {
703
844
  return null;
@@ -707,7 +848,7 @@ export function getFieldWidgetById(widgetList, fieldId, staticWidgetsIncluded) {
707
848
  let handlerFn = (widget) => {
708
849
  if (widget.id === fieldId) {
709
850
  foundWidget = widget;
710
- } else if (widget.type == "data-table") {
851
+ } else if (widget.type === "data-table") {
711
852
  for (let column of widget.options.tableColumns) {
712
853
  if (column?.widget?.id + "" === fieldId) {
713
854
  foundWidget = column.widget;
@@ -788,7 +929,7 @@ export function getQueryParam(variable) {
788
929
  let vars = query.split("&");
789
930
  for (let i = 0; i < vars.length; i++) {
790
931
  let pair = vars[i].split("=");
791
- if (pair[0] == variable) {
932
+ if (pair[0] === variable) {
792
933
  return pair[1];
793
934
  }
794
935
  }
@@ -865,6 +1006,13 @@ export function getDefaultFormConfig() {
865
1006
  otherTabList: [],
866
1007
  customListTabLabel: null,
867
1008
  globalConfig: null,
1009
+ // 表单级动态字段规则:按本地规则/后台脚本动态控制整个表单内任意字段/容器的显隐/必填/只读/禁用/取值
1010
+ dynamicFieldEnabled: false,
1011
+ dynamicFieldSourceType: "local",
1012
+ dynamicFieldRules: [],
1013
+ dynamicFieldScriptCode: null,
1014
+ dynamicFieldScriptParam: null,
1015
+ dynamicFieldTriggerFields: [],
868
1016
  };
869
1017
  }
870
1018
 
@@ -933,20 +1081,6 @@ export function assembleAxiosConfig(arrayObj, DSV, VFR) {
933
1081
  });
934
1082
  }
935
1083
  return result;
936
-
937
- /* return !arrayObj || arrayObj.length <= 0 || (arrayObj.map((function(ai) {
938
- "String" === ai.type ? result[ai.name] = String(ai.value)
939
- : "Number" === ai.type ? result[ai
940
- .name] = Number(ai.value)
941
- : "Boolean" === ai.type ? "false" === ai.value
942
- .toLowerCase() || "0" === ai.value ? result[ai.name] = !1 : "true" === ai.value.toLowerCase() ||
943
- "1" === ai.value ? result[ai.name] = !0 : result[ai.name] = null
944
- : "Variable" === ai.type ? (result[ai.name] = eval(ai.value))
945
- : "FormData" === ai.type && (result[ai.name] = VFR.formData[ai.value])
946
- })),
947
- console.log("test DSV: ", DSV),
948
- console.log("test VFR: ", VFR)),
949
- result */
950
1084
  }
951
1085
 
952
1086
  export function buildRequestConfig(dataSource, DSV, VFR, isSandbox) {
@@ -969,25 +1103,9 @@ export function buildRequestConfig(dataSource, DSV, VFR, isSandbox) {
969
1103
  let doms = VFR.getWidgetRef(DSV.widgetName);
970
1104
  let extraAccessData = doms.extraAccessData || {};
971
1105
 
972
- /* if(dataSource.requestaccessType == "SQL"){
973
- data.conditions = conditions;
974
- Object.assign(data.conditions,extraAccessData);
975
- }else{
976
- data = conditions;
977
- Object.assign(data,extraAccessData);
978
- } */
979
-
980
1106
  data.accessCode = requestAccess.accessCode;
981
1107
  data.conditions = conditions;
982
1108
  Object.assign(data.conditions, extraAccessData);
983
- /*
984
- if(requestAccess.accessReturnType === 0){
985
- data.conditions = conditions;
986
- Object.assign(data.conditions,extraAccessData);
987
- }else{
988
- data = conditions;
989
- Object.assign(data,extraAccessData);
990
- } */
991
1109
 
992
1110
  config.data = data;
993
1111
  var chFn = new Function(
@@ -1024,13 +1142,6 @@ export function _runDataSourceRequest() {
1024
1142
  t.errorHandlerCode
1025
1143
  ));
1026
1144
 
1027
- /*
1028
- axios.request(l).then(() => {
1029
- r.call(null, s, o, i, n)
1030
- }).catch((error) => {
1031
- d.call(null, error, o, i, a, n)
1032
- }) */
1033
-
1034
1145
  return new Promise((resolve, reject) => {
1035
1146
  request({
1036
1147
  ...l,
@@ -1043,44 +1154,8 @@ export function _runDataSourceRequest() {
1043
1154
  },
1044
1155
  });
1045
1156
  });
1046
-
1047
- /* return s = e.sent,
1048
- r = new Function("result","isSandbox","DSV","VFR",t.dataHandlerCode),
1049
- e.abrupt("return", r.call(null, s, o, i, n));
1050
-
1051
- d = new Function("error","isSandbox","DSV","$message","VFR",t.errorHandlerCode),
1052
- d.call(null, null, o, i, a, n), */
1053
1157
  };
1054
1158
  return _runDataSourceRequestN.apply(this, arguments);
1055
- /* return _runDataSourceRequest = Object(D_dev2021_variant_form_pro_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__["a"])(regeneratorRuntime.mark((function e(t, i, n, o, a) {
1056
- var l, s, r, d;
1057
- return regeneratorRuntime.wrap((function(e) {
1058
- while (1)
1059
- switch (e.prev = e.next) {
1060
- case 0:
1061
- return e.prev = 0,
1062
- l = buildRequestConfig(t, i, n, o),
1063
- e.next = 4,
1064
- axios__WEBPACK_IMPORTED_MODULE_11___default.a.request(l);
1065
- case 4:
1066
- return s = e.sent,
1067
- r = new Function("result","isSandbox","DSV","VFR",t.dataHandlerCode),
1068
- e.abrupt("return", r.call(null, s, o, i, n));
1069
- case 9:
1070
- e.prev = 9,
1071
- e.t0 = e["catch"](0),
1072
- d = new Function("error","isSandbox","DSV","$message","VFR",t.errorHandlerCode),
1073
- d.call(null, e.t0, o, i, a, n),
1074
- console.error(e.t0);
1075
- case 14:
1076
- case "end":
1077
- return e.stop()
1078
- }
1079
- }
1080
- ), e, null, [[0, 9]])
1081
- }
1082
- ))),
1083
- _runDataSourceRequest.apply(this, arguments) */
1084
1159
  }
1085
1160
 
1086
1161
  export function getDSByName(e, t) {