@byteluck-fe/model-driven-engine 3.0.0-beta.1 → 3.0.0-beta.10
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 +10 -15
- package/dist/esm/common/DataManager.js +8 -12
- package/dist/esm/common/Engine.js +76 -69
- package/dist/esm/common/Runtime.js +2 -2
- package/dist/esm/common/Store.js +4 -4
- package/dist/esm/common/proxyState.js +18 -18
- package/dist/esm/plugins/CalcPlugin.js +46 -46
- package/dist/esm/plugins/ControlsEventPlugin.js +19 -29
- package/dist/esm/plugins/LifecycleEventPlugin.js +18 -29
- package/dist/esm/plugins/StylePlugin.js +24 -10
- package/dist/index.umd.js +42 -8
- 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 +10 -6
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
|
+
```
|
|
@@ -85,7 +85,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
85
85
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
86
86
|
}
|
|
87
87
|
function _ts_generator(thisArg, body) {
|
|
88
|
-
var f, y, t,
|
|
88
|
+
var f, y, t, _ = {
|
|
89
89
|
label: 0,
|
|
90
90
|
sent: function() {
|
|
91
91
|
if (t[0] & 1) throw t[1];
|
|
@@ -93,12 +93,8 @@ function _ts_generator(thisArg, body) {
|
|
|
93
93
|
},
|
|
94
94
|
trys: [],
|
|
95
95
|
ops: []
|
|
96
|
-
};
|
|
97
|
-
return g = {
|
|
98
|
-
next: verb(0),
|
|
99
|
-
"throw": verb(1),
|
|
100
|
-
"return": verb(2)
|
|
101
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
96
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
97
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
102
98
|
return this;
|
|
103
99
|
}), g;
|
|
104
100
|
function verb(n) {
|
|
@@ -111,7 +107,7 @@ function _ts_generator(thisArg, body) {
|
|
|
111
107
|
}
|
|
112
108
|
function step(op) {
|
|
113
109
|
if (f) throw new TypeError("Generator is already executing.");
|
|
114
|
-
while(_)try {
|
|
110
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
115
111
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
116
112
|
if (y = 0, t) op = [
|
|
117
113
|
op[0] & 2,
|
|
@@ -186,11 +182,11 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
186
182
|
_class_call_check(this, ActionManager);
|
|
187
183
|
_define_property(this, "actionMap", new Map());
|
|
188
184
|
_define_property(this, "buildinActions", {});
|
|
189
|
-
/**
|
|
190
|
-
* 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
|
|
185
|
+
/**
|
|
186
|
+
* 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
|
|
191
187
|
*/ _define_property(this, "actionUtils", {});
|
|
192
|
-
/**
|
|
193
|
-
* 用于存储es module解析出来的源码,CustomVueControlPlugin
|
|
188
|
+
/**
|
|
189
|
+
* 用于存储es module解析出来的源码,CustomVueControlPlugin
|
|
194
190
|
*/ _define_property(this, "sources", {});
|
|
195
191
|
}
|
|
196
192
|
_create_class(ActionManager, [
|
|
@@ -200,13 +196,12 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
200
196
|
for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
201
197
|
args[_key - 2] = arguments[_key];
|
|
202
198
|
}
|
|
203
|
-
var _this = this;
|
|
204
199
|
return _async_to_generator(function() {
|
|
205
200
|
var action, _action_func, result, e;
|
|
206
201
|
return _ts_generator(this, function(_state) {
|
|
207
202
|
switch(_state.label){
|
|
208
203
|
case 0:
|
|
209
|
-
action =
|
|
204
|
+
action = this.actionMap.get(name);
|
|
210
205
|
if (!action) {
|
|
211
206
|
return [
|
|
212
207
|
2
|
|
@@ -248,7 +243,7 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
248
243
|
];
|
|
249
244
|
}
|
|
250
245
|
});
|
|
251
|
-
})();
|
|
246
|
+
}).call(this);
|
|
252
247
|
}
|
|
253
248
|
},
|
|
254
249
|
{
|
|
@@ -60,7 +60,7 @@ function _define_property(obj, key, value) {
|
|
|
60
60
|
return obj;
|
|
61
61
|
}
|
|
62
62
|
function _ts_generator(thisArg, body) {
|
|
63
|
-
var f, y, t,
|
|
63
|
+
var f, y, t, _ = {
|
|
64
64
|
label: 0,
|
|
65
65
|
sent: function() {
|
|
66
66
|
if (t[0] & 1) throw t[1];
|
|
@@ -68,12 +68,8 @@ function _ts_generator(thisArg, body) {
|
|
|
68
68
|
},
|
|
69
69
|
trys: [],
|
|
70
70
|
ops: []
|
|
71
|
-
};
|
|
72
|
-
return g = {
|
|
73
|
-
next: verb(0),
|
|
74
|
-
"throw": verb(1),
|
|
75
|
-
"return": verb(2)
|
|
76
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
71
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
72
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
77
73
|
return this;
|
|
78
74
|
}), g;
|
|
79
75
|
function verb(n) {
|
|
@@ -86,7 +82,7 @@ function _ts_generator(thisArg, body) {
|
|
|
86
82
|
}
|
|
87
83
|
function step(op) {
|
|
88
84
|
if (f) throw new TypeError("Generator is already executing.");
|
|
89
|
-
while(_)try {
|
|
85
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
90
86
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
91
87
|
if (y = 0, t) op = [
|
|
92
88
|
op[0] & 2,
|
|
@@ -186,10 +182,10 @@ export var DataManager = /*#__PURE__*/ function() {
|
|
|
186
182
|
{
|
|
187
183
|
key: "getRemoteData",
|
|
188
184
|
value: function getRemoteData(payload) {
|
|
189
|
-
var _this = this;
|
|
190
185
|
return _async_to_generator(function() {
|
|
191
186
|
return _ts_generator(this, function(_state) {
|
|
192
|
-
if (
|
|
187
|
+
if (this.executer === undefined) {
|
|
188
|
+
// @i18n-translate-ignore
|
|
193
189
|
logerror('未初始化executer');
|
|
194
190
|
return [
|
|
195
191
|
2,
|
|
@@ -198,14 +194,14 @@ export var DataManager = /*#__PURE__*/ function() {
|
|
|
198
194
|
} else {
|
|
199
195
|
return [
|
|
200
196
|
2,
|
|
201
|
-
|
|
197
|
+
this.executer(payload)
|
|
202
198
|
];
|
|
203
199
|
}
|
|
204
200
|
return [
|
|
205
201
|
2
|
|
206
202
|
];
|
|
207
203
|
});
|
|
208
|
-
})();
|
|
204
|
+
}).call(this);
|
|
209
205
|
}
|
|
210
206
|
}
|
|
211
207
|
]);
|
|
@@ -234,7 +234,7 @@ function _is_native_reflect_construct() {
|
|
|
234
234
|
})();
|
|
235
235
|
}
|
|
236
236
|
function _ts_generator(thisArg, body) {
|
|
237
|
-
var f, y, t,
|
|
237
|
+
var f, y, t, _ = {
|
|
238
238
|
label: 0,
|
|
239
239
|
sent: function() {
|
|
240
240
|
if (t[0] & 1) throw t[1];
|
|
@@ -242,12 +242,8 @@ function _ts_generator(thisArg, body) {
|
|
|
242
242
|
},
|
|
243
243
|
trys: [],
|
|
244
244
|
ops: []
|
|
245
|
-
};
|
|
246
|
-
return g = {
|
|
247
|
-
next: verb(0),
|
|
248
|
-
"throw": verb(1),
|
|
249
|
-
"return": verb(2)
|
|
250
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
245
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
246
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
251
247
|
return this;
|
|
252
248
|
}), g;
|
|
253
249
|
function verb(n) {
|
|
@@ -260,7 +256,7 @@ function _ts_generator(thisArg, body) {
|
|
|
260
256
|
}
|
|
261
257
|
function step(op) {
|
|
262
258
|
if (f) throw new TypeError("Generator is already executing.");
|
|
263
|
-
while(_)try {
|
|
259
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
264
260
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
265
261
|
if (y = 0, t) op = [
|
|
266
262
|
op[0] & 2,
|
|
@@ -328,6 +324,7 @@ function _ts_generator(thisArg, body) {
|
|
|
328
324
|
};
|
|
329
325
|
}
|
|
330
326
|
}
|
|
327
|
+
import { getLocaleText } from '@byteluck-fe/locale-message';
|
|
331
328
|
import { isDataBind } from '@byteluck-fe/model-driven-core';
|
|
332
329
|
import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, updateValueFromKeys, warn, Watcher, isBuiltInControls } from '@byteluck-fe/model-driven-shared';
|
|
333
330
|
import { Runtime } from './Runtime';
|
|
@@ -409,6 +406,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
409
406
|
{
|
|
410
407
|
key: "mount",
|
|
411
408
|
value: function mount() {
|
|
409
|
+
// @i18n-translate-ignore
|
|
412
410
|
this.debugLog("engine的mount方法开始调用");
|
|
413
411
|
var _this_$options = this.$options, _this_$options_plugins = _this_$options.plugins, plugins = _this_$options_plugins === void 0 ? [] : _this_$options_plugins;
|
|
414
412
|
this._handlerProxyState();
|
|
@@ -416,6 +414,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
416
414
|
this.applyPlugins();
|
|
417
415
|
// 触发所有控件的默认值的change事件
|
|
418
416
|
this.setStates(this.getState());
|
|
417
|
+
// @i18n-translate-ignore
|
|
419
418
|
this.debugLog("engine的mount方法调用结束");
|
|
420
419
|
if (this.debug && typeof window !== 'undefined') {
|
|
421
420
|
// @ts-ignore
|
|
@@ -790,19 +789,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
790
789
|
3,
|
|
791
790
|
3
|
|
792
791
|
];
|
|
793
|
-
if (
|
|
792
|
+
if (this.isMounted) {
|
|
794
793
|
warn('The engine-mounted life cycle can only be triggered once');
|
|
795
794
|
return [
|
|
796
795
|
2,
|
|
797
796
|
Promise.resolve([])
|
|
798
797
|
];
|
|
799
798
|
}
|
|
800
|
-
if (!
|
|
799
|
+
if (!this._jobTasks.length) return [
|
|
801
800
|
3,
|
|
802
801
|
2
|
|
803
802
|
];
|
|
804
803
|
console.time('engine-mounted need wait');
|
|
805
|
-
needWait = _to_consumable_array(
|
|
804
|
+
needWait = _to_consumable_array(this._jobTasks);
|
|
806
805
|
return [
|
|
807
806
|
4,
|
|
808
807
|
Promise.all(needWait)
|
|
@@ -812,15 +811,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
812
811
|
console.timeEnd('engine-mounted need wait');
|
|
813
812
|
_state.label = 2;
|
|
814
813
|
case 2:
|
|
815
|
-
|
|
814
|
+
this.isMounted = true;
|
|
816
815
|
_state.label = 3;
|
|
817
816
|
case 3:
|
|
818
817
|
// 如果没有挂载的话,需要记录在挂载之前触发的所有任务
|
|
819
|
-
if (!
|
|
818
|
+
if (!this.isMounted) {
|
|
820
819
|
promise = new Promise(function(resolve) {
|
|
821
820
|
promiseResolver = resolve;
|
|
822
821
|
});
|
|
823
|
-
|
|
822
|
+
this._jobTasks.push(promise);
|
|
824
823
|
}
|
|
825
824
|
return [
|
|
826
825
|
4,
|
|
@@ -831,7 +830,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
831
830
|
if (promiseResolver && promise) {
|
|
832
831
|
// 每一个任务完成的时候,都把自己从task中去掉
|
|
833
832
|
promiseResolver();
|
|
834
|
-
|
|
833
|
+
this._jobTasks.splice(this._jobTasks.indexOf(promise), 1);
|
|
835
834
|
}
|
|
836
835
|
return [
|
|
837
836
|
2,
|
|
@@ -839,7 +838,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
839
838
|
];
|
|
840
839
|
}
|
|
841
840
|
});
|
|
842
|
-
})();
|
|
841
|
+
}).call(this);
|
|
843
842
|
}
|
|
844
843
|
},
|
|
845
844
|
{
|
|
@@ -962,9 +961,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
962
961
|
}
|
|
963
962
|
},
|
|
964
963
|
{
|
|
965
|
-
/**
|
|
966
|
-
* 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
|
|
967
|
-
* @param options 需要携带的options
|
|
964
|
+
/**
|
|
965
|
+
* 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
|
|
966
|
+
* @param options 需要携带的options
|
|
968
967
|
* */ key: "setPayloadOptions",
|
|
969
968
|
value: function setPayloadOptions(options) {
|
|
970
969
|
eventOptionsTemp = options;
|
|
@@ -974,16 +973,18 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
974
973
|
key: "setState",
|
|
975
974
|
value: function setState(controlId, value, rowIndex, options) {
|
|
976
975
|
eventOptionsTemp = options;
|
|
976
|
+
// @i18n-translate-ignore
|
|
977
977
|
this.debugLog('[%o]: 触发setState, 修改的值为%o, rowIndex=%o, options=%o', controlId, value, rowIndex, options);
|
|
978
978
|
this.store.setState(controlId, value, rowIndex);
|
|
979
|
+
// @i18n-translate-ignore
|
|
979
980
|
this.debugLog('[%o]: setState完成, 修改的值为%o, rowIndex=%o', controlId, value, rowIndex);
|
|
980
981
|
eventOptionsTemp = null;
|
|
981
982
|
}
|
|
982
983
|
},
|
|
983
984
|
{
|
|
984
|
-
/**
|
|
985
|
-
* 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
|
|
986
|
-
* @param states
|
|
985
|
+
/**
|
|
986
|
+
* 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
|
|
987
|
+
* @param states
|
|
987
988
|
*/ key: "setStates",
|
|
988
989
|
value: function setStates(states, rowIndex, options) {
|
|
989
990
|
var _this = this;
|
|
@@ -1010,11 +1011,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1010
1011
|
}
|
|
1011
1012
|
},
|
|
1012
1013
|
{
|
|
1013
|
-
/**
|
|
1014
|
-
* 通过dataCode和fieldCode来获取控件的值
|
|
1015
|
-
* @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
|
|
1016
|
-
* @param fieldCode 字段编码 - 控件绑定的数据项的编码
|
|
1017
|
-
* @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
|
|
1014
|
+
/**
|
|
1015
|
+
* 通过dataCode和fieldCode来获取控件的值
|
|
1016
|
+
* @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
|
|
1017
|
+
* @param fieldCode 字段编码 - 控件绑定的数据项的编码
|
|
1018
|
+
* @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
|
|
1018
1019
|
* */ key: "getField",
|
|
1019
1020
|
value: function getField(dataCode, fieldCode, rowIndex) {
|
|
1020
1021
|
if (!fieldCode) {
|
|
@@ -1129,13 +1130,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1129
1130
|
}
|
|
1130
1131
|
},
|
|
1131
1132
|
{
|
|
1132
|
-
/**
|
|
1133
|
-
* 通过dataCode和fieldCode来设置控件的值
|
|
1134
|
-
* @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
|
|
1135
|
-
* @param fieldCode 字段编码 - 控件绑定的数据项的编码
|
|
1136
|
-
* @param value 修改的值
|
|
1137
|
-
* @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
|
|
1138
|
-
* @param options 触发事件携带的参数
|
|
1133
|
+
/**
|
|
1134
|
+
* 通过dataCode和fieldCode来设置控件的值
|
|
1135
|
+
* @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
|
|
1136
|
+
* @param fieldCode 字段编码 - 控件绑定的数据项的编码
|
|
1137
|
+
* @param value 修改的值
|
|
1138
|
+
* @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
|
|
1139
|
+
* @param options 触发事件携带的参数
|
|
1139
1140
|
* */ key: "setField",
|
|
1140
1141
|
value: function setField(dataCode, fieldCode, value, rowIndex, options) {
|
|
1141
1142
|
var dataBindMapping = this.getDataBindMapping(dataCode, fieldCode);
|
|
@@ -1163,12 +1164,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1163
1164
|
}
|
|
1164
1165
|
},
|
|
1165
1166
|
{
|
|
1166
|
-
/**
|
|
1167
|
-
* 通过dataCode和 state来给一组控件赋值,并触发事件携带options
|
|
1168
|
-
* @param dataCode 需要赋值的目标模型
|
|
1169
|
-
* @param state 赋值对象,以fieldCode为key组成的对象
|
|
1170
|
-
* @param rowIndex 行下标,给明细子表赋值时指定赋值某行
|
|
1171
|
-
* @param options 触发事件携带的参数
|
|
1167
|
+
/**
|
|
1168
|
+
* 通过dataCode和 state来给一组控件赋值,并触发事件携带options
|
|
1169
|
+
* @param dataCode 需要赋值的目标模型
|
|
1170
|
+
* @param state 赋值对象,以fieldCode为key组成的对象
|
|
1171
|
+
* @param rowIndex 行下标,给明细子表赋值时指定赋值某行
|
|
1172
|
+
* @param options 触发事件携带的参数
|
|
1172
1173
|
* */ key: "setFields",
|
|
1173
1174
|
value: function setFields(dataCode, state, rowIndex, options) {
|
|
1174
1175
|
var _this = this;
|
|
@@ -1209,10 +1210,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1209
1210
|
}
|
|
1210
1211
|
},
|
|
1211
1212
|
{
|
|
1212
|
-
/**
|
|
1213
|
-
* 通过dataCode来将state转化为标准的state结构
|
|
1214
|
-
* @param dataCode 需要转换的目标模型code
|
|
1215
|
-
* @param state 值对象,以fieldCode为key组成的对象
|
|
1213
|
+
/**
|
|
1214
|
+
* 通过dataCode来将state转化为标准的state结构
|
|
1215
|
+
* @param dataCode 需要转换的目标模型code
|
|
1216
|
+
* @param state 值对象,以fieldCode为key组成的对象
|
|
1216
1217
|
* */ key: "buildFields",
|
|
1217
1218
|
value: function buildFields(dataCode, state) {
|
|
1218
1219
|
var _this = this;
|
|
@@ -1253,13 +1254,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1253
1254
|
}
|
|
1254
1255
|
},
|
|
1255
1256
|
{
|
|
1256
|
-
/**
|
|
1257
|
-
* 向Store设置一组值,并触发事件携带options
|
|
1258
|
-
* @param dataSet
|
|
1259
|
-
* @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
|
|
1257
|
+
/**
|
|
1258
|
+
* 向Store设置一组值,并触发事件携带options
|
|
1259
|
+
* @param dataSet
|
|
1260
|
+
* @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
|
|
1260
1261
|
*/ key: "setData",
|
|
1261
1262
|
value: function setData(dataSet, options) {
|
|
1262
1263
|
var _this = this;
|
|
1264
|
+
// @i18n-translate-ignore
|
|
1263
1265
|
this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
|
|
1264
1266
|
var onlySetData = options === null || options === void 0 ? void 0 : options.onlySetData;
|
|
1265
1267
|
var newState = this.store.defaultState;
|
|
@@ -1381,32 +1383,35 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1381
1383
|
}
|
|
1382
1384
|
}
|
|
1383
1385
|
});
|
|
1386
|
+
// @i18n-translate-ignore
|
|
1384
1387
|
_this.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
|
|
1385
1388
|
}
|
|
1386
1389
|
}
|
|
1387
1390
|
});
|
|
1391
|
+
// @i18n-translate-ignore
|
|
1388
1392
|
this.debugLog("engine setData方法数据组合完成,参数为%o。", newState);
|
|
1389
1393
|
this.setStates(newState, undefined, _object_spread({
|
|
1390
1394
|
setData: true
|
|
1391
1395
|
}, options));
|
|
1392
1396
|
this.runtime.getFlatInstances();
|
|
1393
|
-
|
|
1397
|
+
// @i18n-translate-ignore
|
|
1398
|
+
this.debugLog(getLocaleText('CMD.b44b1751969061759'));
|
|
1394
1399
|
}
|
|
1395
1400
|
},
|
|
1396
1401
|
{
|
|
1397
|
-
/**
|
|
1398
|
-
* 获取控件的dataBind
|
|
1399
|
-
* @param controlId
|
|
1402
|
+
/**
|
|
1403
|
+
* 获取控件的dataBind
|
|
1404
|
+
* @param controlId
|
|
1400
1405
|
* */ key: "getDataBind",
|
|
1401
1406
|
value: function getDataBind(controlId) {
|
|
1402
1407
|
return this.store.getDataBind(controlId);
|
|
1403
1408
|
}
|
|
1404
1409
|
},
|
|
1405
1410
|
{
|
|
1406
|
-
/**
|
|
1407
|
-
* 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
|
|
1408
|
-
* @param controlId
|
|
1409
|
-
* @param rowIndex
|
|
1411
|
+
/**
|
|
1412
|
+
* 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
|
|
1413
|
+
* @param controlId
|
|
1414
|
+
* @param rowIndex
|
|
1410
1415
|
*/ key: "getInstance",
|
|
1411
1416
|
value: function getInstance(controlId, rowIndex) {
|
|
1412
1417
|
var instances = this.getInstances(controlId, rowIndex === -1);
|
|
@@ -1425,10 +1430,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1425
1430
|
}
|
|
1426
1431
|
},
|
|
1427
1432
|
{
|
|
1428
|
-
/**
|
|
1429
|
-
* 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
|
|
1430
|
-
* @param controlId
|
|
1431
|
-
* @param header 明细表内是否获取表头的控件
|
|
1433
|
+
/**
|
|
1434
|
+
* 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
|
|
1435
|
+
* @param controlId
|
|
1436
|
+
* @param header 明细表内是否获取表头的控件
|
|
1432
1437
|
*/ // getInstances(
|
|
1433
1438
|
// controlId?: string,
|
|
1434
1439
|
// header: boolean = false
|
|
@@ -1520,6 +1525,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1520
1525
|
var instances = this.getInstances(instance, rowIndex === -1);
|
|
1521
1526
|
instances.map(function(_instance) {
|
|
1522
1527
|
if (_instance) {
|
|
1528
|
+
// @i18n-translate-ignore
|
|
1523
1529
|
_this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
|
|
1524
1530
|
updateValueFromKeys(_instance.props, props, value);
|
|
1525
1531
|
_this.schemaEvent('schema-change', {
|
|
@@ -1540,6 +1546,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1540
1546
|
if (!_instance) {
|
|
1541
1547
|
return;
|
|
1542
1548
|
}
|
|
1549
|
+
// @i18n-translate-ignore
|
|
1543
1550
|
this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
|
|
1544
1551
|
updateValueFromKeys(_instance.props, props, value);
|
|
1545
1552
|
this.schemaEvent('schema-change', {
|
|
@@ -1604,27 +1611,27 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1604
1611
|
},
|
|
1605
1612
|
{
|
|
1606
1613
|
key: "assertInstance",
|
|
1607
|
-
value: /**
|
|
1608
|
-
* 判断控件的类型,返回当前控件的正确类型
|
|
1614
|
+
value: /**
|
|
1615
|
+
* 判断控件的类型,返回当前控件的正确类型
|
|
1609
1616
|
* */ function assertInstance(instance, types) {
|
|
1610
1617
|
return isString(types) ? instance.type === types : types.includes(instance.type);
|
|
1611
1618
|
}
|
|
1612
1619
|
},
|
|
1613
1620
|
{
|
|
1614
1621
|
key: "assertInstanceIsCustomControl",
|
|
1615
|
-
value: /**
|
|
1616
|
-
* 判断控件或控件类型是一个自定义控件
|
|
1622
|
+
value: /**
|
|
1623
|
+
* 判断控件或控件类型是一个自定义控件
|
|
1617
1624
|
* */ function assertInstanceIsCustomControl(instance) {
|
|
1618
1625
|
return !isBuiltInControls(isString(instance) ? instance : instance.type);
|
|
1619
1626
|
}
|
|
1620
1627
|
},
|
|
1621
1628
|
{
|
|
1622
1629
|
key: "getInstanceRowIndex",
|
|
1623
|
-
value: /**
|
|
1624
|
-
* 获取控件在明细子表中的行下标,
|
|
1625
|
-
* 如果控件在表头内,则返回-1
|
|
1626
|
-
* 如果控件在表内,则返回行下标
|
|
1627
|
-
* 如果控件不在明细表内,则返回undefined
|
|
1630
|
+
value: /**
|
|
1631
|
+
* 获取控件在明细子表中的行下标,
|
|
1632
|
+
* 如果控件在表头内,则返回-1
|
|
1633
|
+
* 如果控件在表内,则返回行下标
|
|
1634
|
+
* 如果控件不在明细表内,则返回undefined
|
|
1628
1635
|
* */ // public getInstanceRowIndex(
|
|
1629
1636
|
// instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
|
|
1630
1637
|
// ) {
|
|
@@ -289,8 +289,8 @@ function loop(control, parentId, callback) {
|
|
|
289
289
|
function hasHeaderOrFooterControl(control, checkType) {
|
|
290
290
|
return checkType in control.props && isArray(control.props[checkType]);
|
|
291
291
|
}
|
|
292
|
-
/**
|
|
293
|
-
* 控件是否在视图中隐藏,遍历查找所有parent
|
|
292
|
+
/**
|
|
293
|
+
* 控件是否在视图中隐藏,遍历查找所有parent
|
|
294
294
|
* */ function getControlIsHide(control) {
|
|
295
295
|
if (control.props.isHide) {
|
|
296
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;
|
|
@@ -105,11 +105,11 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
/**
|
|
109
|
-
* 返回proxy操作对象
|
|
110
|
-
* @param thisKey 当前对象在上级中的key
|
|
111
|
-
* @param callback 需要在修改的时候,触发的回调函数
|
|
112
|
-
* @param beforeSetCallback 需要在修改之前触发的回调函数,可以进行校验和对值的修改等等,最终的返回值不为undefined就会使用
|
|
108
|
+
/**
|
|
109
|
+
* 返回proxy操作对象
|
|
110
|
+
* @param thisKey 当前对象在上级中的key
|
|
111
|
+
* @param callback 需要在修改的时候,触发的回调函数
|
|
112
|
+
* @param beforeSetCallback 需要在修改之前触发的回调函数,可以进行校验和对值的修改等等,最终的返回值不为undefined就会使用
|
|
113
113
|
* */ function handler(thisKey, callback, beforeSetCallback) {
|
|
114
114
|
return {
|
|
115
115
|
__engineProxy__: true,
|
|
@@ -183,12 +183,12 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
|
|
|
183
183
|
}
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
-
/**
|
|
187
|
-
* 代理state数据
|
|
188
|
-
* @param state 数据对象
|
|
189
|
-
* @param callback 触发set时候的回调函数
|
|
190
|
-
* @param beforeSetCallback
|
|
191
|
-
* @param prevKey 递归对象的key
|
|
186
|
+
/**
|
|
187
|
+
* 代理state数据
|
|
188
|
+
* @param state 数据对象
|
|
189
|
+
* @param callback 触发set时候的回调函数
|
|
190
|
+
* @param beforeSetCallback
|
|
191
|
+
* @param prevKey 递归对象的key
|
|
192
192
|
* */ export function proxyState(state, callback, beforeSetCallback) {
|
|
193
193
|
var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : '';
|
|
194
194
|
// 冻结的对象不需要再执行proxy,否则会报错
|
|
@@ -216,10 +216,10 @@ function flatInstanceForChildren(controls) {
|
|
|
216
216
|
});
|
|
217
217
|
return result;
|
|
218
218
|
}
|
|
219
|
-
/**
|
|
220
|
-
* 在flatInstance中通过key查找出对应的instance
|
|
221
|
-
* @param flatInstance 拍平的instance数组
|
|
222
|
-
* @param key 操作的数据在state的key - 可以是深层次的 subtable.0.input等
|
|
219
|
+
/**
|
|
220
|
+
* 在flatInstance中通过key查找出对应的instance
|
|
221
|
+
* @param flatInstance 拍平的instance数组
|
|
222
|
+
* @param key 操作的数据在state的key - 可以是深层次的 subtable.0.input等
|
|
223
223
|
* */ export function findItem(flatInstance, key, instanceMap) {
|
|
224
224
|
if (key === '') return undefined;
|
|
225
225
|
var keys = key.split('.');
|
|
@@ -276,9 +276,9 @@ function getArrayNewArgs(type, args, value) {
|
|
|
276
276
|
return args.slice(0, 2).concat(value);
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
/**
|
|
280
|
-
* TODO 数组劫持操作需要模仿vue3进行重构,不再直接劫持原生property
|
|
281
|
-
* 劫持数组api,达到操作数组api的时候,可以同步操作instance
|
|
279
|
+
/**
|
|
280
|
+
* TODO 数组劫持操作需要模仿vue3进行重构,不再直接劫持原生property
|
|
281
|
+
* 劫持数组api,达到操作数组api的时候,可以同步操作instance
|
|
282
282
|
* */ function hijackArrayProperty() {
|
|
283
283
|
proxyArrayApi.forEach(function(key) {
|
|
284
284
|
var oldApiHandler = Array.prototype[key];
|