@byteluck-fe/model-driven-engine 2.7.0-alpha.15a → 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 +407 -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 +9 -9
- 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,13 +697,15 @@ 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
|
}
|
|
707
|
+
//@ts-ignore
|
|
708
|
+
row.parent = instance;
|
|
579
709
|
return row;
|
|
580
710
|
}
|
|
581
711
|
},
|
|
@@ -583,7 +713,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
583
713
|
key: "listControlAddRow",
|
|
584
714
|
value: function listControlAddRow(instance) {
|
|
585
715
|
var // @ts-ignore
|
|
586
|
-
rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] :
|
|
716
|
+
rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "subtable-row";
|
|
587
717
|
var row = this.listControlCreateRow(instance, rowType);
|
|
588
718
|
if (!row) return;
|
|
589
719
|
instance.children.push(row);
|
|
@@ -595,39 +725,42 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
595
725
|
function emit(eventKey, payload) {
|
|
596
726
|
var _this = this;
|
|
597
727
|
var _this1 = this, _superprop_get_emit = function() {
|
|
598
|
-
return _get(
|
|
728
|
+
return _get(_get_prototype_of(Engine.prototype), "emit", _this);
|
|
599
729
|
};
|
|
600
|
-
return
|
|
730
|
+
return _async_to_generator(function() {
|
|
601
731
|
var needWait, promiseResolver, promise, results;
|
|
602
|
-
return
|
|
603
|
-
|
|
732
|
+
return _ts_generator(this, function(_state) {
|
|
733
|
+
switch(_state.label){
|
|
604
734
|
case 0:
|
|
605
|
-
if (!(eventKey ===
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
if (
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
case 4:
|
|
616
|
-
if (!_this1._jobTasks.length) {
|
|
617
|
-
_ctx.next = 10;
|
|
618
|
-
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
|
+
];
|
|
619
745
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
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:
|
|
627
761
|
_this1.isMounted = true;
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
;
|
|
762
|
+
_state.label = 3;
|
|
763
|
+
case 3:
|
|
631
764
|
// 如果没有挂载的话,需要记录在挂载之前触发的所有任务
|
|
632
765
|
if (!_this1.isMounted) {
|
|
633
766
|
promise = new Promise(function(resolve) {
|
|
@@ -635,22 +768,24 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
635
768
|
});
|
|
636
769
|
_this1._jobTasks.push(promise);
|
|
637
770
|
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
771
|
+
return [
|
|
772
|
+
4,
|
|
773
|
+
_superprop_get_emit().call(_this1, eventKey, payload)
|
|
774
|
+
];
|
|
775
|
+
case 4:
|
|
776
|
+
results = _state.sent();
|
|
642
777
|
if (promiseResolver && promise) {
|
|
643
778
|
// 每一个任务完成的时候,都把自己从task中去掉
|
|
644
779
|
promiseResolver();
|
|
645
780
|
_this1._jobTasks.splice(_this1._jobTasks.indexOf(promise), 1);
|
|
646
781
|
}
|
|
647
|
-
return
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
782
|
+
return [
|
|
783
|
+
2,
|
|
784
|
+
results
|
|
785
|
+
];
|
|
651
786
|
}
|
|
652
|
-
}
|
|
653
|
-
})
|
|
787
|
+
});
|
|
788
|
+
})();
|
|
654
789
|
}
|
|
655
790
|
},
|
|
656
791
|
{
|
|
@@ -659,7 +794,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
659
794
|
if (applyingPluginName) {
|
|
660
795
|
callback.applyingPluginName = applyingPluginName;
|
|
661
796
|
}
|
|
662
|
-
return _get(
|
|
797
|
+
return _get(_get_prototype_of(Engine.prototype), "on", this).call(this, key, callback);
|
|
663
798
|
}
|
|
664
799
|
},
|
|
665
800
|
{
|
|
@@ -668,8 +803,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
668
803
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
669
804
|
args[_key] = arguments[_key];
|
|
670
805
|
}
|
|
671
|
-
var
|
|
672
|
-
return (
|
|
806
|
+
var _this_runtime;
|
|
807
|
+
return (_this_runtime = this.runtime).createControl.apply(_this_runtime, _to_consumable_array(args));
|
|
673
808
|
}
|
|
674
809
|
},
|
|
675
810
|
{
|
|
@@ -703,10 +838,10 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
703
838
|
if (controlId === undefined) {
|
|
704
839
|
return rules;
|
|
705
840
|
} else {
|
|
706
|
-
var
|
|
841
|
+
var _rules_rules_controlId, _rules_antdRules_controlId;
|
|
707
842
|
return {
|
|
708
|
-
rules: (
|
|
709
|
-
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
|
|
710
845
|
};
|
|
711
846
|
}
|
|
712
847
|
}
|
|
@@ -717,8 +852,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
717
852
|
if (controlId === undefined) {
|
|
718
853
|
return this.runtime.rules;
|
|
719
854
|
} else {
|
|
720
|
-
var
|
|
721
|
-
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;
|
|
722
857
|
}
|
|
723
858
|
}
|
|
724
859
|
},
|
|
@@ -728,8 +863,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
728
863
|
if (controlId === undefined) {
|
|
729
864
|
return this.runtime.antdRules;
|
|
730
865
|
} else {
|
|
731
|
-
var
|
|
732
|
-
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;
|
|
733
868
|
}
|
|
734
869
|
}
|
|
735
870
|
},
|
|
@@ -766,9 +901,9 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
766
901
|
key: "setState",
|
|
767
902
|
value: function setState(controlId, value, rowIndex, options) {
|
|
768
903
|
eventOptionsTemp = options;
|
|
769
|
-
this.debugLog(
|
|
904
|
+
this.debugLog("[%o]: 触发setState, 修改的值为%o, rowIndex=%o, options=%o", controlId, value, rowIndex, options);
|
|
770
905
|
this.store.setState(controlId, value, rowIndex);
|
|
771
|
-
this.debugLog(
|
|
906
|
+
this.debugLog("[%o]: setState完成, 修改的值为%o, rowIndex=%o", controlId, value, rowIndex);
|
|
772
907
|
eventOptionsTemp = null;
|
|
773
908
|
}
|
|
774
909
|
},
|
|
@@ -781,20 +916,19 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
781
916
|
var _this = this;
|
|
782
917
|
var newStates = states !== null && states !== void 0 ? states : {};
|
|
783
918
|
Object.keys(newStates).forEach(function(stateId) {
|
|
784
|
-
var _this2 = _this;
|
|
785
919
|
Object.entries(_this.store.controlIdMapping).forEach(function(param) {
|
|
786
|
-
var _param =
|
|
920
|
+
var _param = _sliced_to_array(param, 2), controlId = _param[0], controlIdMapping = _param[1];
|
|
787
921
|
if (controlIdMapping.dataView === stateId) {
|
|
788
922
|
// state对象是dataView包裹的
|
|
789
923
|
var value = newStates[stateId][controlId];
|
|
790
924
|
if (value !== undefined) {
|
|
791
|
-
|
|
925
|
+
_this.setState(controlId, value, rowIndex, options);
|
|
792
926
|
}
|
|
793
927
|
} else {
|
|
794
928
|
// state对象是单独的,没有被dataView包裹的
|
|
795
929
|
if (controlId === stateId || controlIdMapping.children && controlIdMapping.children[stateId]) {
|
|
796
930
|
if (newStates[stateId] !== undefined) {
|
|
797
|
-
|
|
931
|
+
_this.setState(stateId, newStates[stateId], rowIndex, options);
|
|
798
932
|
}
|
|
799
933
|
}
|
|
800
934
|
}
|
|
@@ -822,12 +956,12 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
822
956
|
if (!dataBindMapping1) {
|
|
823
957
|
return;
|
|
824
958
|
}
|
|
825
|
-
var
|
|
959
|
+
var dataBind = dataBindMapping1.dataBind, controlId1 = dataBindMapping1.controlId;
|
|
826
960
|
var state = this.getState(controlId1, rowIndex);
|
|
827
961
|
//if (dataBind instanceof ObjectDataBind) {
|
|
828
|
-
if (!isDataBind(
|
|
829
|
-
return Object.entries(
|
|
830
|
-
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];
|
|
831
965
|
// objectDataBind的元素,跳过下一次赋值
|
|
832
966
|
if (dataBind.fieldCode === fieldCode) {
|
|
833
967
|
return result[key];
|
|
@@ -853,18 +987,18 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
853
987
|
var data = getFieldData.map(function(item) {
|
|
854
988
|
var obj = {};
|
|
855
989
|
for(var key in item){
|
|
856
|
-
var
|
|
857
|
-
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;
|
|
858
992
|
//未绑定字段的控件,直接抛弃
|
|
859
|
-
if (fieldCode !==
|
|
860
|
-
var
|
|
993
|
+
if (fieldCode !== "") {
|
|
994
|
+
var _controlIdMapping_controlId1;
|
|
861
995
|
if (fieldCode) {
|
|
862
996
|
obj[fieldCode] = item[key];
|
|
863
|
-
} else if ((
|
|
997
|
+
} else if ((_controlIdMapping_controlId1 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId1 === void 0 ? void 0 : _controlIdMapping_controlId1.children[key]) {
|
|
864
998
|
// 兼容一个控件需要绑定多个字段的情况
|
|
865
999
|
for(var keyChi in item[key]){
|
|
866
|
-
var
|
|
867
|
-
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];
|
|
868
1002
|
}
|
|
869
1003
|
}
|
|
870
1004
|
}
|
|
@@ -873,45 +1007,45 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
873
1007
|
});
|
|
874
1008
|
return data;
|
|
875
1009
|
} else {
|
|
876
|
-
var _loop = function(
|
|
877
|
-
var
|
|
878
|
-
if ((
|
|
879
|
-
var
|
|
880
|
-
|
|
881
|
-
} else if ((
|
|
882
|
-
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;
|
|
883
1017
|
// 明细字表只循环一层明细子表未递归
|
|
884
|
-
|
|
1018
|
+
obj[(_controlIdMapping_key3 = controlIdMapping[key]) === null || _controlIdMapping_key3 === void 0 ? void 0 : _controlIdMapping_key3.dataBind.dataCode] = getFieldData[key].map(function(item) {
|
|
885
1019
|
var objChi = {};
|
|
886
1020
|
for(var keyChi in item){
|
|
887
|
-
var
|
|
888
|
-
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;
|
|
889
1023
|
//未绑定字段的控件,直接抛弃
|
|
890
|
-
if (fieldCode !==
|
|
1024
|
+
if (fieldCode !== "") {
|
|
891
1025
|
if (fieldCode) {
|
|
892
1026
|
objChi[fieldCode] = item[keyChi];
|
|
893
1027
|
} else {
|
|
894
1028
|
for(var keyChi1 in item[keyChi]){
|
|
895
|
-
var
|
|
896
|
-
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];
|
|
897
1031
|
}
|
|
898
1032
|
}
|
|
899
1033
|
}
|
|
900
1034
|
}
|
|
901
1035
|
return objChi;
|
|
902
1036
|
});
|
|
903
|
-
} else if (controlIdMapping[
|
|
1037
|
+
} else if (controlIdMapping[key]) {
|
|
904
1038
|
// 兼容一个控件需要绑定多个字段的情况
|
|
905
|
-
for(var
|
|
906
|
-
var
|
|
907
|
-
|
|
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];
|
|
908
1042
|
}
|
|
909
1043
|
}
|
|
910
1044
|
};
|
|
911
1045
|
// 主表
|
|
912
|
-
var
|
|
913
|
-
for(var
|
|
914
|
-
return
|
|
1046
|
+
var obj = {};
|
|
1047
|
+
for(var key in getFieldData)_loop(key);
|
|
1048
|
+
return obj;
|
|
915
1049
|
}
|
|
916
1050
|
}
|
|
917
1051
|
return;
|
|
@@ -931,14 +1065,14 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
931
1065
|
if (!dataBindMapping) {
|
|
932
1066
|
return;
|
|
933
1067
|
}
|
|
934
|
-
var
|
|
1068
|
+
var dataBind = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
|
|
935
1069
|
// if (dataBind instanceof ObjectDataBind) {
|
|
936
|
-
if (!isDataBind(
|
|
937
|
-
var
|
|
938
|
-
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);
|
|
939
1073
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
940
|
-
var newState = Object.entries(
|
|
941
|
-
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];
|
|
942
1076
|
// objectDataBind的元素,跳过下一次赋值
|
|
943
1077
|
if (dataBind.fieldCode === fieldCode) {
|
|
944
1078
|
result[key] = value;
|
|
@@ -967,7 +1101,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
967
1101
|
}
|
|
968
1102
|
var skipKeys = [];
|
|
969
1103
|
mapping.fields.forEach(function(item) {
|
|
970
|
-
var
|
|
1104
|
+
var dataBind = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
|
|
971
1105
|
if (skipKeys.includes(fieldCode)) {
|
|
972
1106
|
return;
|
|
973
1107
|
}
|
|
@@ -976,12 +1110,12 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
976
1110
|
}
|
|
977
1111
|
// 对象类型的值
|
|
978
1112
|
// if (dataBind instanceof ObjectDataBind) {
|
|
979
|
-
if (!isDataBind(
|
|
980
|
-
var
|
|
981
|
-
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);
|
|
982
1116
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
983
|
-
var newState = Object.entries(
|
|
984
|
-
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];
|
|
985
1119
|
// objectDataBind的元素,跳过下一次赋值
|
|
986
1120
|
skipKeys.push(dataBind.fieldCode);
|
|
987
1121
|
var value = state[dataBind.fieldCode];
|
|
@@ -1010,9 +1144,9 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1010
1144
|
return;
|
|
1011
1145
|
}
|
|
1012
1146
|
var skipKeys = [];
|
|
1013
|
-
var
|
|
1147
|
+
var result = {};
|
|
1014
1148
|
mapping.fields.forEach(function(item) {
|
|
1015
|
-
var
|
|
1149
|
+
var dataBind = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
|
|
1016
1150
|
if (skipKeys.includes(fieldCode)) {
|
|
1017
1151
|
return;
|
|
1018
1152
|
}
|
|
@@ -1021,11 +1155,11 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1021
1155
|
}
|
|
1022
1156
|
// 对象类型的值
|
|
1023
1157
|
// if (dataBind instanceof ObjectDataBind) {
|
|
1024
|
-
if (!isDataBind(
|
|
1158
|
+
if (!isDataBind(dataBind)) {
|
|
1025
1159
|
var oldState = _this.getEmptyState(controlId);
|
|
1026
1160
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1027
|
-
|
|
1028
|
-
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];
|
|
1029
1163
|
// objectDataBind的元素,跳过下一次赋值
|
|
1030
1164
|
skipKeys.push(dataBind.fieldCode);
|
|
1031
1165
|
var value = state[dataBind.fieldCode];
|
|
@@ -1035,10 +1169,10 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1035
1169
|
return result;
|
|
1036
1170
|
}, oldState);
|
|
1037
1171
|
} else {
|
|
1038
|
-
|
|
1172
|
+
result[controlId] = state[fieldCode];
|
|
1039
1173
|
}
|
|
1040
1174
|
});
|
|
1041
|
-
return
|
|
1175
|
+
return result;
|
|
1042
1176
|
}
|
|
1043
1177
|
},
|
|
1044
1178
|
{
|
|
@@ -1048,14 +1182,13 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1048
1182
|
* @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
|
|
1049
1183
|
*/ key: "setData",
|
|
1050
1184
|
value: function setData(dataSet, options) {
|
|
1051
|
-
var
|
|
1185
|
+
var _this = this;
|
|
1052
1186
|
this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
|
|
1053
1187
|
var newState = this.store.defaultState;
|
|
1054
1188
|
Object.keys(dataSet).map(function(dataCode) {
|
|
1055
1189
|
var entity = dataSet[dataCode];
|
|
1056
1190
|
if (Array.isArray(entity)) {
|
|
1057
|
-
var
|
|
1058
|
-
var mapping = _this6.getDataBindMapping(dataCode);
|
|
1191
|
+
var mapping = _this.getDataBindMapping(dataCode);
|
|
1059
1192
|
if (!mapping) {
|
|
1060
1193
|
return;
|
|
1061
1194
|
}
|
|
@@ -1063,22 +1196,21 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1063
1196
|
newState[mapping.dataViewId] = {};
|
|
1064
1197
|
}
|
|
1065
1198
|
if (!entity.length) {
|
|
1066
|
-
var
|
|
1067
|
-
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 : [];
|
|
1068
1201
|
} else {
|
|
1069
1202
|
newState[mapping.dataViewId][mapping.controlId] = [];
|
|
1070
1203
|
}
|
|
1071
1204
|
entity.map(function(row) {
|
|
1072
|
-
var
|
|
1073
|
-
var newRow = JSONCopy(_this4.store.emptyState[mapping.dataViewId][mapping.controlId]);
|
|
1205
|
+
var newRow = JSONCopy(_this.store.emptyState[mapping.dataViewId][mapping.controlId]);
|
|
1074
1206
|
var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
|
|
1075
1207
|
;
|
|
1076
1208
|
Object.keys(row).map(function(fieldCode) {
|
|
1077
|
-
var
|
|
1209
|
+
var _this_store_dataBindMapping_dataCode_fields, _this_store_dataBindMapping_dataCode;
|
|
1078
1210
|
if (skipKey.includes(fieldCode)) {
|
|
1079
1211
|
return;
|
|
1080
1212
|
}
|
|
1081
|
-
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) {
|
|
1082
1214
|
return i.fieldCode === fieldCode;
|
|
1083
1215
|
});
|
|
1084
1216
|
if (fieldMapping) {
|
|
@@ -1087,8 +1219,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1087
1219
|
newRow[fieldMapping.controlId] = row[fieldCode];
|
|
1088
1220
|
// } else if (fieldMapping.dataBind instanceof ObjectDataBind) {
|
|
1089
1221
|
} else if (!isDataBind(fieldMapping.dataBind)) {
|
|
1090
|
-
var
|
|
1091
|
-
var objValue = JSONCopy((
|
|
1222
|
+
var _this_getEmptyState;
|
|
1223
|
+
var objValue = JSONCopy((_this_getEmptyState = _this.getEmptyState(fieldMapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {});
|
|
1092
1224
|
Object.keys(fieldMapping.dataBind).map(function(key) {
|
|
1093
1225
|
var dataBind = fieldMapping.dataBind[key];
|
|
1094
1226
|
if (row[dataBind.fieldCode] !== undefined) {
|
|
@@ -1103,19 +1235,18 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1103
1235
|
newState[mapping.dataViewId][mapping.controlId].push(newRow);
|
|
1104
1236
|
});
|
|
1105
1237
|
} else if (entity) {
|
|
1106
|
-
var
|
|
1107
|
-
var
|
|
1238
|
+
var _Object_keys;
|
|
1239
|
+
var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
|
|
1108
1240
|
;
|
|
1109
|
-
var emptyState = JSONCopy(
|
|
1110
|
-
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)) {
|
|
1111
1243
|
// newState = this.store.defaultState
|
|
1112
1244
|
} else {
|
|
1113
|
-
var _this3 = _this6;
|
|
1114
1245
|
Object.keys(entity).map(function(fieldCode) {
|
|
1115
|
-
if (
|
|
1246
|
+
if (skipKey.includes(fieldCode)) {
|
|
1116
1247
|
return;
|
|
1117
1248
|
}
|
|
1118
|
-
var mapping =
|
|
1249
|
+
var mapping = _this.getDataBindMapping(dataCode, fieldCode);
|
|
1119
1250
|
if (mapping) {
|
|
1120
1251
|
if (!newState[mapping.dataViewId[0]]) {
|
|
1121
1252
|
newState[mapping.dataViewId[0]] = {};
|
|
@@ -1125,39 +1256,42 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1125
1256
|
newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
|
|
1126
1257
|
// } else if (mapping.dataBind instanceof ObjectDataBind) {
|
|
1127
1258
|
} else if (!isDataBind(mapping.dataBind)) {
|
|
1128
|
-
var
|
|
1129
|
-
var objValue = (
|
|
1259
|
+
var _this_getEmptyState;
|
|
1260
|
+
var objValue = (_this_getEmptyState = _this.getEmptyState(mapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {};
|
|
1130
1261
|
Object.keys(mapping.dataBind).map(function(key) {
|
|
1131
1262
|
var dataBind = mapping.dataBind[key];
|
|
1132
1263
|
if (entity[dataBind.fieldCode] !== undefined) {
|
|
1133
1264
|
objValue[key] = entity[dataBind.fieldCode];
|
|
1134
1265
|
}
|
|
1135
|
-
|
|
1266
|
+
skipKey.push(dataBind.fieldCode);
|
|
1136
1267
|
});
|
|
1137
1268
|
newState[mapping.dataViewId[0]][mapping.controlId] = objValue;
|
|
1138
1269
|
}
|
|
1139
1270
|
}
|
|
1140
1271
|
});
|
|
1141
1272
|
}
|
|
1142
|
-
var newMapping =
|
|
1273
|
+
var newMapping = _this.getDataBindMapping(dataCode);
|
|
1143
1274
|
if (newMapping) {
|
|
1144
|
-
var
|
|
1145
|
-
var mappingKeys = newMapping === null ||
|
|
1146
|
-
|
|
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;
|
|
1147
1279
|
});
|
|
1148
|
-
var mappingValue =
|
|
1149
|
-
var
|
|
1150
|
-
var mainStateKeys = Object.keys((
|
|
1151
|
-
mappingKeys === null ||
|
|
1152
|
-
|
|
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]) {
|
|
1153
1286
|
if (Object.keys(newState).length) {
|
|
1154
|
-
|
|
1287
|
+
var _newMapping1;
|
|
1288
|
+
Object.assign(newState[(_newMapping1 = newMapping) === null || _newMapping1 === void 0 ? void 0 : _newMapping1.controlId], _define_property({}, key, mappingValue[key]));
|
|
1155
1289
|
} else {
|
|
1156
|
-
Object.assign(newState,
|
|
1290
|
+
Object.assign(newState, _define_property({}, newMapping.controlId, _define_property({}, key, mappingValue[key])));
|
|
1157
1291
|
}
|
|
1158
1292
|
}
|
|
1159
1293
|
});
|
|
1160
|
-
|
|
1294
|
+
_this.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
|
|
1161
1295
|
}
|
|
1162
1296
|
}
|
|
1163
1297
|
});
|
|
@@ -1268,9 +1402,9 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1268
1402
|
if (header) {
|
|
1269
1403
|
var instance = instances[0];
|
|
1270
1404
|
if (instance) {
|
|
1271
|
-
var
|
|
1405
|
+
var _instance_parent;
|
|
1272
1406
|
// @ts-ignore
|
|
1273
|
-
var parentId = (
|
|
1407
|
+
var parentId = (_instance_parent = instance.parent) === null || _instance_parent === void 0 ? void 0 : _instance_parent.id;
|
|
1274
1408
|
if (parentId) {
|
|
1275
1409
|
instances = this.runtime.instanceMap[parentId] || [];
|
|
1276
1410
|
}
|
|
@@ -1283,16 +1417,16 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1283
1417
|
{
|
|
1284
1418
|
key: "setInstance",
|
|
1285
1419
|
value: function setInstance(instance, props, value, rowIndex) {
|
|
1420
|
+
var _this = this;
|
|
1286
1421
|
try {
|
|
1287
|
-
if (typeof instance ===
|
|
1288
|
-
var _this = this;
|
|
1422
|
+
if (typeof instance === "string" && rowIndex === -1) {
|
|
1289
1423
|
//修改明细表整列属性的逻辑
|
|
1290
1424
|
var instances = this.getInstances(instance, rowIndex === -1);
|
|
1291
1425
|
instances.map(function(_instance) {
|
|
1292
1426
|
if (_instance) {
|
|
1293
1427
|
_this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
|
|
1294
1428
|
updateValueFromKeys(_instance.props, props, value);
|
|
1295
|
-
_this.schemaEvent(
|
|
1429
|
+
_this.schemaEvent("schema-change", {
|
|
1296
1430
|
instance: _instance,
|
|
1297
1431
|
props: props,
|
|
1298
1432
|
value: value,
|
|
@@ -1301,19 +1435,19 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1301
1435
|
}
|
|
1302
1436
|
});
|
|
1303
1437
|
} else {
|
|
1304
|
-
var
|
|
1305
|
-
if (typeof instance ===
|
|
1306
|
-
|
|
1438
|
+
var _instance;
|
|
1439
|
+
if (typeof instance === "string") {
|
|
1440
|
+
_instance = this.getInstance(instance, rowIndex);
|
|
1307
1441
|
} else {
|
|
1308
|
-
|
|
1442
|
+
_instance = instance;
|
|
1309
1443
|
}
|
|
1310
|
-
if (!
|
|
1444
|
+
if (!_instance) {
|
|
1311
1445
|
return;
|
|
1312
1446
|
}
|
|
1313
|
-
this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。",
|
|
1314
|
-
updateValueFromKeys(
|
|
1315
|
-
this.schemaEvent(
|
|
1316
|
-
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,
|
|
1317
1451
|
props: props,
|
|
1318
1452
|
value: value,
|
|
1319
1453
|
rowIndex: rowIndex
|
|
@@ -1429,7 +1563,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1429
1563
|
CONTROL_TYPE.SUBTABLE_COLUMN);
|
|
1430
1564
|
if (isColumnChild) {
|
|
1431
1565
|
var instanceList = this.runtime.instanceMap[instance.id];
|
|
1432
|
-
if (Object.prototype.toString.call(instanceList) ===
|
|
1566
|
+
if (Object.prototype.toString.call(instanceList) === "[object Array]") {
|
|
1433
1567
|
var index = instanceList.findIndex(function(item) {
|
|
1434
1568
|
return item === instance;
|
|
1435
1569
|
});
|
|
@@ -1492,8 +1626,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1492
1626
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
1493
1627
|
args[_key] = arguments[_key];
|
|
1494
1628
|
}
|
|
1495
|
-
var
|
|
1496
|
-
return (
|
|
1629
|
+
var _this_runtime;
|
|
1630
|
+
return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime, _to_consumable_array(args));
|
|
1497
1631
|
}
|
|
1498
1632
|
},
|
|
1499
1633
|
{
|
|
@@ -1505,12 +1639,12 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1505
1639
|
{
|
|
1506
1640
|
key: "inList",
|
|
1507
1641
|
value: function inList(controlId) {
|
|
1508
|
-
var
|
|
1509
|
-
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 : {};
|
|
1510
1644
|
var listKey = undefined;
|
|
1511
1645
|
Object.keys(mapping).some(function(key) {
|
|
1512
|
-
var
|
|
1513
|
-
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);
|
|
1514
1648
|
if (matched) {
|
|
1515
1649
|
listKey = key;
|
|
1516
1650
|
}
|
|
@@ -1524,7 +1658,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
|
1524
1658
|
key: "register",
|
|
1525
1659
|
value: // 注册外部控件
|
|
1526
1660
|
function register(control) {
|
|
1527
|
-
return Runtime.register(control,
|
|
1661
|
+
return Runtime.register(control, "Runtime");
|
|
1528
1662
|
}
|
|
1529
1663
|
},
|
|
1530
1664
|
{
|