@byteluck-fe/model-driven-engine 2.7.0-alpha.15b → 2.7.0-alpha.15c
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/dist/esm/common/ActionManager.js +173 -56
- package/dist/esm/common/DataManager.js +134 -25
- package/dist/esm/common/Engine.js +405 -273
- package/dist/esm/common/OkWorker.js +31 -17
- package/dist/esm/common/Plugin.js +2 -2
- package/dist/esm/common/Runtime.js +54 -39
- package/dist/esm/common/Store.js +61 -59
- package/dist/esm/common/checkerValue.js +112 -110
- package/dist/esm/common/index.js +2 -2
- package/dist/esm/common/proxyState.js +61 -60
- package/dist/esm/index.js +3 -3
- package/dist/esm/plugins/CalcPlugin.js +86 -77
- package/dist/esm/plugins/ControlsEventPlugin.js +196 -73
- package/dist/esm/plugins/ES6ModulePlugin.js +37 -21
- package/dist/esm/plugins/LifecycleEventPlugin.js +198 -79
- package/dist/esm/plugins/StylePlugin.js +26 -11
- package/dist/esm/plugins/index.js +5 -5
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/runtimeUtils.js +7 -7
- package/dist/index.umd.js +8 -8
- package/dist/types/common/Engine.d.ts +6 -6
- package/dist/types/common/Runtime.d.ts +1 -1
- package/dist/types/common/Store.d.ts +5 -5
- package/dist/types/common/proxyState.d.ts +3 -3
- package/dist/types/plugins/ControlsEventPlugin.d.ts +1 -1
- package/dist/types/plugins/ES6ModulePlugin.d.ts +4 -4
- package/dist/types/plugins/LifecycleEventPlugin.d.ts +1 -1
- package/dist/types/plugins/StylePlugin.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
2
|
if (len == null || len > arr.length) len = arr.length;
|
|
3
3
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
4
|
return arr2;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (Array.isArray(arr)) return
|
|
9
|
+
function _array_without_holes(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function _assert_this_initialized(self) {
|
|
13
13
|
if (self === void 0) {
|
|
14
14
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
15
15
|
}
|
|
@@ -29,7 +29,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
29
29
|
Promise.resolve(value).then(_next, _throw);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function _async_to_generator(fn) {
|
|
33
33
|
return function() {
|
|
34
34
|
var self = this, args = arguments;
|
|
35
35
|
return new Promise(function(resolve, reject) {
|
|
@@ -44,7 +44,7 @@ function _asyncToGenerator(fn) {
|
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function _class_call_check(instance, Constructor) {
|
|
48
48
|
if (!(instance instanceof Constructor)) {
|
|
49
49
|
throw new TypeError("Cannot call a class as a function");
|
|
50
50
|
}
|
|
@@ -58,12 +58,12 @@ function _defineProperties(target, props) {
|
|
|
58
58
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
62
62
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
63
63
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
64
64
|
return Constructor;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function _define_property(obj, key, value) {
|
|
67
67
|
if (key in obj) {
|
|
68
68
|
Object.defineProperty(obj, key, {
|
|
69
69
|
value: value,
|
|
@@ -80,23 +80,23 @@ function _get(target, property, receiver) {
|
|
|
80
80
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
81
81
|
_get = Reflect.get;
|
|
82
82
|
} else {
|
|
83
|
-
_get = function
|
|
84
|
-
var base =
|
|
83
|
+
_get = function get(target, property, receiver) {
|
|
84
|
+
var base = _super_prop_base(target, property);
|
|
85
85
|
if (!base) return;
|
|
86
86
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
87
87
|
if (desc.get) {
|
|
88
|
-
return desc.get.call(receiver);
|
|
88
|
+
return desc.get.call(receiver || target);
|
|
89
89
|
}
|
|
90
90
|
return desc.value;
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
return _get(target, property, receiver || target);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
|
|
95
|
+
function _get_prototype_of(o) {
|
|
96
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
97
97
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
98
98
|
};
|
|
99
|
-
return
|
|
99
|
+
return _get_prototype_of(o);
|
|
100
100
|
}
|
|
101
101
|
function _inherits(subClass, superClass) {
|
|
102
102
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -109,12 +109,12 @@ function _inherits(subClass, superClass) {
|
|
|
109
109
|
configurable: true
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
|
-
if (superClass)
|
|
112
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function _iterable_to_array(iter) {
|
|
115
115
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function _iterable_to_array_limit(arr, i) {
|
|
118
118
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
119
119
|
if (_i == null) return;
|
|
120
120
|
var _arr = [];
|
|
@@ -138,13 +138,13 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
138
138
|
}
|
|
139
139
|
return _arr;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function _non_iterable_rest() {
|
|
142
142
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function _non_iterable_spread() {
|
|
145
145
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function _object_spread(target) {
|
|
148
148
|
for(var i = 1; i < arguments.length; i++){
|
|
149
149
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
150
150
|
var ownKeys = Object.keys(source);
|
|
@@ -154,50 +154,74 @@ function _objectSpread(target) {
|
|
|
154
154
|
}));
|
|
155
155
|
}
|
|
156
156
|
ownKeys.forEach(function(key) {
|
|
157
|
-
|
|
157
|
+
_define_property(target, key, source[key]);
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
return target;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
|
|
162
|
+
function ownKeys(object, enumerableOnly) {
|
|
163
|
+
var keys = Object.keys(object);
|
|
164
|
+
if (Object.getOwnPropertySymbols) {
|
|
165
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
166
|
+
if (enumerableOnly) {
|
|
167
|
+
symbols = symbols.filter(function(sym) {
|
|
168
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
keys.push.apply(keys, symbols);
|
|
172
|
+
}
|
|
173
|
+
return keys;
|
|
174
|
+
}
|
|
175
|
+
function _object_spread_props(target, source) {
|
|
176
|
+
source = source != null ? source : {};
|
|
177
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
178
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
179
|
+
} else {
|
|
180
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
181
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
return target;
|
|
185
|
+
}
|
|
186
|
+
function _possible_constructor_return(self, call) {
|
|
187
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
164
188
|
return call;
|
|
165
189
|
}
|
|
166
|
-
return
|
|
190
|
+
return _assert_this_initialized(self);
|
|
167
191
|
}
|
|
168
|
-
function
|
|
169
|
-
|
|
192
|
+
function _set_prototype_of(o, p) {
|
|
193
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
170
194
|
o.__proto__ = p;
|
|
171
195
|
return o;
|
|
172
196
|
};
|
|
173
|
-
return
|
|
197
|
+
return _set_prototype_of(o, p);
|
|
174
198
|
}
|
|
175
|
-
function
|
|
176
|
-
return
|
|
199
|
+
function _sliced_to_array(arr, i) {
|
|
200
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
177
201
|
}
|
|
178
|
-
function
|
|
202
|
+
function _super_prop_base(object, property) {
|
|
179
203
|
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
180
|
-
object =
|
|
204
|
+
object = _get_prototype_of(object);
|
|
181
205
|
if (object === null) break;
|
|
182
206
|
}
|
|
183
207
|
return object;
|
|
184
208
|
}
|
|
185
|
-
function
|
|
186
|
-
return
|
|
209
|
+
function _to_consumable_array(arr) {
|
|
210
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
187
211
|
}
|
|
188
|
-
|
|
212
|
+
function _type_of(obj) {
|
|
189
213
|
"@swc/helpers - typeof";
|
|
190
214
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
191
|
-
}
|
|
192
|
-
function
|
|
215
|
+
}
|
|
216
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
193
217
|
if (!o) return;
|
|
194
|
-
if (typeof o === "string") return
|
|
218
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
195
219
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
196
220
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
197
221
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
198
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
222
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
199
223
|
}
|
|
200
|
-
function
|
|
224
|
+
function _is_native_reflect_construct() {
|
|
201
225
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
202
226
|
if (Reflect.construct.sham) return false;
|
|
203
227
|
if (typeof Proxy === "function") return true;
|
|
@@ -208,57 +232,160 @@ function _isNativeReflectConstruct() {
|
|
|
208
232
|
return false;
|
|
209
233
|
}
|
|
210
234
|
}
|
|
211
|
-
function
|
|
212
|
-
var hasNativeReflectConstruct =
|
|
235
|
+
function _create_super(Derived) {
|
|
236
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
213
237
|
return function _createSuperInternal() {
|
|
214
|
-
var Super =
|
|
238
|
+
var Super = _get_prototype_of(Derived), result;
|
|
215
239
|
if (hasNativeReflectConstruct) {
|
|
216
|
-
var NewTarget =
|
|
240
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
217
241
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
218
242
|
} else {
|
|
219
243
|
result = Super.apply(this, arguments);
|
|
220
244
|
}
|
|
221
|
-
return
|
|
245
|
+
return _possible_constructor_return(this, result);
|
|
222
246
|
};
|
|
223
247
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
248
|
+
function _ts_generator(thisArg, body) {
|
|
249
|
+
var f, y, t, g, _ = {
|
|
250
|
+
label: 0,
|
|
251
|
+
sent: function() {
|
|
252
|
+
if (t[0] & 1) throw t[1];
|
|
253
|
+
return t[1];
|
|
254
|
+
},
|
|
255
|
+
trys: [],
|
|
256
|
+
ops: []
|
|
257
|
+
};
|
|
258
|
+
return g = {
|
|
259
|
+
next: verb(0),
|
|
260
|
+
"throw": verb(1),
|
|
261
|
+
"return": verb(2)
|
|
262
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
263
|
+
return this;
|
|
264
|
+
}), g;
|
|
265
|
+
function verb(n) {
|
|
266
|
+
return function(v) {
|
|
267
|
+
return step([
|
|
268
|
+
n,
|
|
269
|
+
v
|
|
270
|
+
]);
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function step(op) {
|
|
274
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
275
|
+
while(_)try {
|
|
276
|
+
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;
|
|
277
|
+
if (y = 0, t) op = [
|
|
278
|
+
op[0] & 2,
|
|
279
|
+
t.value
|
|
280
|
+
];
|
|
281
|
+
switch(op[0]){
|
|
282
|
+
case 0:
|
|
283
|
+
case 1:
|
|
284
|
+
t = op;
|
|
285
|
+
break;
|
|
286
|
+
case 4:
|
|
287
|
+
_.label++;
|
|
288
|
+
return {
|
|
289
|
+
value: op[1],
|
|
290
|
+
done: false
|
|
291
|
+
};
|
|
292
|
+
case 5:
|
|
293
|
+
_.label++;
|
|
294
|
+
y = op[1];
|
|
295
|
+
op = [
|
|
296
|
+
0
|
|
297
|
+
];
|
|
298
|
+
continue;
|
|
299
|
+
case 7:
|
|
300
|
+
op = _.ops.pop();
|
|
301
|
+
_.trys.pop();
|
|
302
|
+
continue;
|
|
303
|
+
default:
|
|
304
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
305
|
+
_ = 0;
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
309
|
+
_.label = op[1];
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
313
|
+
_.label = t[1];
|
|
314
|
+
t = op;
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
if (t && _.label < t[2]) {
|
|
318
|
+
_.label = t[2];
|
|
319
|
+
_.ops.push(op);
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
if (t[2]) _.ops.pop();
|
|
323
|
+
_.trys.pop();
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
op = body.call(thisArg, _);
|
|
327
|
+
} catch (e) {
|
|
328
|
+
op = [
|
|
329
|
+
6,
|
|
330
|
+
e
|
|
331
|
+
];
|
|
332
|
+
y = 0;
|
|
333
|
+
} finally{
|
|
334
|
+
f = t = 0;
|
|
335
|
+
}
|
|
336
|
+
if (op[0] & 5) throw op[1];
|
|
337
|
+
return {
|
|
338
|
+
value: op[0] ? op[1] : void 0,
|
|
339
|
+
done: true
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
import { isDataBind } from "@byteluck-fe/model-driven-core";
|
|
344
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
|
|
345
|
+
import { Runtime } from "./Runtime";
|
|
346
|
+
import { Store } from "./Store";
|
|
347
|
+
import { findItem, proxyState } from "./proxyState";
|
|
348
|
+
import { ActionManager } from "./ActionManager";
|
|
349
|
+
import { DataManager } from "./DataManager";
|
|
350
|
+
import { checkerSubtableValue, checkerValue } from "./checkerValue";
|
|
351
|
+
if (typeof window !== "undefined") {
|
|
234
352
|
// @ts-ignore
|
|
235
353
|
window.engines = {};
|
|
236
354
|
}
|
|
237
355
|
// setState的时候,存储options中转变量
|
|
238
356
|
var eventOptionsTemp = null;
|
|
239
357
|
// 当前正在注册的插件名称
|
|
240
|
-
var applyingPluginName =
|
|
241
|
-
|
|
242
|
-
/*#__PURE__*/ function(
|
|
358
|
+
var applyingPluginName = "";
|
|
359
|
+
// 整体渲染引擎 并且 提供发布订阅能力
|
|
360
|
+
var Engine = /*#__PURE__*/ function(Watcher) {
|
|
243
361
|
"use strict";
|
|
244
|
-
_inherits(Engine,
|
|
245
|
-
var _super =
|
|
362
|
+
_inherits(Engine, Watcher);
|
|
363
|
+
var _super = _create_super(Engine);
|
|
246
364
|
function Engine(props) {
|
|
247
|
-
|
|
365
|
+
_class_call_check(this, Engine);
|
|
248
366
|
var _this;
|
|
249
367
|
_this = _super.call(this);
|
|
250
|
-
_this
|
|
368
|
+
_define_property(_assert_this_initialized(_this), "store", void 0);
|
|
369
|
+
_define_property(_assert_this_initialized(_this), "rawStore", {});
|
|
370
|
+
_define_property(_assert_this_initialized(_this), "parent", void 0);
|
|
371
|
+
// 提供注册运行态控件以及实例化控件的能力
|
|
372
|
+
_define_property(_assert_this_initialized(_this), "runtime", void 0);
|
|
251
373
|
// 提供子线程处理脚本以及修改数据的能力
|
|
252
374
|
// public worker: OkWorker
|
|
253
|
-
_this
|
|
254
|
-
_this
|
|
255
|
-
_this
|
|
256
|
-
|
|
257
|
-
_this
|
|
258
|
-
_this
|
|
375
|
+
_define_property(_assert_this_initialized(_this), "isMounted", false);
|
|
376
|
+
_define_property(_assert_this_initialized(_this), "id", genNonDuplicateId(8));
|
|
377
|
+
_define_property(_assert_this_initialized(_this), "externalParams", void 0);
|
|
378
|
+
// 提供外部注册插件,在不同的hooks触发时执行固定函数的能力
|
|
379
|
+
_define_property(_assert_this_initialized(_this), "__plugins", void 0);
|
|
380
|
+
_define_property(_assert_this_initialized(_this), "__pluginsApplied", false);
|
|
381
|
+
_define_property(_assert_this_initialized(_this), "$options", void 0);
|
|
382
|
+
_define_property(_assert_this_initialized(_this), "actionManager", new ActionManager());
|
|
383
|
+
_define_property(_assert_this_initialized(_this), "dataManager", void 0);
|
|
384
|
+
_define_property(_assert_this_initialized(_this), "_jobTasks", []);
|
|
385
|
+
_define_property(_assert_this_initialized(_this), "createControlInstance", _this.createInstance);
|
|
259
386
|
_this.$options = Object.freeze(props);
|
|
260
|
-
var
|
|
261
|
-
language, language =
|
|
387
|
+
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,
|
|
388
|
+
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;
|
|
262
389
|
RulesMessage.setLocale(language);
|
|
263
390
|
_this.debug = debug;
|
|
264
391
|
_this.runtime = new Runtime({
|
|
@@ -269,19 +396,19 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
269
396
|
_this.store = new Store({
|
|
270
397
|
instance: _this.runtime.instance
|
|
271
398
|
});
|
|
272
|
-
_this.debugLog(
|
|
399
|
+
_this.debugLog("engine is Instantiation complete");
|
|
273
400
|
// 自动执行挂载完成,也可以手动调用mount方法
|
|
274
401
|
autoMount && _this.mount();
|
|
275
402
|
return _this;
|
|
276
403
|
}
|
|
277
|
-
|
|
404
|
+
_create_class(Engine, [
|
|
278
405
|
{
|
|
279
406
|
key: "debugLog",
|
|
280
407
|
value: function debugLog() {
|
|
281
408
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
282
409
|
args[_key] = arguments[_key];
|
|
283
410
|
}
|
|
284
|
-
this.debug && log.apply(void 0,
|
|
411
|
+
this.debug && log.apply(void 0, _to_consumable_array(args));
|
|
285
412
|
}
|
|
286
413
|
},
|
|
287
414
|
{
|
|
@@ -300,8 +427,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
300
427
|
for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
|
|
301
428
|
arg[_key] = arguments[_key];
|
|
302
429
|
}
|
|
303
|
-
var
|
|
304
|
-
(
|
|
430
|
+
var _this_runtime;
|
|
431
|
+
(_this_runtime = this.runtime).register.apply(_this_runtime, _to_consumable_array(arg));
|
|
305
432
|
return this;
|
|
306
433
|
}
|
|
307
434
|
},
|
|
@@ -309,14 +436,14 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
309
436
|
key: "mount",
|
|
310
437
|
value: function mount() {
|
|
311
438
|
this.debugLog("engine的mount方法开始调用");
|
|
312
|
-
var
|
|
439
|
+
var _this_$options = this.$options, _this_$options_plugins = _this_$options.plugins, plugins = _this_$options_plugins === void 0 ? [] : _this_$options_plugins;
|
|
313
440
|
this._handlerProxyState();
|
|
314
441
|
this.__plugins = plugins;
|
|
315
442
|
this.applyPlugins();
|
|
316
443
|
// 触发所有控件的默认值的change事件
|
|
317
444
|
this.setStates(this.getState());
|
|
318
445
|
this.debugLog("engine的mount方法调用结束");
|
|
319
|
-
if (this.debug && typeof window !==
|
|
446
|
+
if (this.debug && typeof window !== "undefined") {
|
|
320
447
|
// @ts-ignore
|
|
321
448
|
window.engines[this.id] = this;
|
|
322
449
|
}
|
|
@@ -325,7 +452,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
325
452
|
{
|
|
326
453
|
key: "destroy",
|
|
327
454
|
value: function destroy() {
|
|
328
|
-
if (this.debug && typeof window !==
|
|
455
|
+
if (this.debug && typeof window !== "undefined") {
|
|
329
456
|
// @ts-ignore
|
|
330
457
|
delete window.engines[this.id];
|
|
331
458
|
}
|
|
@@ -347,7 +474,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
347
474
|
}
|
|
348
475
|
// @ts-ignore
|
|
349
476
|
if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE)) {
|
|
350
|
-
var
|
|
477
|
+
var _newValue;
|
|
351
478
|
if (newValue === null) {
|
|
352
479
|
return [];
|
|
353
480
|
}
|
|
@@ -362,12 +489,12 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
362
489
|
}, {});
|
|
363
490
|
// @ts-ignore
|
|
364
491
|
var emptyState = this.getEmptyState(instance.id);
|
|
365
|
-
return (
|
|
366
|
-
// @ts-ignore
|
|
367
|
-
|
|
492
|
+
return (_newValue = newValue) === null || _newValue === void 0 ? void 0 : _newValue.map(function(row) {
|
|
493
|
+
return(// @ts-ignore
|
|
494
|
+
checkerSubtableValue(fieldTypeMap, row, emptyState));
|
|
368
495
|
});
|
|
369
496
|
}
|
|
370
|
-
var keys = key.split(
|
|
497
|
+
var keys = key.split(".");
|
|
371
498
|
var lastKey = keys[keys.length - 1];
|
|
372
499
|
try {
|
|
373
500
|
return checkerValue(instance.fieldType, lastKey, newValue, oldValue);
|
|
@@ -391,16 +518,17 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
391
518
|
key: "_handlerArrayUpdate",
|
|
392
519
|
value: function _handlerArrayUpdate(state, key, type, args, result) {
|
|
393
520
|
var _this = this;
|
|
521
|
+
var _subtable;
|
|
394
522
|
var subtable = findItem(this.runtime.flatInstances, key, this.runtime.instanceMap);
|
|
395
523
|
// if (!(subtable instanceof RuntimeListControl)) return
|
|
396
|
-
if (!((subtable === null ||
|
|
524
|
+
if (!(((_subtable = subtable) === null || _subtable === void 0 ? void 0 : _subtable.controlType) === CONTROL_BASE_TYPE.LIST)) return;
|
|
397
525
|
// 新增多行方法
|
|
398
526
|
var createRows = function(len) {
|
|
399
527
|
// @ts-ignore
|
|
400
528
|
var newRows = [];
|
|
401
529
|
for(var i = 0; i < len; i++){
|
|
402
530
|
// @ts-ignore
|
|
403
|
-
var row = _this.listControlCreateRow(subtable,
|
|
531
|
+
var row = _this.listControlCreateRow(subtable, "subtable-row");
|
|
404
532
|
row && newRows.push(row);
|
|
405
533
|
}
|
|
406
534
|
// @ts-ignore
|
|
@@ -415,19 +543,19 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
415
543
|
if (type && args) {
|
|
416
544
|
// const subtableOldLength = subtable.children.length
|
|
417
545
|
switch(type){
|
|
418
|
-
case
|
|
419
|
-
case
|
|
420
|
-
var
|
|
546
|
+
case "push":
|
|
547
|
+
case "unshift":
|
|
548
|
+
var _subtable_children;
|
|
421
549
|
var newRowLengths = args.length;
|
|
422
550
|
createdNewRows = createRows(newRowLengths);
|
|
423
551
|
createdNewRowsData = args;
|
|
424
|
-
(
|
|
552
|
+
(_subtable_children = subtable.children)[type].apply(_subtable_children, _to_consumable_array(createdNewRows));
|
|
425
553
|
this.runtime.getFlatInstances();
|
|
426
554
|
break;
|
|
427
|
-
case
|
|
555
|
+
case "splice":
|
|
428
556
|
if (args.length > 2) {
|
|
429
557
|
var // @ts-ignore
|
|
430
|
-
|
|
558
|
+
_subtable_children1;
|
|
431
559
|
var newRowLengths1 = args.length - 2;
|
|
432
560
|
var newValues = args.slice(2);
|
|
433
561
|
createdNewRows = createRows(newRowLengths1);
|
|
@@ -436,10 +564,10 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
436
564
|
var start = args[0];
|
|
437
565
|
// 替换几个
|
|
438
566
|
var replace = args[1];
|
|
439
|
-
(
|
|
567
|
+
(_subtable_children1 = subtable.children)[type].apply(_subtable_children1, [
|
|
440
568
|
start,
|
|
441
569
|
replace
|
|
442
|
-
].concat(
|
|
570
|
+
].concat(_to_consumable_array(createdNewRows)));
|
|
443
571
|
this.runtime.getFlatInstances();
|
|
444
572
|
// newValues.forEach((item: any, index) => {
|
|
445
573
|
// let newIndex = start + index
|
|
@@ -447,7 +575,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
447
575
|
// })
|
|
448
576
|
} else {
|
|
449
577
|
var // @ts-ignore
|
|
450
|
-
|
|
578
|
+
_subtable_children2;
|
|
451
579
|
// 从哪儿开始
|
|
452
580
|
var start1 = args[0];
|
|
453
581
|
// 替换几个
|
|
@@ -455,28 +583,28 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
455
583
|
if (start1 + replace1 === subtable.children.length - 1) {
|
|
456
584
|
isDeleteLastOne = true;
|
|
457
585
|
}
|
|
458
|
-
(
|
|
586
|
+
(_subtable_children2 = subtable.children)[type].apply(_subtable_children2, _to_consumable_array(args));
|
|
459
587
|
this.runtime.getFlatInstances();
|
|
460
588
|
}
|
|
461
589
|
break;
|
|
462
590
|
default:
|
|
463
591
|
var // @ts-ignore
|
|
464
|
-
|
|
465
|
-
(
|
|
592
|
+
_subtable_children3;
|
|
593
|
+
(_subtable_children3 = subtable.children)[type].apply(_subtable_children3, _to_consumable_array(args));
|
|
466
594
|
this.runtime.getFlatInstances();
|
|
467
595
|
break;
|
|
468
596
|
}
|
|
469
|
-
if (type ===
|
|
597
|
+
if (type === "splice") {
|
|
470
598
|
deleted = result;
|
|
471
599
|
} else if ([
|
|
472
|
-
|
|
473
|
-
|
|
600
|
+
"pop",
|
|
601
|
+
"shift"
|
|
474
602
|
].includes(type)) {
|
|
475
603
|
deleted = [
|
|
476
604
|
result
|
|
477
605
|
];
|
|
478
606
|
}
|
|
479
|
-
this.emit(
|
|
607
|
+
this.emit("list-change", {
|
|
480
608
|
instance: subtable,
|
|
481
609
|
value: this.getState(subtable.id),
|
|
482
610
|
options: Object.assign({}, options, {
|
|
@@ -504,26 +632,26 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
504
632
|
// if (instance instanceof RuntimeListControl) {
|
|
505
633
|
if (instance.controlType === CONTROL_BASE_TYPE.LIST) {
|
|
506
634
|
var // @ts-ignore
|
|
507
|
-
|
|
635
|
+
_instance_children;
|
|
508
636
|
instance.children.length = 0;
|
|
509
637
|
var newValue = value;
|
|
510
638
|
// @ts-ignore
|
|
511
639
|
var newRows = [];
|
|
512
640
|
for(var i = 0; i < newValue.length; i++){
|
|
513
641
|
// @ts-ignore
|
|
514
|
-
var row = this.listControlCreateRow(instance,
|
|
642
|
+
var row = this.listControlCreateRow(instance, "subtable-row");
|
|
515
643
|
row && newRows.push(row);
|
|
516
644
|
}
|
|
517
|
-
(
|
|
645
|
+
(_instance_children = instance.children).push.apply(_instance_children, _to_consumable_array(newRows));
|
|
518
646
|
this.runtime.getFlatInstances();
|
|
519
647
|
// 这里已经能拿到控件实例,所以在这里触发setStates,触发每一行每一个控件的change事件
|
|
520
648
|
// for (let i = 0; i < newValue.length; i++) {
|
|
521
649
|
// this.setStates(newValue[i], i, options)
|
|
522
650
|
// }
|
|
523
|
-
this.emit(
|
|
651
|
+
this.emit("list-change", {
|
|
524
652
|
instance: instance,
|
|
525
653
|
value: value,
|
|
526
|
-
options:
|
|
654
|
+
options: _object_spread_props(_object_spread({}, options), {
|
|
527
655
|
// @ts-ignore
|
|
528
656
|
changed: newRows,
|
|
529
657
|
data: newValue,
|
|
@@ -531,11 +659,11 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
531
659
|
})
|
|
532
660
|
});
|
|
533
661
|
} else {
|
|
534
|
-
this.emit(
|
|
662
|
+
this.emit("change", {
|
|
535
663
|
instance: instance,
|
|
536
664
|
value: this.getState(instance.id, index),
|
|
537
665
|
rowIndex: index,
|
|
538
|
-
options:
|
|
666
|
+
options: _object_spread_props(_object_spread({}, options), {
|
|
539
667
|
oldValue: oldValue
|
|
540
668
|
})
|
|
541
669
|
});
|
|
@@ -549,13 +677,13 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
549
677
|
if (this.__pluginsApplied) return;
|
|
550
678
|
this.__plugins.forEach(function(plugin) {
|
|
551
679
|
try {
|
|
552
|
-
var
|
|
553
|
-
applyingPluginName = (
|
|
680
|
+
var _plugin_pluginName;
|
|
681
|
+
applyingPluginName = (_plugin_pluginName = plugin.pluginName) !== null && _plugin_pluginName !== void 0 ? _plugin_pluginName : plugin.constructor.name;
|
|
554
682
|
plugin.apply(_this);
|
|
555
683
|
} catch (e) {
|
|
556
684
|
error("".concat(applyingPluginName, " Plugin apply Error \n ").concat(e));
|
|
557
685
|
} finally{
|
|
558
|
-
applyingPluginName =
|
|
686
|
+
applyingPluginName = "";
|
|
559
687
|
}
|
|
560
688
|
});
|
|
561
689
|
this.__pluginsApplied = true;
|
|
@@ -569,12 +697,12 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
569
697
|
// if (row instanceof RuntimeLayoutControl) {
|
|
570
698
|
// @ts-ignore
|
|
571
699
|
if (row.controlType === CONTROL_BASE_TYPE.LAYOUT) {
|
|
572
|
-
var
|
|
700
|
+
var _inst_children;
|
|
573
701
|
var inst = row;
|
|
574
702
|
var template = JSONCopy(instance.props.headers);
|
|
575
703
|
// @ts-ignore
|
|
576
704
|
var columns = this.createControl(template);
|
|
577
|
-
(
|
|
705
|
+
(_inst_children = inst.children).push.apply(_inst_children, _to_consumable_array(columns));
|
|
578
706
|
}
|
|
579
707
|
//@ts-ignore
|
|
580
708
|
row.parent = instance;
|
|
@@ -585,7 +713,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
585
713
|
key: "listControlAddRow",
|
|
586
714
|
value: function listControlAddRow(instance) {
|
|
587
715
|
var // @ts-ignore
|
|
588
|
-
rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] :
|
|
716
|
+
rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "subtable-row";
|
|
589
717
|
var row = this.listControlCreateRow(instance, rowType);
|
|
590
718
|
if (!row) return;
|
|
591
719
|
instance.children.push(row);
|
|
@@ -597,39 +725,42 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
597
725
|
function emit(eventKey, payload) {
|
|
598
726
|
var _this = this;
|
|
599
727
|
var _this1 = this, _superprop_get_emit = function() {
|
|
600
|
-
return _get(
|
|
728
|
+
return _get(_get_prototype_of(Engine.prototype), "emit", _this);
|
|
601
729
|
};
|
|
602
|
-
return
|
|
730
|
+
return _async_to_generator(function() {
|
|
603
731
|
var needWait, promiseResolver, promise, results;
|
|
604
|
-
return
|
|
605
|
-
|
|
732
|
+
return _ts_generator(this, function(_state) {
|
|
733
|
+
switch(_state.label){
|
|
606
734
|
case 0:
|
|
607
|
-
if (!(eventKey ===
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
if (
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
case 4:
|
|
618
|
-
if (!_this1._jobTasks.length) {
|
|
619
|
-
_ctx.next = 10;
|
|
620
|
-
break;
|
|
735
|
+
if (!(eventKey === "engine-mounted")) return [
|
|
736
|
+
3,
|
|
737
|
+
3
|
|
738
|
+
];
|
|
739
|
+
if (_this1.isMounted) {
|
|
740
|
+
warn("The engine-mounted life cycle can only be triggered once");
|
|
741
|
+
return [
|
|
742
|
+
2,
|
|
743
|
+
Promise.resolve([])
|
|
744
|
+
];
|
|
621
745
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
746
|
+
if (!_this1._jobTasks.length) return [
|
|
747
|
+
3,
|
|
748
|
+
2
|
|
749
|
+
];
|
|
750
|
+
console.time("engine-mounted need wait");
|
|
751
|
+
needWait = _to_consumable_array(_this1._jobTasks);
|
|
752
|
+
return [
|
|
753
|
+
4,
|
|
754
|
+
Promise.all(needWait)
|
|
755
|
+
];
|
|
756
|
+
case 1:
|
|
757
|
+
_state.sent();
|
|
758
|
+
console.timeEnd("engine-mounted need wait");
|
|
759
|
+
_state.label = 2;
|
|
760
|
+
case 2:
|
|
629
761
|
_this1.isMounted = true;
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
;
|
|
762
|
+
_state.label = 3;
|
|
763
|
+
case 3:
|
|
633
764
|
// 如果没有挂载的话,需要记录在挂载之前触发的所有任务
|
|
634
765
|
if (!_this1.isMounted) {
|
|
635
766
|
promise = new Promise(function(resolve) {
|
|
@@ -637,22 +768,24 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
637
768
|
});
|
|
638
769
|
_this1._jobTasks.push(promise);
|
|
639
770
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
771
|
+
return [
|
|
772
|
+
4,
|
|
773
|
+
_superprop_get_emit().call(_this1, eventKey, payload)
|
|
774
|
+
];
|
|
775
|
+
case 4:
|
|
776
|
+
results = _state.sent();
|
|
644
777
|
if (promiseResolver && promise) {
|
|
645
778
|
// 每一个任务完成的时候,都把自己从task中去掉
|
|
646
779
|
promiseResolver();
|
|
647
780
|
_this1._jobTasks.splice(_this1._jobTasks.indexOf(promise), 1);
|
|
648
781
|
}
|
|
649
|
-
return
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
782
|
+
return [
|
|
783
|
+
2,
|
|
784
|
+
results
|
|
785
|
+
];
|
|
653
786
|
}
|
|
654
|
-
}
|
|
655
|
-
})
|
|
787
|
+
});
|
|
788
|
+
})();
|
|
656
789
|
}
|
|
657
790
|
},
|
|
658
791
|
{
|
|
@@ -661,7 +794,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
661
794
|
if (applyingPluginName) {
|
|
662
795
|
callback.applyingPluginName = applyingPluginName;
|
|
663
796
|
}
|
|
664
|
-
return _get(
|
|
797
|
+
return _get(_get_prototype_of(Engine.prototype), "on", this).call(this, key, callback);
|
|
665
798
|
}
|
|
666
799
|
},
|
|
667
800
|
{
|
|
@@ -670,8 +803,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
670
803
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
671
804
|
args[_key] = arguments[_key];
|
|
672
805
|
}
|
|
673
|
-
var
|
|
674
|
-
return (
|
|
806
|
+
var _this_runtime;
|
|
807
|
+
return (_this_runtime = this.runtime).createControl.apply(_this_runtime, _to_consumable_array(args));
|
|
675
808
|
}
|
|
676
809
|
},
|
|
677
810
|
{
|
|
@@ -705,10 +838,10 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
705
838
|
if (controlId === undefined) {
|
|
706
839
|
return rules;
|
|
707
840
|
} else {
|
|
708
|
-
var
|
|
841
|
+
var _rules_rules_controlId, _rules_antdRules_controlId;
|
|
709
842
|
return {
|
|
710
|
-
rules: (
|
|
711
|
-
antdRules: (
|
|
843
|
+
rules: (_rules_rules_controlId = rules.rules[controlId]) === null || _rules_rules_controlId === void 0 ? void 0 : _rules_rules_controlId.fields,
|
|
844
|
+
antdRules: (_rules_antdRules_controlId = rules.antdRules[controlId]) === null || _rules_antdRules_controlId === void 0 ? void 0 : _rules_antdRules_controlId.fields
|
|
712
845
|
};
|
|
713
846
|
}
|
|
714
847
|
}
|
|
@@ -719,8 +852,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
719
852
|
if (controlId === undefined) {
|
|
720
853
|
return this.runtime.rules;
|
|
721
854
|
} else {
|
|
722
|
-
var
|
|
723
|
-
return (
|
|
855
|
+
var _this_runtime_rules_controlId;
|
|
856
|
+
return (_this_runtime_rules_controlId = this.runtime.rules[controlId]) === null || _this_runtime_rules_controlId === void 0 ? void 0 : _this_runtime_rules_controlId.fields;
|
|
724
857
|
}
|
|
725
858
|
}
|
|
726
859
|
},
|
|
@@ -730,8 +863,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
730
863
|
if (controlId === undefined) {
|
|
731
864
|
return this.runtime.antdRules;
|
|
732
865
|
} else {
|
|
733
|
-
var
|
|
734
|
-
return (
|
|
866
|
+
var _this_runtime_antdRules_controlId;
|
|
867
|
+
return (_this_runtime_antdRules_controlId = this.runtime.antdRules[controlId]) === null || _this_runtime_antdRules_controlId === void 0 ? void 0 : _this_runtime_antdRules_controlId.fields;
|
|
735
868
|
}
|
|
736
869
|
}
|
|
737
870
|
},
|
|
@@ -768,9 +901,9 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
768
901
|
key: "setState",
|
|
769
902
|
value: function setState(controlId, value, rowIndex, options) {
|
|
770
903
|
eventOptionsTemp = options;
|
|
771
|
-
this.debugLog(
|
|
904
|
+
this.debugLog("[%o]: 触发setState, 修改的值为%o, rowIndex=%o, options=%o", controlId, value, rowIndex, options);
|
|
772
905
|
this.store.setState(controlId, value, rowIndex);
|
|
773
|
-
this.debugLog(
|
|
906
|
+
this.debugLog("[%o]: setState完成, 修改的值为%o, rowIndex=%o", controlId, value, rowIndex);
|
|
774
907
|
eventOptionsTemp = null;
|
|
775
908
|
}
|
|
776
909
|
},
|
|
@@ -783,20 +916,19 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
783
916
|
var _this = this;
|
|
784
917
|
var newStates = states !== null && states !== void 0 ? states : {};
|
|
785
918
|
Object.keys(newStates).forEach(function(stateId) {
|
|
786
|
-
var _this2 = _this;
|
|
787
919
|
Object.entries(_this.store.controlIdMapping).forEach(function(param) {
|
|
788
|
-
var _param =
|
|
920
|
+
var _param = _sliced_to_array(param, 2), controlId = _param[0], controlIdMapping = _param[1];
|
|
789
921
|
if (controlIdMapping.dataView === stateId) {
|
|
790
922
|
// state对象是dataView包裹的
|
|
791
923
|
var value = newStates[stateId][controlId];
|
|
792
924
|
if (value !== undefined) {
|
|
793
|
-
|
|
925
|
+
_this.setState(controlId, value, rowIndex, options);
|
|
794
926
|
}
|
|
795
927
|
} else {
|
|
796
928
|
// state对象是单独的,没有被dataView包裹的
|
|
797
929
|
if (controlId === stateId || controlIdMapping.children && controlIdMapping.children[stateId]) {
|
|
798
930
|
if (newStates[stateId] !== undefined) {
|
|
799
|
-
|
|
931
|
+
_this.setState(stateId, newStates[stateId], rowIndex, options);
|
|
800
932
|
}
|
|
801
933
|
}
|
|
802
934
|
}
|
|
@@ -824,12 +956,12 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
824
956
|
if (!dataBindMapping1) {
|
|
825
957
|
return;
|
|
826
958
|
}
|
|
827
|
-
var
|
|
959
|
+
var dataBind = dataBindMapping1.dataBind, controlId1 = dataBindMapping1.controlId;
|
|
828
960
|
var state = this.getState(controlId1, rowIndex);
|
|
829
961
|
//if (dataBind instanceof ObjectDataBind) {
|
|
830
|
-
if (!isDataBind(
|
|
831
|
-
return Object.entries(
|
|
832
|
-
var _param =
|
|
962
|
+
if (!isDataBind(dataBind)) {
|
|
963
|
+
return Object.entries(dataBind).reduce(function(result, param) {
|
|
964
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
|
|
833
965
|
// objectDataBind的元素,跳过下一次赋值
|
|
834
966
|
if (dataBind.fieldCode === fieldCode) {
|
|
835
967
|
return result[key];
|
|
@@ -855,18 +987,18 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
855
987
|
var data = getFieldData.map(function(item) {
|
|
856
988
|
var obj = {};
|
|
857
989
|
for(var key in item){
|
|
858
|
-
var
|
|
859
|
-
var fieldCode = (
|
|
990
|
+
var _controlIdMapping_controlId_children_key_dataBind, _controlIdMapping_controlId_children_key, _controlIdMapping_controlId;
|
|
991
|
+
var fieldCode = (_controlIdMapping_controlId = controlIdMapping[controlId]) === null || _controlIdMapping_controlId === void 0 ? void 0 : (_controlIdMapping_controlId_children_key = _controlIdMapping_controlId.children[key]) === null || _controlIdMapping_controlId_children_key === void 0 ? void 0 : (_controlIdMapping_controlId_children_key_dataBind = _controlIdMapping_controlId_children_key.dataBind) === null || _controlIdMapping_controlId_children_key_dataBind === void 0 ? void 0 : _controlIdMapping_controlId_children_key_dataBind.fieldCode;
|
|
860
992
|
//未绑定字段的控件,直接抛弃
|
|
861
|
-
if (fieldCode !==
|
|
862
|
-
var
|
|
993
|
+
if (fieldCode !== "") {
|
|
994
|
+
var _controlIdMapping_controlId1;
|
|
863
995
|
if (fieldCode) {
|
|
864
996
|
obj[fieldCode] = item[key];
|
|
865
|
-
} else if ((
|
|
997
|
+
} else if ((_controlIdMapping_controlId1 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId1 === void 0 ? void 0 : _controlIdMapping_controlId1.children[key]) {
|
|
866
998
|
// 兼容一个控件需要绑定多个字段的情况
|
|
867
999
|
for(var keyChi in item[key]){
|
|
868
|
-
var
|
|
869
|
-
obj[(
|
|
1000
|
+
var _controlIdMapping_controlId_children_key1, _controlIdMapping_controlId2;
|
|
1001
|
+
obj[(_controlIdMapping_controlId2 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId2 === void 0 ? void 0 : (_controlIdMapping_controlId_children_key1 = _controlIdMapping_controlId2.children[key]) === null || _controlIdMapping_controlId_children_key1 === void 0 ? void 0 : _controlIdMapping_controlId_children_key1.dataBind[keyChi].fieldCode] = item[key][keyChi];
|
|
870
1002
|
}
|
|
871
1003
|
}
|
|
872
1004
|
}
|
|
@@ -875,45 +1007,45 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
875
1007
|
});
|
|
876
1008
|
return data;
|
|
877
1009
|
} else {
|
|
878
|
-
var _loop = function(
|
|
879
|
-
var
|
|
880
|
-
if ((
|
|
881
|
-
var
|
|
882
|
-
|
|
883
|
-
} else if ((
|
|
884
|
-
var
|
|
1010
|
+
var _loop = function(key) {
|
|
1011
|
+
var _controlIdMapping_key_dataBind, _controlIdMapping_key, _controlIdMapping_key_dataBind1, _controlIdMapping_key1;
|
|
1012
|
+
if ((_controlIdMapping_key = controlIdMapping[key]) === null || _controlIdMapping_key === void 0 ? void 0 : (_controlIdMapping_key_dataBind = _controlIdMapping_key.dataBind) === null || _controlIdMapping_key_dataBind === void 0 ? void 0 : _controlIdMapping_key_dataBind.fieldCode) {
|
|
1013
|
+
var _controlIdMapping_key2;
|
|
1014
|
+
obj[(_controlIdMapping_key2 = controlIdMapping[key]) === null || _controlIdMapping_key2 === void 0 ? void 0 : _controlIdMapping_key2.dataBind.fieldCode] = getFieldData[key];
|
|
1015
|
+
} else if ((_controlIdMapping_key1 = controlIdMapping[key]) === null || _controlIdMapping_key1 === void 0 ? void 0 : (_controlIdMapping_key_dataBind1 = _controlIdMapping_key1.dataBind) === null || _controlIdMapping_key_dataBind1 === void 0 ? void 0 : _controlIdMapping_key_dataBind1.dataCode) {
|
|
1016
|
+
var _controlIdMapping_key3;
|
|
885
1017
|
// 明细字表只循环一层明细子表未递归
|
|
886
|
-
|
|
1018
|
+
obj[(_controlIdMapping_key3 = controlIdMapping[key]) === null || _controlIdMapping_key3 === void 0 ? void 0 : _controlIdMapping_key3.dataBind.dataCode] = getFieldData[key].map(function(item) {
|
|
887
1019
|
var objChi = {};
|
|
888
1020
|
for(var keyChi in item){
|
|
889
|
-
var
|
|
890
|
-
var fieldCode = (
|
|
1021
|
+
var _controlIdMapping_key_children_keyChi;
|
|
1022
|
+
var fieldCode = (_controlIdMapping_key_children_keyChi = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi === void 0 ? void 0 : _controlIdMapping_key_children_keyChi.dataBind.fieldCode;
|
|
891
1023
|
//未绑定字段的控件,直接抛弃
|
|
892
|
-
if (fieldCode !==
|
|
1024
|
+
if (fieldCode !== "") {
|
|
893
1025
|
if (fieldCode) {
|
|
894
1026
|
objChi[fieldCode] = item[keyChi];
|
|
895
1027
|
} else {
|
|
896
1028
|
for(var keyChi1 in item[keyChi]){
|
|
897
|
-
var
|
|
898
|
-
objChi[(
|
|
1029
|
+
var _controlIdMapping_key_children_keyChi1;
|
|
1030
|
+
objChi[(_controlIdMapping_key_children_keyChi1 = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi1 === void 0 ? void 0 : _controlIdMapping_key_children_keyChi1.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
|
|
899
1031
|
}
|
|
900
1032
|
}
|
|
901
1033
|
}
|
|
902
1034
|
}
|
|
903
1035
|
return objChi;
|
|
904
1036
|
});
|
|
905
|
-
} else if (controlIdMapping[
|
|
1037
|
+
} else if (controlIdMapping[key]) {
|
|
906
1038
|
// 兼容一个控件需要绑定多个字段的情况
|
|
907
|
-
for(var
|
|
908
|
-
var
|
|
909
|
-
|
|
1039
|
+
for(var keyChi in getFieldData[key]){
|
|
1040
|
+
var _controlIdMapping_key_dataBind_keyChi, _controlIdMapping_key4;
|
|
1041
|
+
obj[(_controlIdMapping_key4 = controlIdMapping[key]) === null || _controlIdMapping_key4 === void 0 ? void 0 : (_controlIdMapping_key_dataBind_keyChi = _controlIdMapping_key4.dataBind[keyChi]) === null || _controlIdMapping_key_dataBind_keyChi === void 0 ? void 0 : _controlIdMapping_key_dataBind_keyChi.fieldCode] = getFieldData[key][keyChi];
|
|
910
1042
|
}
|
|
911
1043
|
}
|
|
912
1044
|
};
|
|
913
1045
|
// 主表
|
|
914
|
-
var
|
|
915
|
-
for(var
|
|
916
|
-
return
|
|
1046
|
+
var obj = {};
|
|
1047
|
+
for(var key in getFieldData)_loop(key);
|
|
1048
|
+
return obj;
|
|
917
1049
|
}
|
|
918
1050
|
}
|
|
919
1051
|
return;
|
|
@@ -933,14 +1065,14 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
933
1065
|
if (!dataBindMapping) {
|
|
934
1066
|
return;
|
|
935
1067
|
}
|
|
936
|
-
var
|
|
1068
|
+
var dataBind = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
|
|
937
1069
|
// if (dataBind instanceof ObjectDataBind) {
|
|
938
|
-
if (!isDataBind(
|
|
939
|
-
var
|
|
940
|
-
var oldState = (
|
|
1070
|
+
if (!isDataBind(dataBind)) {
|
|
1071
|
+
var _JSONCopy;
|
|
1072
|
+
var oldState = (_JSONCopy = JSONCopy(this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : this.getEmptyState(controlId);
|
|
941
1073
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
942
|
-
var newState = Object.entries(
|
|
943
|
-
var _param =
|
|
1074
|
+
var newState = Object.entries(dataBind).reduce(function(result, param) {
|
|
1075
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
|
|
944
1076
|
// objectDataBind的元素,跳过下一次赋值
|
|
945
1077
|
if (dataBind.fieldCode === fieldCode) {
|
|
946
1078
|
result[key] = value;
|
|
@@ -969,7 +1101,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
969
1101
|
}
|
|
970
1102
|
var skipKeys = [];
|
|
971
1103
|
mapping.fields.forEach(function(item) {
|
|
972
|
-
var
|
|
1104
|
+
var dataBind = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
|
|
973
1105
|
if (skipKeys.includes(fieldCode)) {
|
|
974
1106
|
return;
|
|
975
1107
|
}
|
|
@@ -978,12 +1110,12 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
978
1110
|
}
|
|
979
1111
|
// 对象类型的值
|
|
980
1112
|
// if (dataBind instanceof ObjectDataBind) {
|
|
981
|
-
if (!isDataBind(
|
|
982
|
-
var
|
|
983
|
-
var oldState = (
|
|
1113
|
+
if (!isDataBind(dataBind)) {
|
|
1114
|
+
var _JSONCopy;
|
|
1115
|
+
var oldState = (_JSONCopy = JSONCopy(_this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : _this.getEmptyState(controlId);
|
|
984
1116
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
985
|
-
var newState = Object.entries(
|
|
986
|
-
var _param =
|
|
1117
|
+
var newState = Object.entries(dataBind).reduce(function(result, param) {
|
|
1118
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
|
|
987
1119
|
// objectDataBind的元素,跳过下一次赋值
|
|
988
1120
|
skipKeys.push(dataBind.fieldCode);
|
|
989
1121
|
var value = state[dataBind.fieldCode];
|
|
@@ -1012,9 +1144,9 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1012
1144
|
return;
|
|
1013
1145
|
}
|
|
1014
1146
|
var skipKeys = [];
|
|
1015
|
-
var
|
|
1147
|
+
var result = {};
|
|
1016
1148
|
mapping.fields.forEach(function(item) {
|
|
1017
|
-
var
|
|
1149
|
+
var dataBind = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
|
|
1018
1150
|
if (skipKeys.includes(fieldCode)) {
|
|
1019
1151
|
return;
|
|
1020
1152
|
}
|
|
@@ -1023,11 +1155,11 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1023
1155
|
}
|
|
1024
1156
|
// 对象类型的值
|
|
1025
1157
|
// if (dataBind instanceof ObjectDataBind) {
|
|
1026
|
-
if (!isDataBind(
|
|
1158
|
+
if (!isDataBind(dataBind)) {
|
|
1027
1159
|
var oldState = _this.getEmptyState(controlId);
|
|
1028
1160
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1029
|
-
|
|
1030
|
-
var _param =
|
|
1161
|
+
result[item.controlId] = Object.entries(dataBind).reduce(function(result, param) {
|
|
1162
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
|
|
1031
1163
|
// objectDataBind的元素,跳过下一次赋值
|
|
1032
1164
|
skipKeys.push(dataBind.fieldCode);
|
|
1033
1165
|
var value = state[dataBind.fieldCode];
|
|
@@ -1037,10 +1169,10 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1037
1169
|
return result;
|
|
1038
1170
|
}, oldState);
|
|
1039
1171
|
} else {
|
|
1040
|
-
|
|
1172
|
+
result[controlId] = state[fieldCode];
|
|
1041
1173
|
}
|
|
1042
1174
|
});
|
|
1043
|
-
return
|
|
1175
|
+
return result;
|
|
1044
1176
|
}
|
|
1045
1177
|
},
|
|
1046
1178
|
{
|
|
@@ -1050,14 +1182,13 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1050
1182
|
* @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
|
|
1051
1183
|
*/ key: "setData",
|
|
1052
1184
|
value: function setData(dataSet, options) {
|
|
1053
|
-
var
|
|
1185
|
+
var _this = this;
|
|
1054
1186
|
this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
|
|
1055
1187
|
var newState = this.store.defaultState;
|
|
1056
1188
|
Object.keys(dataSet).map(function(dataCode) {
|
|
1057
1189
|
var entity = dataSet[dataCode];
|
|
1058
1190
|
if (Array.isArray(entity)) {
|
|
1059
|
-
var
|
|
1060
|
-
var mapping = _this6.getDataBindMapping(dataCode);
|
|
1191
|
+
var mapping = _this.getDataBindMapping(dataCode);
|
|
1061
1192
|
if (!mapping) {
|
|
1062
1193
|
return;
|
|
1063
1194
|
}
|
|
@@ -1065,22 +1196,21 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1065
1196
|
newState[mapping.dataViewId] = {};
|
|
1066
1197
|
}
|
|
1067
1198
|
if (!entity.length) {
|
|
1068
|
-
var
|
|
1069
|
-
newState[mapping.dataViewId][mapping.controlId] = (
|
|
1199
|
+
var _newState_mapping_dataViewId_mapping_controlId;
|
|
1200
|
+
newState[mapping.dataViewId][mapping.controlId] = (_newState_mapping_dataViewId_mapping_controlId = newState[mapping.dataViewId][mapping.controlId]) !== null && _newState_mapping_dataViewId_mapping_controlId !== void 0 ? _newState_mapping_dataViewId_mapping_controlId : [];
|
|
1070
1201
|
} else {
|
|
1071
1202
|
newState[mapping.dataViewId][mapping.controlId] = [];
|
|
1072
1203
|
}
|
|
1073
1204
|
entity.map(function(row) {
|
|
1074
|
-
var
|
|
1075
|
-
var newRow = JSONCopy(_this4.store.emptyState[mapping.dataViewId][mapping.controlId]);
|
|
1205
|
+
var newRow = JSONCopy(_this.store.emptyState[mapping.dataViewId][mapping.controlId]);
|
|
1076
1206
|
var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
|
|
1077
1207
|
;
|
|
1078
1208
|
Object.keys(row).map(function(fieldCode) {
|
|
1079
|
-
var
|
|
1209
|
+
var _this_store_dataBindMapping_dataCode_fields, _this_store_dataBindMapping_dataCode;
|
|
1080
1210
|
if (skipKey.includes(fieldCode)) {
|
|
1081
1211
|
return;
|
|
1082
1212
|
}
|
|
1083
|
-
var fieldMapping = (
|
|
1213
|
+
var fieldMapping = (_this_store_dataBindMapping_dataCode = _this.store.dataBindMapping[dataCode]) === null || _this_store_dataBindMapping_dataCode === void 0 ? void 0 : (_this_store_dataBindMapping_dataCode_fields = _this_store_dataBindMapping_dataCode.fields) === null || _this_store_dataBindMapping_dataCode_fields === void 0 ? void 0 : _this_store_dataBindMapping_dataCode_fields.find(function(i) {
|
|
1084
1214
|
return i.fieldCode === fieldCode;
|
|
1085
1215
|
});
|
|
1086
1216
|
if (fieldMapping) {
|
|
@@ -1089,8 +1219,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1089
1219
|
newRow[fieldMapping.controlId] = row[fieldCode];
|
|
1090
1220
|
// } else if (fieldMapping.dataBind instanceof ObjectDataBind) {
|
|
1091
1221
|
} else if (!isDataBind(fieldMapping.dataBind)) {
|
|
1092
|
-
var
|
|
1093
|
-
var objValue = JSONCopy((
|
|
1222
|
+
var _this_getEmptyState;
|
|
1223
|
+
var objValue = JSONCopy((_this_getEmptyState = _this.getEmptyState(fieldMapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {});
|
|
1094
1224
|
Object.keys(fieldMapping.dataBind).map(function(key) {
|
|
1095
1225
|
var dataBind = fieldMapping.dataBind[key];
|
|
1096
1226
|
if (row[dataBind.fieldCode] !== undefined) {
|
|
@@ -1105,19 +1235,18 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1105
1235
|
newState[mapping.dataViewId][mapping.controlId].push(newRow);
|
|
1106
1236
|
});
|
|
1107
1237
|
} else if (entity) {
|
|
1108
|
-
var
|
|
1109
|
-
var
|
|
1238
|
+
var _Object_keys;
|
|
1239
|
+
var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
|
|
1110
1240
|
;
|
|
1111
|
-
var emptyState = JSONCopy(
|
|
1112
|
-
if (!((
|
|
1241
|
+
var emptyState = JSONCopy(_this.store.emptyState);
|
|
1242
|
+
if (!((_Object_keys = Object.keys(entity)) === null || _Object_keys === void 0 ? void 0 : _Object_keys.length)) {
|
|
1113
1243
|
// newState = this.store.defaultState
|
|
1114
1244
|
} else {
|
|
1115
|
-
var _this3 = _this6;
|
|
1116
1245
|
Object.keys(entity).map(function(fieldCode) {
|
|
1117
|
-
if (
|
|
1246
|
+
if (skipKey.includes(fieldCode)) {
|
|
1118
1247
|
return;
|
|
1119
1248
|
}
|
|
1120
|
-
var mapping =
|
|
1249
|
+
var mapping = _this.getDataBindMapping(dataCode, fieldCode);
|
|
1121
1250
|
if (mapping) {
|
|
1122
1251
|
if (!newState[mapping.dataViewId[0]]) {
|
|
1123
1252
|
newState[mapping.dataViewId[0]] = {};
|
|
@@ -1127,39 +1256,42 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1127
1256
|
newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
|
|
1128
1257
|
// } else if (mapping.dataBind instanceof ObjectDataBind) {
|
|
1129
1258
|
} else if (!isDataBind(mapping.dataBind)) {
|
|
1130
|
-
var
|
|
1131
|
-
var objValue = (
|
|
1259
|
+
var _this_getEmptyState;
|
|
1260
|
+
var objValue = (_this_getEmptyState = _this.getEmptyState(mapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {};
|
|
1132
1261
|
Object.keys(mapping.dataBind).map(function(key) {
|
|
1133
1262
|
var dataBind = mapping.dataBind[key];
|
|
1134
1263
|
if (entity[dataBind.fieldCode] !== undefined) {
|
|
1135
1264
|
objValue[key] = entity[dataBind.fieldCode];
|
|
1136
1265
|
}
|
|
1137
|
-
|
|
1266
|
+
skipKey.push(dataBind.fieldCode);
|
|
1138
1267
|
});
|
|
1139
1268
|
newState[mapping.dataViewId[0]][mapping.controlId] = objValue;
|
|
1140
1269
|
}
|
|
1141
1270
|
}
|
|
1142
1271
|
});
|
|
1143
1272
|
}
|
|
1144
|
-
var newMapping =
|
|
1273
|
+
var newMapping = _this.getDataBindMapping(dataCode);
|
|
1145
1274
|
if (newMapping) {
|
|
1146
|
-
var
|
|
1147
|
-
var mappingKeys = newMapping === null ||
|
|
1148
|
-
|
|
1275
|
+
var _newMapping_fields, _newMapping, _newMapping1, _newMapping2, _newState, _mappingKeys;
|
|
1276
|
+
var mappingKeys = (_newMapping = newMapping) === null || _newMapping === void 0 ? void 0 : (_newMapping_fields = _newMapping.fields) === null || _newMapping_fields === void 0 ? void 0 : _newMapping_fields.map(function(item) {
|
|
1277
|
+
var _item;
|
|
1278
|
+
return (_item = item) === null || _item === void 0 ? void 0 : _item.controlId;
|
|
1149
1279
|
});
|
|
1150
|
-
var mappingValue =
|
|
1151
|
-
var
|
|
1152
|
-
var mainStateKeys = Object.keys((
|
|
1153
|
-
mappingKeys === null ||
|
|
1154
|
-
|
|
1280
|
+
var mappingValue = _this.getEmptyState((_newMapping1 = newMapping) === null || _newMapping1 === void 0 ? void 0 : _newMapping1.controlId);
|
|
1281
|
+
var _newState_newMapping_controlId;
|
|
1282
|
+
var mainStateKeys = Object.keys((_newState_newMapping_controlId = (_newState = newState) === null || _newState === void 0 ? void 0 : _newState[(_newMapping2 = newMapping) === null || _newMapping2 === void 0 ? void 0 : _newMapping2.controlId]) !== null && _newState_newMapping_controlId !== void 0 ? _newState_newMapping_controlId : {});
|
|
1283
|
+
(_mappingKeys = mappingKeys) === null || _mappingKeys === void 0 ? void 0 : _mappingKeys.forEach(function(key) {
|
|
1284
|
+
var _newMapping;
|
|
1285
|
+
if (!mainStateKeys.includes(key) && key !== "uid" && newState[(_newMapping = newMapping) === null || _newMapping === void 0 ? void 0 : _newMapping.controlId]) {
|
|
1155
1286
|
if (Object.keys(newState).length) {
|
|
1156
|
-
|
|
1287
|
+
var _newMapping1;
|
|
1288
|
+
Object.assign(newState[(_newMapping1 = newMapping) === null || _newMapping1 === void 0 ? void 0 : _newMapping1.controlId], _define_property({}, key, mappingValue[key]));
|
|
1157
1289
|
} else {
|
|
1158
|
-
Object.assign(newState,
|
|
1290
|
+
Object.assign(newState, _define_property({}, newMapping.controlId, _define_property({}, key, mappingValue[key])));
|
|
1159
1291
|
}
|
|
1160
1292
|
}
|
|
1161
1293
|
});
|
|
1162
|
-
|
|
1294
|
+
_this.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
|
|
1163
1295
|
}
|
|
1164
1296
|
}
|
|
1165
1297
|
});
|
|
@@ -1270,9 +1402,9 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1270
1402
|
if (header) {
|
|
1271
1403
|
var instance = instances[0];
|
|
1272
1404
|
if (instance) {
|
|
1273
|
-
var
|
|
1405
|
+
var _instance_parent;
|
|
1274
1406
|
// @ts-ignore
|
|
1275
|
-
var parentId = (
|
|
1407
|
+
var parentId = (_instance_parent = instance.parent) === null || _instance_parent === void 0 ? void 0 : _instance_parent.id;
|
|
1276
1408
|
if (parentId) {
|
|
1277
1409
|
instances = this.runtime.instanceMap[parentId] || [];
|
|
1278
1410
|
}
|
|
@@ -1285,16 +1417,16 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1285
1417
|
{
|
|
1286
1418
|
key: "setInstance",
|
|
1287
1419
|
value: function setInstance(instance, props, value, rowIndex) {
|
|
1420
|
+
var _this = this;
|
|
1288
1421
|
try {
|
|
1289
|
-
if (typeof instance ===
|
|
1290
|
-
var _this = this;
|
|
1422
|
+
if (typeof instance === "string" && rowIndex === -1) {
|
|
1291
1423
|
//修改明细表整列属性的逻辑
|
|
1292
1424
|
var instances = this.getInstances(instance, rowIndex === -1);
|
|
1293
1425
|
instances.map(function(_instance) {
|
|
1294
1426
|
if (_instance) {
|
|
1295
1427
|
_this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
|
|
1296
1428
|
updateValueFromKeys(_instance.props, props, value);
|
|
1297
|
-
_this.schemaEvent(
|
|
1429
|
+
_this.schemaEvent("schema-change", {
|
|
1298
1430
|
instance: _instance,
|
|
1299
1431
|
props: props,
|
|
1300
1432
|
value: value,
|
|
@@ -1303,19 +1435,19 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1303
1435
|
}
|
|
1304
1436
|
});
|
|
1305
1437
|
} else {
|
|
1306
|
-
var
|
|
1307
|
-
if (typeof instance ===
|
|
1308
|
-
|
|
1438
|
+
var _instance;
|
|
1439
|
+
if (typeof instance === "string") {
|
|
1440
|
+
_instance = this.getInstance(instance, rowIndex);
|
|
1309
1441
|
} else {
|
|
1310
|
-
|
|
1442
|
+
_instance = instance;
|
|
1311
1443
|
}
|
|
1312
|
-
if (!
|
|
1444
|
+
if (!_instance) {
|
|
1313
1445
|
return;
|
|
1314
1446
|
}
|
|
1315
|
-
this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。",
|
|
1316
|
-
updateValueFromKeys(
|
|
1317
|
-
this.schemaEvent(
|
|
1318
|
-
instance:
|
|
1447
|
+
this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
|
|
1448
|
+
updateValueFromKeys(_instance.props, props, value);
|
|
1449
|
+
this.schemaEvent("schema-change", {
|
|
1450
|
+
instance: _instance,
|
|
1319
1451
|
props: props,
|
|
1320
1452
|
value: value,
|
|
1321
1453
|
rowIndex: rowIndex
|
|
@@ -1431,7 +1563,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1431
1563
|
CONTROL_TYPE.SUBTABLE_COLUMN);
|
|
1432
1564
|
if (isColumnChild) {
|
|
1433
1565
|
var instanceList = this.runtime.instanceMap[instance.id];
|
|
1434
|
-
if (Object.prototype.toString.call(instanceList) ===
|
|
1566
|
+
if (Object.prototype.toString.call(instanceList) === "[object Array]") {
|
|
1435
1567
|
var index = instanceList.findIndex(function(item) {
|
|
1436
1568
|
return item === instance;
|
|
1437
1569
|
});
|
|
@@ -1494,8 +1626,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1494
1626
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
1495
1627
|
args[_key] = arguments[_key];
|
|
1496
1628
|
}
|
|
1497
|
-
var
|
|
1498
|
-
return (
|
|
1629
|
+
var _this_runtime;
|
|
1630
|
+
return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime, _to_consumable_array(args));
|
|
1499
1631
|
}
|
|
1500
1632
|
},
|
|
1501
1633
|
{
|
|
@@ -1507,12 +1639,12 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1507
1639
|
{
|
|
1508
1640
|
key: "inList",
|
|
1509
1641
|
value: function inList(controlId) {
|
|
1510
|
-
var
|
|
1511
|
-
var mapping = (
|
|
1642
|
+
var _this_store_controlIdMapping;
|
|
1643
|
+
var mapping = (_this_store_controlIdMapping = this.store.controlIdMapping) !== null && _this_store_controlIdMapping !== void 0 ? _this_store_controlIdMapping : {};
|
|
1512
1644
|
var listKey = undefined;
|
|
1513
1645
|
Object.keys(mapping).some(function(key) {
|
|
1514
|
-
var
|
|
1515
|
-
var matched = (
|
|
1646
|
+
var _mapping_key_children, _mapping_key;
|
|
1647
|
+
var matched = (_mapping_key = mapping[key]) === null || _mapping_key === void 0 ? void 0 : (_mapping_key_children = _mapping_key.children) === null || _mapping_key_children === void 0 ? void 0 : _mapping_key_children.hasOwnProperty(controlId);
|
|
1516
1648
|
if (matched) {
|
|
1517
1649
|
listKey = key;
|
|
1518
1650
|
}
|
|
@@ -1526,7 +1658,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1526
1658
|
key: "register",
|
|
1527
1659
|
value: // 注册外部控件
|
|
1528
1660
|
function register(control) {
|
|
1529
|
-
return Runtime.register(control,
|
|
1661
|
+
return Runtime.register(control, "Runtime");
|
|
1530
1662
|
}
|
|
1531
1663
|
},
|
|
1532
1664
|
{
|