cloud-web-corejs 1.0.54-dev.656 → 1.0.54-dev.657

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.54-dev.656",
4
+ "version": "1.0.54-dev.657",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -73,8 +73,7 @@ export default {
73
73
  if (!this.fieldModel || !this.fieldModel.length) {
74
74
  return '';
75
75
  }
76
- const values = this.transformUtcToLocalValue(this.fieldModel);
77
- return values[0] + ' - ' + values[1];
76
+ return this.fieldModel[0] + ' - ' + this.fieldModel[1];
78
77
  },
79
78
  },
80
79
  beforeCreate() {
@@ -75,7 +75,7 @@ export default {
75
75
  if (!this.fieldModel) {
76
76
  return '';
77
77
  }
78
- return this.transformUtcToLocalValue(this.fieldModel);
78
+ return this.fieldModel;
79
79
  },
80
80
  },
81
81
  watch: {
@@ -1,4 +1,5 @@
1
- const DATE_FORMAT_TYPES = ["d1", "d2", "d3", "d4", "d5"];
1
+ import { deepClone, isNilOrEmptyStr } from "../../../../utils/util";
2
+ import fieldMixin from "../fieldMixin";
2
3
 
3
4
  export default {
4
5
  methods: {
@@ -6,7 +7,7 @@ export default {
6
7
  return !!this.field?.options?.utcTransformEnabled;
7
8
  },
8
9
  transformUtcToLocalValue(value) {
9
- if (value == null || value === "" || !this.isUtcTransformEnabled()) {
10
+ if (isNilOrEmptyStr(value) || !this.isUtcTransformEnabled()) {
10
11
  return value;
11
12
  }
12
13
  if (Array.isArray(value)) {
@@ -15,7 +16,7 @@ export default {
15
16
  return this.transformUtcToLocalSingle(value);
16
17
  },
17
18
  transformUtcToLocalSingle(value) {
18
- if (value == null || value === "") {
19
+ if (isNilOrEmptyStr(value)) {
19
20
  return value;
20
21
  }
21
22
  const localValue = this.$utcToLocal(value);
@@ -35,8 +36,8 @@ export default {
35
36
  const valueFormat = options.valueFormat || "";
36
37
  if (widgetType === "date" || widgetType === "date-range") {
37
38
  if (
38
- dateType === "datetime" ||
39
- (valueFormat && /[HhmSs]/.test(valueFormat))
39
+ dateType === "datetime"
40
+ || (valueFormat && /[HhmSs]/.test(valueFormat))
40
41
  ) {
41
42
  return localValue;
42
43
  }
@@ -44,16 +45,31 @@ export default {
44
45
  }
45
46
  return localValue;
46
47
  },
47
- transformUtcForDateFormat(cellValue, formatType) {
48
- if (
49
- !cellValue ||
50
- !this.field?.options?.utcTransformEnabled ||
51
- !formatType ||
52
- !DATE_FORMAT_TYPES.includes(formatType)
53
- ) {
54
- return cellValue;
55
- }
56
- return this.$utcToLocal(cellValue);
48
+ getUtcTransformedFieldValue() {
49
+ if (!this.isUtcTransformEnabled()) {
50
+ return this.fieldModel;
51
+ }
52
+ return this.transformUtcToLocalValue(this.fieldModel);
53
+ },
54
+ initFieldModel(flag) {
55
+ fieldMixin.methods.initFieldModel.call(this, flag);
56
+ // flag=true 来自 initValueWatchEvent;行数据已是本地时间,再转换会重复偏移并触发 watch 死循环
57
+ if (this.designState || !this.isUtcTransformEnabled() || flag) {
58
+ return;
59
+ }
60
+ const transformed = this.getUtcTransformedFieldValue();
61
+ if (transformed === this.fieldModel) {
62
+ return;
63
+ }
64
+ const currentData =
65
+ this.tableParam && this.tableParam.row
66
+ ? this.tableParam.row
67
+ : this.formModel;
68
+ this.fieldModel = transformed;
69
+ this.oldFieldValue = deepClone(transformed);
70
+ if (transformed !== currentData[this.fieldKeyName]) {
71
+ this.syncUpdateFormModel(transformed);
72
+ }
57
73
  },
58
74
  },
59
75
  };
@@ -11,7 +11,9 @@
11
11
  :sub-form-col-index="subFormColIndex"
12
12
  :sub-form-row-id="subFormRowId"
13
13
  >
14
- <span class="text-area" :class="field.options.colorClass">{{ showVaule }}</span>
14
+ <span class="text-area" :class="field.options.colorClass">{{
15
+ showVaule
16
+ }}</span>
15
17
  </form-item-wrapper>
16
18
  </template>
17
19
 
@@ -98,11 +100,9 @@ export default {
98
100
  methods: {
99
101
  formatterValue() {
100
102
  let formatType = this.field.options.formatType;
101
- let cellValue = this.transformUtcForDateFormat(
102
- this.fieldModel,
103
- formatType
104
- );
105
- if (formatType === null || formatType === undefined) return cellValue;
103
+ let cellValue = this.fieldModel;
104
+ if (formatType === null || formatType === undefined || formatType === "")
105
+ return cellValue;
106
106
  if (formatType)
107
107
  switch (formatType) {
108
108
  case "render":
@@ -11,6 +11,10 @@ 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
  }
@@ -34,7 +38,7 @@ export const createUUID = function () {
34
38
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
35
39
  .replace(/[xy]/g, function (c) {
36
40
  var r = (Math.random() * 16) | 0,
37
- v = c == "x" ? r : (r & 0x3) | 0x8;
41
+ v = c === "x" ? r : (r & 0x3) | 0x8;
38
42
  return v.toString(16);
39
43
  })
40
44
  .replaceAll("-", "");
@@ -303,7 +307,7 @@ export function traverseAllWidgetsNew(widgetList, callback) {
303
307
  loopHandleWidget(widgetList, (widget, parentWidget) => {
304
308
  if (callback) {
305
309
  callback(widget, parentWidget);
306
- if (widget.type == "data-table") {
310
+ if (widget.type === "data-table") {
307
311
  for (let item of widget.options.tableColumns) {
308
312
  columnLoopDo(item, parentWidget);
309
313
  }
@@ -707,7 +711,7 @@ export function getFieldWidgetById(widgetList, fieldId, staticWidgetsIncluded) {
707
711
  let handlerFn = (widget) => {
708
712
  if (widget.id === fieldId) {
709
713
  foundWidget = widget;
710
- } else if (widget.type == "data-table") {
714
+ } else if (widget.type === "data-table") {
711
715
  for (let column of widget.options.tableColumns) {
712
716
  if (column?.widget?.id + "" === fieldId) {
713
717
  foundWidget = column.widget;
@@ -788,7 +792,7 @@ export function getQueryParam(variable) {
788
792
  let vars = query.split("&");
789
793
  for (let i = 0; i < vars.length; i++) {
790
794
  let pair = vars[i].split("=");
791
- if (pair[0] == variable) {
795
+ if (pair[0] === variable) {
792
796
  return pair[1];
793
797
  }
794
798
  }
@@ -933,20 +937,6 @@ export function assembleAxiosConfig(arrayObj, DSV, VFR) {
933
937
  });
934
938
  }
935
939
  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
940
  }
951
941
 
952
942
  export function buildRequestConfig(dataSource, DSV, VFR, isSandbox) {
@@ -969,25 +959,9 @@ export function buildRequestConfig(dataSource, DSV, VFR, isSandbox) {
969
959
  let doms = VFR.getWidgetRef(DSV.widgetName);
970
960
  let extraAccessData = doms.extraAccessData || {};
971
961
 
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
962
  data.accessCode = requestAccess.accessCode;
981
963
  data.conditions = conditions;
982
964
  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
965
 
992
966
  config.data = data;
993
967
  var chFn = new Function(
@@ -1024,13 +998,6 @@ export function _runDataSourceRequest() {
1024
998
  t.errorHandlerCode
1025
999
  ));
1026
1000
 
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
1001
  return new Promise((resolve, reject) => {
1035
1002
  request({
1036
1003
  ...l,
@@ -1043,44 +1010,8 @@ export function _runDataSourceRequest() {
1043
1010
  },
1044
1011
  });
1045
1012
  });
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
1013
  };
1054
1014
  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
1015
  }
1085
1016
 
1086
1017
  export function getDSByName(e, t) {