@byteluck-fe/model-driven-engine 2.23.0-beta.14 → 2.23.0-beta.15
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/README.md +30 -30
- package/dist/esm/common/ActionManager.js +4 -4
- package/dist/esm/common/Engine.js +66 -93
- package/dist/esm/common/Runtime.js +14 -30
- package/dist/esm/common/Store.js +7 -4
- package/dist/esm/common/checkerValue.js +17 -37
- package/dist/esm/common/proxyState.js +18 -18
- package/dist/esm/plugins/CalcPlugin.js +43 -43
- package/dist/esm/plugins/ControlsEventPlugin.js +2 -2
- package/dist/esm/plugins/LifecycleEventPlugin.js +2 -2
- package/dist/esm/plugins/StylePlugin.js +6 -6
- package/dist/index.umd.js +6 -11
- package/dist/types/common/ActionManager.d.ts +14 -14
- package/dist/types/common/DataManager.d.ts +10 -10
- package/dist/types/common/Engine.d.ts +201 -201
- package/dist/types/common/OkWorker.d.ts +13 -13
- package/dist/types/common/Plugin.d.ts +6 -6
- package/dist/types/common/Runtime.d.ts +31 -31
- package/dist/types/common/Store.d.ts +54 -54
- package/dist/types/common/checkerValue.d.ts +3 -3
- package/dist/types/common/index.d.ts +2 -2
- package/dist/types/common/proxyState.d.ts +30 -30
- package/dist/types/index.d.ts +3 -3
- package/dist/types/plugins/CalcPlugin.d.ts +121 -121
- package/dist/types/plugins/ControlsEventPlugin.d.ts +17 -17
- package/dist/types/plugins/ES6ModulePlugin.d.ts +27 -27
- package/dist/types/plugins/LifecycleEventPlugin.d.ts +15 -15
- package/dist/types/plugins/StylePlugin.d.ts +13 -13
- package/dist/types/plugins/index.d.ts +5 -5
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/runtimeUtils.d.ts +5 -5
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
# Engine
|
|
2
|
-
运行态引擎
|
|
3
|
-
|
|
4
|
-
```
|
|
5
|
-
│ index.ts // 入口文件
|
|
6
|
-
│
|
|
7
|
-
├─common // 引擎相关
|
|
8
|
-
│ ActionManager.ts // utils操作管理
|
|
9
|
-
│ checkerValue.ts // 表单值校验器
|
|
10
|
-
│ DataManager.ts // 数据源容器
|
|
11
|
-
│ Engine.ts // 引擎
|
|
12
|
-
│ index.ts // 入口
|
|
13
|
-
│ OkWorker.ts // 无用
|
|
14
|
-
│ Plugin.ts // 插件
|
|
15
|
-
│ proxyState.ts // 劫持引擎表单数据
|
|
16
|
-
│ Runtime.ts // 控件注册和创建
|
|
17
|
-
│ Store.ts // 数据管理
|
|
18
|
-
│
|
|
19
|
-
├─plugins
|
|
20
|
-
│ CalcPlugin.ts // 计算公式插件
|
|
21
|
-
│ ControlsEventPlugin.ts // 控件二开事件插件
|
|
22
|
-
│ ES6ModulePlugin.ts //
|
|
23
|
-
│ index.ts
|
|
24
|
-
│ LifecycleEventPlugin.ts // 页面生命周期事件
|
|
25
|
-
│ StylePlugin.ts // css二开
|
|
26
|
-
│
|
|
27
|
-
└─utils
|
|
28
|
-
index.ts
|
|
29
|
-
runtimeUtils.ts // 工具函数
|
|
30
|
-
```
|
|
1
|
+
# Engine
|
|
2
|
+
运行态引擎
|
|
3
|
+
|
|
4
|
+
```
|
|
5
|
+
│ index.ts // 入口文件
|
|
6
|
+
│
|
|
7
|
+
├─common // 引擎相关
|
|
8
|
+
│ ActionManager.ts // utils操作管理
|
|
9
|
+
│ checkerValue.ts // 表单值校验器
|
|
10
|
+
│ DataManager.ts // 数据源容器
|
|
11
|
+
│ Engine.ts // 引擎
|
|
12
|
+
│ index.ts // 入口
|
|
13
|
+
│ OkWorker.ts // 无用
|
|
14
|
+
│ Plugin.ts // 插件
|
|
15
|
+
│ proxyState.ts // 劫持引擎表单数据
|
|
16
|
+
│ Runtime.ts // 控件注册和创建
|
|
17
|
+
│ Store.ts // 数据管理
|
|
18
|
+
│
|
|
19
|
+
├─plugins
|
|
20
|
+
│ CalcPlugin.ts // 计算公式插件
|
|
21
|
+
│ ControlsEventPlugin.ts // 控件二开事件插件
|
|
22
|
+
│ ES6ModulePlugin.ts //
|
|
23
|
+
│ index.ts
|
|
24
|
+
│ LifecycleEventPlugin.ts // 页面生命周期事件
|
|
25
|
+
│ StylePlugin.ts // css二开
|
|
26
|
+
│
|
|
27
|
+
└─utils
|
|
28
|
+
index.ts
|
|
29
|
+
runtimeUtils.ts // 工具函数
|
|
30
|
+
```
|
|
@@ -186,11 +186,11 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
186
186
|
_class_call_check(this, ActionManager);
|
|
187
187
|
_define_property(this, "actionMap", new Map());
|
|
188
188
|
_define_property(this, "buildinActions", {});
|
|
189
|
-
/**
|
|
190
|
-
* 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
|
|
189
|
+
/**
|
|
190
|
+
* 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
|
|
191
191
|
*/ _define_property(this, "actionUtils", {});
|
|
192
|
-
/**
|
|
193
|
-
* 用于存储es module解析出来的源码,CustomVueControlPlugin
|
|
192
|
+
/**
|
|
193
|
+
* 用于存储es module解析出来的源码,CustomVueControlPlugin
|
|
194
194
|
*/ _define_property(this, "sources", {});
|
|
195
195
|
}
|
|
196
196
|
_create_class(ActionManager, [
|
|
@@ -44,6 +44,10 @@ function _async_to_generator(fn) {
|
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
+
function _call_super(_this, derived, args) {
|
|
48
|
+
derived = _get_prototype_of(derived);
|
|
49
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
50
|
+
}
|
|
47
51
|
function _class_call_check(instance, Constructor) {
|
|
48
52
|
if (!(instance instanceof Constructor)) {
|
|
49
53
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -222,28 +226,12 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
222
226
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
223
227
|
}
|
|
224
228
|
function _is_native_reflect_construct() {
|
|
225
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
226
|
-
if (Reflect.construct.sham) return false;
|
|
227
|
-
if (typeof Proxy === "function") return true;
|
|
228
229
|
try {
|
|
229
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
return
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
function _create_super(Derived) {
|
|
236
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
237
|
-
return function _createSuperInternal() {
|
|
238
|
-
var Super = _get_prototype_of(Derived), result;
|
|
239
|
-
if (hasNativeReflectConstruct) {
|
|
240
|
-
var NewTarget = _get_prototype_of(this).constructor;
|
|
241
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
242
|
-
} else {
|
|
243
|
-
result = Super.apply(this, arguments);
|
|
244
|
-
}
|
|
245
|
-
return _possible_constructor_return(this, result);
|
|
246
|
-
};
|
|
230
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
231
|
+
} catch (_) {}
|
|
232
|
+
return (_is_native_reflect_construct = function() {
|
|
233
|
+
return !!result;
|
|
234
|
+
})();
|
|
247
235
|
}
|
|
248
236
|
function _ts_generator(thisArg, body) {
|
|
249
237
|
var f, y, t, g, _ = {
|
|
@@ -361,30 +349,14 @@ var applyingPluginName = '';
|
|
|
361
349
|
var Engine = /*#__PURE__*/ function(Watcher) {
|
|
362
350
|
"use strict";
|
|
363
351
|
_inherits(Engine, Watcher);
|
|
364
|
-
var _super = _create_super(Engine);
|
|
365
352
|
function Engine(props) {
|
|
366
353
|
_class_call_check(this, Engine);
|
|
367
354
|
var _this;
|
|
368
|
-
_this =
|
|
369
|
-
_define_property(
|
|
370
|
-
_define_property(_assert_this_initialized(_this), "rawStore", {});
|
|
371
|
-
_define_property(_assert_this_initialized(_this), "parent", void 0);
|
|
372
|
-
// 提供注册运行态控件以及实例化控件的能力
|
|
373
|
-
_define_property(_assert_this_initialized(_this), "runtime", void 0);
|
|
374
|
-
// 提供子线程处理脚本以及修改数据的能力
|
|
355
|
+
_this = _call_super(this, Engine), _define_property(_this, "store", void 0), _define_property(_this, "rawStore", {}), _define_property(_this, "parent", void 0), // 提供注册运行态控件以及实例化控件的能力
|
|
356
|
+
_define_property(_this, "runtime", void 0), // 提供子线程处理脚本以及修改数据的能力
|
|
375
357
|
// public worker: OkWorker
|
|
376
|
-
_define_property(
|
|
377
|
-
_define_property(
|
|
378
|
-
_define_property(_assert_this_initialized(_this), "externalParams", void 0);
|
|
379
|
-
_define_property(_assert_this_initialized(_this), "children", void 0);
|
|
380
|
-
// 提供外部注册插件,在不同的hooks触发时执行固定函数的能力
|
|
381
|
-
_define_property(_assert_this_initialized(_this), "__plugins", void 0);
|
|
382
|
-
_define_property(_assert_this_initialized(_this), "__pluginsApplied", false);
|
|
383
|
-
_define_property(_assert_this_initialized(_this), "$options", void 0);
|
|
384
|
-
_define_property(_assert_this_initialized(_this), "actionManager", new ActionManager());
|
|
385
|
-
_define_property(_assert_this_initialized(_this), "dataManager", void 0);
|
|
386
|
-
_define_property(_assert_this_initialized(_this), "_jobTasks", []);
|
|
387
|
-
_define_property(_assert_this_initialized(_this), "createControlInstance", _this.createInstance);
|
|
358
|
+
_define_property(_this, "isMounted", false), _define_property(_this, "id", genNonDuplicateId(8)), _define_property(_this, "externalParams", void 0), _define_property(_this, "children", void 0), // 提供外部注册插件,在不同的hooks触发时执行固定函数的能力
|
|
359
|
+
_define_property(_this, "__plugins", void 0), _define_property(_this, "__pluginsApplied", false), _define_property(_this, "$options", void 0), _define_property(_this, "actionManager", new ActionManager()), _define_property(_this, "dataManager", void 0), _define_property(_this, "_jobTasks", []), _define_property(_this, "createControlInstance", _this.createInstance);
|
|
388
360
|
_this.$options = Object.freeze(props);
|
|
389
361
|
var _this_$options = _this.$options, _this_$options_autoMount = _this_$options.autoMount, autoMount = _this_$options_autoMount === void 0 ? true : _this_$options_autoMount, schema = _this_$options.schema, beforeCreateInstance = _this_$options.beforeCreateInstance, externalParams = _this_$options.externalParams, _this_$options_language = _this_$options.// fieldModel,
|
|
390
362
|
language, language = _this_$options_language === void 0 ? DEFAULT_LOCALE : _this_$options_language, _this_$options_debug = _this_$options.debug, debug = _this_$options_debug === void 0 ? false : _this_$options_debug, messagesI18n = _this_$options.messagesI18n, children = _this_$options.children;
|
|
@@ -624,6 +596,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
624
596
|
{
|
|
625
597
|
key: "_handlerSubtableUpdateUid",
|
|
626
598
|
value: function _handlerSubtableUpdateUid(subtableData) {
|
|
599
|
+
;
|
|
627
600
|
subtableData.forEach(function(item) {
|
|
628
601
|
if (!item.uid) {
|
|
629
602
|
Object.assign(item, {
|
|
@@ -977,9 +950,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
977
950
|
}
|
|
978
951
|
},
|
|
979
952
|
{
|
|
980
|
-
/**
|
|
981
|
-
* 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
|
|
982
|
-
* @param options 需要携带的options
|
|
953
|
+
/**
|
|
954
|
+
* 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
|
|
955
|
+
* @param options 需要携带的options
|
|
983
956
|
* */ key: "setPayloadOptions",
|
|
984
957
|
value: function setPayloadOptions(options) {
|
|
985
958
|
eventOptionsTemp = options;
|
|
@@ -996,9 +969,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
996
969
|
}
|
|
997
970
|
},
|
|
998
971
|
{
|
|
999
|
-
/**
|
|
1000
|
-
* 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
|
|
1001
|
-
* @param states
|
|
972
|
+
/**
|
|
973
|
+
* 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
|
|
974
|
+
* @param states
|
|
1002
975
|
*/ key: "setStates",
|
|
1003
976
|
value: function setStates(states, rowIndex, options) {
|
|
1004
977
|
var _this = this;
|
|
@@ -1025,11 +998,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1025
998
|
}
|
|
1026
999
|
},
|
|
1027
1000
|
{
|
|
1028
|
-
/**
|
|
1029
|
-
* 通过dataCode和fieldCode来获取控件的值
|
|
1030
|
-
* @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
|
|
1031
|
-
* @param fieldCode 字段编码 - 控件绑定的数据项的编码
|
|
1032
|
-
* @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
|
|
1001
|
+
/**
|
|
1002
|
+
* 通过dataCode和fieldCode来获取控件的值
|
|
1003
|
+
* @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
|
|
1004
|
+
* @param fieldCode 字段编码 - 控件绑定的数据项的编码
|
|
1005
|
+
* @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
|
|
1033
1006
|
* */ key: "getField",
|
|
1034
1007
|
value: function getField(dataCode, fieldCode, rowIndex) {
|
|
1035
1008
|
if (!fieldCode) {
|
|
@@ -1144,13 +1117,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1144
1117
|
}
|
|
1145
1118
|
},
|
|
1146
1119
|
{
|
|
1147
|
-
/**
|
|
1148
|
-
* 通过dataCode和fieldCode来设置控件的值
|
|
1149
|
-
* @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
|
|
1150
|
-
* @param fieldCode 字段编码 - 控件绑定的数据项的编码
|
|
1151
|
-
* @param value 修改的值
|
|
1152
|
-
* @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
|
|
1153
|
-
* @param options 触发事件携带的参数
|
|
1120
|
+
/**
|
|
1121
|
+
* 通过dataCode和fieldCode来设置控件的值
|
|
1122
|
+
* @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
|
|
1123
|
+
* @param fieldCode 字段编码 - 控件绑定的数据项的编码
|
|
1124
|
+
* @param value 修改的值
|
|
1125
|
+
* @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
|
|
1126
|
+
* @param options 触发事件携带的参数
|
|
1154
1127
|
* */ key: "setField",
|
|
1155
1128
|
value: function setField(dataCode, fieldCode, value, rowIndex, options) {
|
|
1156
1129
|
var dataBindMapping = this.getDataBindMapping(dataCode, fieldCode);
|
|
@@ -1178,12 +1151,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1178
1151
|
}
|
|
1179
1152
|
},
|
|
1180
1153
|
{
|
|
1181
|
-
/**
|
|
1182
|
-
* 通过dataCode和 state来给一组控件赋值,并触发事件携带options
|
|
1183
|
-
* @param dataCode 需要赋值的目标模型
|
|
1184
|
-
* @param state 赋值对象,以fieldCode为key组成的对象
|
|
1185
|
-
* @param rowIndex 行下标,给明细子表赋值时指定赋值某行
|
|
1186
|
-
* @param options 触发事件携带的参数
|
|
1154
|
+
/**
|
|
1155
|
+
* 通过dataCode和 state来给一组控件赋值,并触发事件携带options
|
|
1156
|
+
* @param dataCode 需要赋值的目标模型
|
|
1157
|
+
* @param state 赋值对象,以fieldCode为key组成的对象
|
|
1158
|
+
* @param rowIndex 行下标,给明细子表赋值时指定赋值某行
|
|
1159
|
+
* @param options 触发事件携带的参数
|
|
1187
1160
|
* */ key: "setFields",
|
|
1188
1161
|
value: function setFields(dataCode, state, rowIndex, options) {
|
|
1189
1162
|
var _this = this;
|
|
@@ -1224,10 +1197,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1224
1197
|
}
|
|
1225
1198
|
},
|
|
1226
1199
|
{
|
|
1227
|
-
/**
|
|
1228
|
-
* 通过dataCode来将state转化为标准的state结构
|
|
1229
|
-
* @param dataCode 需要转换的目标模型code
|
|
1230
|
-
* @param state 值对象,以fieldCode为key组成的对象
|
|
1200
|
+
/**
|
|
1201
|
+
* 通过dataCode来将state转化为标准的state结构
|
|
1202
|
+
* @param dataCode 需要转换的目标模型code
|
|
1203
|
+
* @param state 值对象,以fieldCode为key组成的对象
|
|
1231
1204
|
* */ key: "buildFields",
|
|
1232
1205
|
value: function buildFields(dataCode, state) {
|
|
1233
1206
|
var _this = this;
|
|
@@ -1268,10 +1241,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1268
1241
|
}
|
|
1269
1242
|
},
|
|
1270
1243
|
{
|
|
1271
|
-
/**
|
|
1272
|
-
* 向Store设置一组值,并触发事件携带options
|
|
1273
|
-
* @param dataSet
|
|
1274
|
-
* @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
|
|
1244
|
+
/**
|
|
1245
|
+
* 向Store设置一组值,并触发事件携带options
|
|
1246
|
+
* @param dataSet
|
|
1247
|
+
* @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
|
|
1275
1248
|
*/ key: "setData",
|
|
1276
1249
|
value: function setData(dataSet, options) {
|
|
1277
1250
|
var _this = this;
|
|
@@ -1409,19 +1382,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1409
1382
|
}
|
|
1410
1383
|
},
|
|
1411
1384
|
{
|
|
1412
|
-
/**
|
|
1413
|
-
* 获取控件的dataBind
|
|
1414
|
-
* @param controlId
|
|
1385
|
+
/**
|
|
1386
|
+
* 获取控件的dataBind
|
|
1387
|
+
* @param controlId
|
|
1415
1388
|
* */ key: "getDataBind",
|
|
1416
1389
|
value: function getDataBind(controlId) {
|
|
1417
1390
|
return this.store.getDataBind(controlId);
|
|
1418
1391
|
}
|
|
1419
1392
|
},
|
|
1420
1393
|
{
|
|
1421
|
-
/**
|
|
1422
|
-
* 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
|
|
1423
|
-
* @param controlId
|
|
1424
|
-
* @param rowIndex
|
|
1394
|
+
/**
|
|
1395
|
+
* 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
|
|
1396
|
+
* @param controlId
|
|
1397
|
+
* @param rowIndex
|
|
1425
1398
|
*/ key: "getInstance",
|
|
1426
1399
|
value: function getInstance(controlId, rowIndex) {
|
|
1427
1400
|
var instances = this.getInstances(controlId, rowIndex === -1);
|
|
@@ -1440,10 +1413,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1440
1413
|
}
|
|
1441
1414
|
},
|
|
1442
1415
|
{
|
|
1443
|
-
/**
|
|
1444
|
-
* 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
|
|
1445
|
-
* @param controlId
|
|
1446
|
-
* @param header 明细表内是否获取表头的控件
|
|
1416
|
+
/**
|
|
1417
|
+
* 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
|
|
1418
|
+
* @param controlId
|
|
1419
|
+
* @param header 明细表内是否获取表头的控件
|
|
1447
1420
|
*/ // getInstances(
|
|
1448
1421
|
// controlId?: string,
|
|
1449
1422
|
// header: boolean = false
|
|
@@ -1619,27 +1592,27 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1619
1592
|
},
|
|
1620
1593
|
{
|
|
1621
1594
|
key: "assertInstance",
|
|
1622
|
-
value: /**
|
|
1623
|
-
* 判断控件的类型,返回当前控件的正确类型
|
|
1595
|
+
value: /**
|
|
1596
|
+
* 判断控件的类型,返回当前控件的正确类型
|
|
1624
1597
|
* */ function assertInstance(instance, types) {
|
|
1625
1598
|
return isString(types) ? instance.type === types : types.includes(instance.type);
|
|
1626
1599
|
}
|
|
1627
1600
|
},
|
|
1628
1601
|
{
|
|
1629
1602
|
key: "assertInstanceIsCustomControl",
|
|
1630
|
-
value: /**
|
|
1631
|
-
* 判断控件或控件类型是一个自定义控件
|
|
1603
|
+
value: /**
|
|
1604
|
+
* 判断控件或控件类型是一个自定义控件
|
|
1632
1605
|
* */ function assertInstanceIsCustomControl(instance) {
|
|
1633
1606
|
return !isBuiltInControls(isString(instance) ? instance : instance.type);
|
|
1634
1607
|
}
|
|
1635
1608
|
},
|
|
1636
1609
|
{
|
|
1637
1610
|
key: "getInstanceRowIndex",
|
|
1638
|
-
value: /**
|
|
1639
|
-
* 获取控件在明细子表中的行下标,
|
|
1640
|
-
* 如果控件在表头内,则返回-1
|
|
1641
|
-
* 如果控件在表内,则返回行下标
|
|
1642
|
-
* 如果控件不在明细表内,则返回undefined
|
|
1611
|
+
value: /**
|
|
1612
|
+
* 获取控件在明细子表中的行下标,
|
|
1613
|
+
* 如果控件在表头内,则返回-1
|
|
1614
|
+
* 如果控件在表内,则返回行下标
|
|
1615
|
+
* 如果控件不在明细表内,则返回undefined
|
|
1643
1616
|
* */ // public getInstanceRowIndex(
|
|
1644
1617
|
// instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
|
|
1645
1618
|
// ) {
|
|
@@ -4,6 +4,10 @@ function _assert_this_initialized(self) {
|
|
|
4
4
|
}
|
|
5
5
|
return self;
|
|
6
6
|
}
|
|
7
|
+
function _call_super(_this, derived, args) {
|
|
8
|
+
derived = _get_prototype_of(derived);
|
|
9
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
10
|
+
}
|
|
7
11
|
function _class_call_check(instance, Constructor) {
|
|
8
12
|
if (!(instance instanceof Constructor)) {
|
|
9
13
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -73,28 +77,12 @@ function _type_of(obj) {
|
|
|
73
77
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
74
78
|
}
|
|
75
79
|
function _is_native_reflect_construct() {
|
|
76
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
77
|
-
if (Reflect.construct.sham) return false;
|
|
78
|
-
if (typeof Proxy === "function") return true;
|
|
79
80
|
try {
|
|
80
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function _create_super(Derived) {
|
|
87
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
88
|
-
return function _createSuperInternal() {
|
|
89
|
-
var Super = _get_prototype_of(Derived), result;
|
|
90
|
-
if (hasNativeReflectConstruct) {
|
|
91
|
-
var NewTarget = _get_prototype_of(this).constructor;
|
|
92
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
93
|
-
} else {
|
|
94
|
-
result = Super.apply(this, arguments);
|
|
95
|
-
}
|
|
96
|
-
return _possible_constructor_return(this, result);
|
|
97
|
-
};
|
|
81
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
82
|
+
} catch (_) {}
|
|
83
|
+
return (_is_native_reflect_construct = function() {
|
|
84
|
+
return !!result;
|
|
85
|
+
})();
|
|
98
86
|
}
|
|
99
87
|
import { RegisterControls, isDataBind } from '@byteluck-fe/model-driven-core';
|
|
100
88
|
import { CONTROL_BASE_TYPE, CONTROL_TYPE, JSONCopy, loopFormSchema, isArray } from '@byteluck-fe/model-driven-shared';
|
|
@@ -102,16 +90,12 @@ import { hasChildrenControl, loopDataViewControl, loopFormControl } from '../uti
|
|
|
102
90
|
export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
103
91
|
"use strict";
|
|
104
92
|
_inherits(Runtime, RegisterControls);
|
|
105
|
-
var _super = _create_super(Runtime);
|
|
106
93
|
function Runtime(props) {
|
|
107
94
|
_class_call_check(this, Runtime);
|
|
108
95
|
var _this;
|
|
109
|
-
_this =
|
|
110
|
-
|
|
111
|
-
_define_property(
|
|
112
|
-
_define_property(_assert_this_initialized(_this), "_flatInstances", []);
|
|
113
|
-
_define_property(_assert_this_initialized(_this), "_instanceMap", {});
|
|
114
|
-
_define_property(_assert_this_initialized(_this), "_controlParentIdMap", {});
|
|
96
|
+
_this = _call_super(this, Runtime, [
|
|
97
|
+
'Runtime'
|
|
98
|
+
]), _define_property(_this, "_schema", void 0), _define_property(_this, "_instance", void 0), _define_property(_this, "_flatInstances", []), _define_property(_this, "_instanceMap", {}), _define_property(_this, "_controlParentIdMap", {});
|
|
115
99
|
var schema = props.schema;
|
|
116
100
|
_this._schema = schema;
|
|
117
101
|
_this._instance = _this.createControl(schema, props.beforeCreateInstance);
|
|
@@ -305,8 +289,8 @@ function loop(control, parentId, callback) {
|
|
|
305
289
|
function hasHeaderOrFooterControl(control, checkType) {
|
|
306
290
|
return checkType in control.props && isArray(control.props[checkType]);
|
|
307
291
|
}
|
|
308
|
-
/**
|
|
309
|
-
* 控件是否在视图中隐藏,遍历查找所有parent
|
|
292
|
+
/**
|
|
293
|
+
* 控件是否在视图中隐藏,遍历查找所有parent
|
|
310
294
|
* */ function getControlIsHide(control) {
|
|
311
295
|
if (control.props.isHide) {
|
|
312
296
|
return true;
|
package/dist/esm/common/Store.js
CHANGED
|
@@ -69,10 +69,10 @@ var Store = /*#__PURE__*/ function() {
|
|
|
69
69
|
}
|
|
70
70
|
_create_class(Store, [
|
|
71
71
|
{
|
|
72
|
-
/**
|
|
73
|
-
* 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
|
|
74
|
-
* @param controlId 组件ID
|
|
75
|
-
* @param value
|
|
72
|
+
/**
|
|
73
|
+
* 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
|
|
74
|
+
* @param controlId 组件ID
|
|
75
|
+
* @param value
|
|
76
76
|
*/ key: "setState",
|
|
77
77
|
value: function setState(controlId, value, rowIndex) {
|
|
78
78
|
var _this = this;
|
|
@@ -81,6 +81,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
81
81
|
if (controlInfo !== undefined) {
|
|
82
82
|
//明细表
|
|
83
83
|
if (controlInfo.children) {
|
|
84
|
+
;
|
|
84
85
|
value.forEach(function(item) {
|
|
85
86
|
if (!item.uid) {
|
|
86
87
|
Object.assign(item, {
|
|
@@ -109,6 +110,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
109
110
|
Object.keys(children).map(function(childControlId) {
|
|
110
111
|
if (childControlId === controlId) {
|
|
111
112
|
if (_this.state[dataView][subtableId][rowIndex]) {
|
|
113
|
+
;
|
|
112
114
|
_this.state[dataView][subtableId][rowIndex][controlId] = noProxyValue;
|
|
113
115
|
}
|
|
114
116
|
}
|
|
@@ -167,6 +169,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
167
169
|
if (children !== undefined) {
|
|
168
170
|
Object.keys(children).map(function(childControlId) {
|
|
169
171
|
if (childControlId === controlId) {
|
|
172
|
+
;
|
|
170
173
|
_this.state[dataViewId][subtableId].map(function(item) {
|
|
171
174
|
states.push(item[controlId]);
|
|
172
175
|
});
|
|
@@ -12,6 +12,10 @@ function _assert_this_initialized(self) {
|
|
|
12
12
|
}
|
|
13
13
|
return self;
|
|
14
14
|
}
|
|
15
|
+
function _call_super(_this, derived, args) {
|
|
16
|
+
derived = _get_prototype_of(derived);
|
|
17
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
18
|
+
}
|
|
15
19
|
function _class_call_check(instance, Constructor) {
|
|
16
20
|
if (!(instance instanceof Constructor)) {
|
|
17
21
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -134,28 +138,12 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
134
138
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
135
139
|
}
|
|
136
140
|
function _is_native_reflect_construct() {
|
|
137
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
138
|
-
if (Reflect.construct.sham) return false;
|
|
139
|
-
if (typeof Proxy === "function") return true;
|
|
140
141
|
try {
|
|
141
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
function _create_super(Derived) {
|
|
148
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
149
|
-
return function _createSuperInternal() {
|
|
150
|
-
var Super = _get_prototype_of(Derived), result;
|
|
151
|
-
if (hasNativeReflectConstruct) {
|
|
152
|
-
var NewTarget = _get_prototype_of(this).constructor;
|
|
153
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
154
|
-
} else {
|
|
155
|
-
result = Super.apply(this, arguments);
|
|
156
|
-
}
|
|
157
|
-
return _possible_constructor_return(this, result);
|
|
158
|
-
};
|
|
142
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
143
|
+
} catch (_) {}
|
|
144
|
+
return (_is_native_reflect_construct = function() {
|
|
145
|
+
return !!result;
|
|
146
|
+
})();
|
|
159
147
|
}
|
|
160
148
|
import { isArray, isFunction, isString, isJSONArray, isJSONObject, isNumber, isNumberAndEmptyStringArray, isPlainObject, isStringArray, FieldTypes, isObject } from '@byteluck-fe/model-driven-shared';
|
|
161
149
|
import { AddressValue, AmountValue, CalcValue, RangeDateValue } from '@byteluck-fe/model-driven-core';
|
|
@@ -167,10 +155,9 @@ var ValueChecker = function ValueChecker() {
|
|
|
167
155
|
var StringValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
168
156
|
"use strict";
|
|
169
157
|
_inherits(StringValueChecker, ValueChecker);
|
|
170
|
-
var _super = _create_super(StringValueChecker);
|
|
171
158
|
function StringValueChecker() {
|
|
172
159
|
_class_call_check(this, StringValueChecker);
|
|
173
|
-
return
|
|
160
|
+
return _call_super(this, StringValueChecker, arguments);
|
|
174
161
|
}
|
|
175
162
|
_create_class(StringValueChecker, [
|
|
176
163
|
{
|
|
@@ -200,10 +187,9 @@ var StringValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
200
187
|
var NumberValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
201
188
|
"use strict";
|
|
202
189
|
_inherits(NumberValueChecker, ValueChecker);
|
|
203
|
-
var _super = _create_super(NumberValueChecker);
|
|
204
190
|
function NumberValueChecker() {
|
|
205
191
|
_class_call_check(this, NumberValueChecker);
|
|
206
|
-
return
|
|
192
|
+
return _call_super(this, NumberValueChecker, arguments);
|
|
207
193
|
}
|
|
208
194
|
_create_class(NumberValueChecker, [
|
|
209
195
|
{
|
|
@@ -232,10 +218,9 @@ var NumberValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
232
218
|
var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
233
219
|
"use strict";
|
|
234
220
|
_inherits(StringArrayValueChecker, ValueChecker);
|
|
235
|
-
var _super = _create_super(StringArrayValueChecker);
|
|
236
221
|
function StringArrayValueChecker() {
|
|
237
222
|
_class_call_check(this, StringArrayValueChecker);
|
|
238
|
-
return
|
|
223
|
+
return _call_super(this, StringArrayValueChecker, arguments);
|
|
239
224
|
}
|
|
240
225
|
_create_class(StringArrayValueChecker, [
|
|
241
226
|
{
|
|
@@ -277,10 +262,9 @@ var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
277
262
|
var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
278
263
|
"use strict";
|
|
279
264
|
_inherits(NumberArrayValueChecker, ValueChecker);
|
|
280
|
-
var _super = _create_super(NumberArrayValueChecker);
|
|
281
265
|
function NumberArrayValueChecker() {
|
|
282
266
|
_class_call_check(this, NumberArrayValueChecker);
|
|
283
|
-
return
|
|
267
|
+
return _call_super(this, NumberArrayValueChecker, arguments);
|
|
284
268
|
}
|
|
285
269
|
_create_class(NumberArrayValueChecker, [
|
|
286
270
|
{
|
|
@@ -328,10 +312,9 @@ var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
328
312
|
var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
329
313
|
"use strict";
|
|
330
314
|
_inherits(MoneyValueChecker, ValueChecker);
|
|
331
|
-
var _super = _create_super(MoneyValueChecker);
|
|
332
315
|
function MoneyValueChecker() {
|
|
333
316
|
_class_call_check(this, MoneyValueChecker);
|
|
334
|
-
return
|
|
317
|
+
return _call_super(this, MoneyValueChecker, arguments);
|
|
335
318
|
}
|
|
336
319
|
_create_class(MoneyValueChecker, [
|
|
337
320
|
{
|
|
@@ -379,10 +362,9 @@ var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
379
362
|
var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
380
363
|
"use strict";
|
|
381
364
|
_inherits(TimeScopeValueChecker, ValueChecker);
|
|
382
|
-
var _super = _create_super(TimeScopeValueChecker);
|
|
383
365
|
function TimeScopeValueChecker() {
|
|
384
366
|
_class_call_check(this, TimeScopeValueChecker);
|
|
385
|
-
return
|
|
367
|
+
return _call_super(this, TimeScopeValueChecker, arguments);
|
|
386
368
|
}
|
|
387
369
|
_create_class(TimeScopeValueChecker, [
|
|
388
370
|
{
|
|
@@ -427,10 +409,9 @@ var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
427
409
|
var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
428
410
|
"use strict";
|
|
429
411
|
_inherits(CalcValueChecker, ValueChecker);
|
|
430
|
-
var _super = _create_super(CalcValueChecker);
|
|
431
412
|
function CalcValueChecker() {
|
|
432
413
|
_class_call_check(this, CalcValueChecker);
|
|
433
|
-
return
|
|
414
|
+
return _call_super(this, CalcValueChecker, arguments);
|
|
434
415
|
}
|
|
435
416
|
_create_class(CalcValueChecker, [
|
|
436
417
|
{
|
|
@@ -478,10 +459,9 @@ var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
478
459
|
var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
479
460
|
"use strict";
|
|
480
461
|
_inherits(AddressValueChecker, ValueChecker);
|
|
481
|
-
var _super = _create_super(AddressValueChecker);
|
|
482
462
|
function AddressValueChecker() {
|
|
483
463
|
_class_call_check(this, AddressValueChecker);
|
|
484
|
-
return
|
|
464
|
+
return _call_super(this, AddressValueChecker, arguments);
|
|
485
465
|
}
|
|
486
466
|
_create_class(AddressValueChecker, [
|
|
487
467
|
{
|