@byteluck-fe/model-driven-engine 2.6.0-alpha.12 → 2.6.0-alpha.13
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.
|
@@ -111,13 +111,6 @@ function _inherits(subClass, superClass) {
|
|
|
111
111
|
});
|
|
112
112
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
113
113
|
}
|
|
114
|
-
function _instanceof(left, right) {
|
|
115
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
116
|
-
return right[Symbol.hasInstance](left);
|
|
117
|
-
} else {
|
|
118
|
-
return left instanceof right;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
114
|
function _iterableToArray(iter) {
|
|
122
115
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
123
116
|
}
|
|
@@ -229,7 +222,7 @@ function _createSuper(Derived) {
|
|
|
229
222
|
};
|
|
230
223
|
}
|
|
231
224
|
import regeneratorRuntime from "regenerator-runtime";
|
|
232
|
-
import {
|
|
225
|
+
import { isDataBind } from '@byteluck-fe/model-driven-core';
|
|
233
226
|
import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from '@byteluck-fe/model-driven-shared';
|
|
234
227
|
import { Runtime } from './Runtime';
|
|
235
228
|
import { Store } from './Store';
|
|
@@ -398,7 +391,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
398
391
|
value: function _handlerArrayUpdate(state, key, type, args, result) {
|
|
399
392
|
var _this = this;
|
|
400
393
|
var subtable = findItem(this.runtime.flatInstances, key, this.runtime.instanceMap);
|
|
401
|
-
if (!
|
|
394
|
+
// if (!(subtable instanceof RuntimeListControl)) return
|
|
395
|
+
if (!(subtable.controlType === CONTROL_BASE_TYPE.LIST)) return;
|
|
402
396
|
// 新增多行方法
|
|
403
397
|
var createRows = function(len) {
|
|
404
398
|
// @ts-ignore
|
|
@@ -814,7 +808,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
814
808
|
}
|
|
815
809
|
var dataBind1 = dataBindMapping1.dataBind, controlId1 = dataBindMapping1.controlId;
|
|
816
810
|
var state = this.getState(controlId1, rowIndex);
|
|
817
|
-
if (
|
|
811
|
+
//if (dataBind instanceof ObjectDataBind) {
|
|
812
|
+
if (!isDataBind(dataBind1)) {
|
|
818
813
|
return Object.entries(dataBind1).reduce(function(result, param) {
|
|
819
814
|
var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
|
|
820
815
|
// objectDataBind的元素,跳过下一次赋值
|
|
@@ -915,7 +910,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
915
910
|
return;
|
|
916
911
|
}
|
|
917
912
|
var dataBind2 = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
|
|
918
|
-
if (
|
|
913
|
+
// if (dataBind instanceof ObjectDataBind) {
|
|
914
|
+
if (!isDataBind(dataBind2)) {
|
|
919
915
|
var ref;
|
|
920
916
|
var oldState = (ref = JSONCopy(this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : this.getEmptyState(controlId);
|
|
921
917
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
@@ -957,7 +953,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
957
953
|
return;
|
|
958
954
|
}
|
|
959
955
|
// 对象类型的值
|
|
960
|
-
if (
|
|
956
|
+
// if (dataBind instanceof ObjectDataBind) {
|
|
957
|
+
if (!isDataBind(dataBind3)) {
|
|
961
958
|
var ref;
|
|
962
959
|
var oldState = (ref = JSONCopy(_this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : _this.getEmptyState(controlId);
|
|
963
960
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
@@ -1001,7 +998,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1001
998
|
return;
|
|
1002
999
|
}
|
|
1003
1000
|
// 对象类型的值
|
|
1004
|
-
if (
|
|
1001
|
+
// if (dataBind instanceof ObjectDataBind) {
|
|
1002
|
+
if (!isDataBind(dataBind4)) {
|
|
1005
1003
|
var oldState = _this.getEmptyState(controlId);
|
|
1006
1004
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1007
1005
|
result1[item.controlId] = Object.entries(dataBind4).reduce(function(result, param) {
|
|
@@ -1059,9 +1057,11 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1059
1057
|
return i.fieldCode === fieldCode;
|
|
1060
1058
|
});
|
|
1061
1059
|
if (fieldMapping) {
|
|
1062
|
-
if (
|
|
1060
|
+
if (// fieldMapping.dataBind instanceof DataBind &&
|
|
1061
|
+
isDataBind(fieldMapping.dataBind) && row[fieldCode] !== undefined) {
|
|
1063
1062
|
newRow[fieldMapping.controlId] = row[fieldCode];
|
|
1064
|
-
} else if (
|
|
1063
|
+
// } else if (fieldMapping.dataBind instanceof ObjectDataBind) {
|
|
1064
|
+
} else if (!isDataBind(fieldMapping.dataBind)) {
|
|
1065
1065
|
var ref20;
|
|
1066
1066
|
var objValue = JSONCopy((ref20 = _this.getEmptyState(fieldMapping.controlId)) !== null && ref20 !== void 0 ? ref20 : {});
|
|
1067
1067
|
Object.keys(fieldMapping.dataBind).map(function(key) {
|
|
@@ -1097,9 +1097,11 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1097
1097
|
if (!newState[mapping.dataViewId[0]]) {
|
|
1098
1098
|
newState[mapping.dataViewId[0]] = {};
|
|
1099
1099
|
}
|
|
1100
|
-
if (
|
|
1100
|
+
if (// mapping.dataBind instanceof DataBind &&
|
|
1101
|
+
isDataBind(mapping.dataBind) && entity[fieldCode] !== undefined) {
|
|
1101
1102
|
newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
|
|
1102
|
-
} else if (
|
|
1103
|
+
// } else if (mapping.dataBind instanceof ObjectDataBind) {
|
|
1104
|
+
} else if (!isDataBind(mapping.dataBind)) {
|
|
1103
1105
|
var ref;
|
|
1104
1106
|
var objValue = (ref = _this3.getEmptyState(mapping.controlId)) !== null && ref !== void 0 ? ref : {};
|
|
1105
1107
|
Object.keys(mapping.dataBind).map(function(key) {
|
package/dist/esm/common/Store.js
CHANGED
|
@@ -30,14 +30,7 @@ function _defineProperty(obj, key, value) {
|
|
|
30
30
|
}
|
|
31
31
|
return obj;
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
35
|
-
return right[Symbol.hasInstance](left);
|
|
36
|
-
} else {
|
|
37
|
-
return left instanceof right;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
import { DataBind, ObjectDataBind } from '@byteluck-fe/model-driven-core';
|
|
33
|
+
import { DataBind, isDataBind } from '@byteluck-fe/model-driven-core';
|
|
41
34
|
import { loopFormSchema, JSONCopy, warn, CONTROL_TYPE, CONTROL_BASE_TYPE } from '@byteluck-fe/model-driven-shared';
|
|
42
35
|
import { loopDataViewControl, loopFormControl, buildUUID } from '../utils/runtimeUtils';
|
|
43
36
|
var Store = /*#__PURE__*/ function() {
|
|
@@ -263,7 +256,8 @@ item1) {
|
|
|
263
256
|
// if (item instanceof RuntimeFormControl) {
|
|
264
257
|
if (item1.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
265
258
|
var ref, ref1;
|
|
266
|
-
if (
|
|
259
|
+
// if (item.props.dataBind instanceof ObjectDataBind) {
|
|
260
|
+
if (!isDataBind(item1.props.dataBind)) {
|
|
267
261
|
// 特殊的dataBind,比如:金额是currency+amount两个key组成的,日期区间,继承自ObjectDataBind的需要通过Object.keys拿到多个databind
|
|
268
262
|
Object.keys(item1.props.dataBind).map(function(key) {
|
|
269
263
|
var dataBind = item1.props.dataBind;
|
|
@@ -318,7 +312,8 @@ item1) {
|
|
|
318
312
|
};
|
|
319
313
|
var subtableId = item1.id;
|
|
320
314
|
loopFormSchema(item1.props.headers, function(item) {
|
|
321
|
-
if (
|
|
315
|
+
// if (item.props.dataBind instanceof ObjectDataBind) {
|
|
316
|
+
if (!isDataBind(item.props.dataBind)) {
|
|
322
317
|
Object.keys(item.props.dataBind).map(function(key) {
|
|
323
318
|
var dataBind = item.props.dataBind;
|
|
324
319
|
var dataCode = dataBind[key].dataCode;
|
|
@@ -63,13 +63,6 @@ function _inherits(subClass, superClass) {
|
|
|
63
63
|
});
|
|
64
64
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
65
65
|
}
|
|
66
|
-
function _instanceof(left, right) {
|
|
67
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
68
|
-
return right[Symbol.hasInstance](left);
|
|
69
|
-
} else {
|
|
70
|
-
return left instanceof right;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
66
|
function _iterableToArrayLimit(arr, i) {
|
|
74
67
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
75
68
|
if (_i == null) return;
|
|
@@ -344,7 +337,8 @@ var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
344
337
|
{
|
|
345
338
|
key: "validate",
|
|
346
339
|
value: function validate(value) {
|
|
347
|
-
return
|
|
340
|
+
return(// value instanceof AmountValue ||
|
|
341
|
+
(isPlainObject(value) && 'amount' in value && isNumber(value.amount) && 'currency' in value && isString(value.currency)));
|
|
348
342
|
}
|
|
349
343
|
},
|
|
350
344
|
{
|
|
@@ -394,7 +388,8 @@ var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
394
388
|
{
|
|
395
389
|
key: "validate",
|
|
396
390
|
value: function validate(value) {
|
|
397
|
-
return
|
|
391
|
+
return(// value instanceof RangeDateValue ||
|
|
392
|
+
(isPlainObject(value) && 'min' in value && isString(value.min) && 'max' in value && isString(value.max)));
|
|
398
393
|
}
|
|
399
394
|
},
|
|
400
395
|
{
|
|
@@ -441,7 +436,8 @@ var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
441
436
|
{
|
|
442
437
|
key: "validate",
|
|
443
438
|
value: function validate(value) {
|
|
444
|
-
return
|
|
439
|
+
return(// value instanceof CalcValue ||
|
|
440
|
+
(isPlainObject(value) && 'result' in value && isNumber(value.result) && 'unit' in value && isString(value.unit)));
|
|
445
441
|
}
|
|
446
442
|
},
|
|
447
443
|
{
|
|
@@ -491,7 +487,18 @@ var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
491
487
|
{
|
|
492
488
|
key: "validate",
|
|
493
489
|
value: function validate(value) {
|
|
494
|
-
return
|
|
490
|
+
// return value instanceof AddressValue
|
|
491
|
+
if (isPlainObject(value)) {
|
|
492
|
+
// city?: string;
|
|
493
|
+
// cityDisplay?: string;
|
|
494
|
+
// district?: string;
|
|
495
|
+
// districtDisplay?: string;
|
|
496
|
+
// province?: string;
|
|
497
|
+
// provinceDisplay?: string
|
|
498
|
+
return true;
|
|
499
|
+
} else {
|
|
500
|
+
return false;
|
|
501
|
+
}
|
|
495
502
|
}
|
|
496
503
|
},
|
|
497
504
|
{
|