@byteluck-fe/model-driven-engine 2.7.0-alpha.30a → 2.7.0-alpha.31b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -30
- package/dist/esm/common/ActionManager.js +60 -177
- package/dist/esm/common/DataManager.js +25 -134
- package/dist/esm/common/Engine.js +292 -397
- package/dist/esm/common/OkWorker.js +17 -31
- package/dist/esm/common/Plugin.js +2 -2
- package/dist/esm/common/Runtime.js +41 -56
- package/dist/esm/common/Store.js +62 -63
- package/dist/esm/common/checkerValue.js +108 -108
- package/dist/esm/common/index.js +2 -2
- package/dist/esm/common/proxyState.js +76 -76
- package/dist/esm/index.js +3 -3
- package/dist/esm/plugins/CalcPlugin.js +119 -127
- package/dist/esm/plugins/ControlsEventPlugin.js +73 -196
- package/dist/esm/plugins/ES6ModulePlugin.js +22 -39
- package/dist/esm/plugins/LifecycleEventPlugin.js +79 -198
- package/dist/esm/plugins/StylePlugin.js +11 -26
- package/dist/esm/plugins/index.js +5 -5
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/runtimeUtils.js +7 -5
- package/dist/index.umd.js +8 -8
- package/dist/types/common/ActionManager.d.ts +14 -14
- package/dist/types/common/DataManager.d.ts +10 -10
- package/dist/types/common/Engine.d.ts +181 -181
- package/dist/types/common/OkWorker.d.ts +13 -13
- package/dist/types/common/Plugin.d.ts +6 -6
- package/dist/types/common/Runtime.d.ts +26 -26
- package/dist/types/common/Store.d.ts +50 -50
- package/dist/types/common/checkerValue.d.ts +3 -3
- package/dist/types/common/index.d.ts +2 -2
- package/dist/types/common/proxyState.d.ts +30 -30
- package/dist/types/index.d.ts +3 -3
- package/dist/types/plugins/CalcPlugin.d.ts +121 -121
- package/dist/types/plugins/ControlsEventPlugin.d.ts +15 -15
- package/dist/types/plugins/ES6ModulePlugin.d.ts +27 -27
- package/dist/types/plugins/LifecycleEventPlugin.d.ts +14 -14
- package/dist/types/plugins/StylePlugin.d.ts +12 -12
- package/dist/types/plugins/index.d.ts +5 -5
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/runtimeUtils.d.ts +5 -5
- package/package.json +3 -3
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _arrayLikeToArray(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 _arrayWithHoles(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (Array.isArray(arr)) return
|
|
9
|
+
function _arrayWithoutHoles(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function _assertThisInitialized(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 _asyncToGenerator(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 _async_to_generator(fn) {
|
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function _classCallCheck(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 _createClass(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 _defineProperty(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 = _superPropBase(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);
|
|
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 _getPrototypeOf(o) {
|
|
96
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
97
97
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
98
98
|
};
|
|
99
|
-
return
|
|
99
|
+
return _getPrototypeOf(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) _setPrototypeOf(subClass, superClass);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function _iterableToArray(iter) {
|
|
115
115
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function _iterableToArrayLimit(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 _iterable_to_array_limit(arr, i) {
|
|
|
138
138
|
}
|
|
139
139
|
return _arr;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function _nonIterableRest() {
|
|
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 _nonIterableSpread() {
|
|
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 _objectSpread(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,74 +154,50 @@ function _object_spread(target) {
|
|
|
154
154
|
}));
|
|
155
155
|
}
|
|
156
156
|
ownKeys.forEach(function(key) {
|
|
157
|
-
|
|
157
|
+
_defineProperty(target, key, source[key]);
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
return target;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
|
|
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")) {
|
|
162
|
+
function _possibleConstructorReturn(self, call) {
|
|
163
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
188
164
|
return call;
|
|
189
165
|
}
|
|
190
|
-
return
|
|
166
|
+
return _assertThisInitialized(self);
|
|
191
167
|
}
|
|
192
|
-
function
|
|
193
|
-
|
|
168
|
+
function _setPrototypeOf(o, p) {
|
|
169
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
194
170
|
o.__proto__ = p;
|
|
195
171
|
return o;
|
|
196
172
|
};
|
|
197
|
-
return
|
|
173
|
+
return _setPrototypeOf(o, p);
|
|
198
174
|
}
|
|
199
|
-
function
|
|
200
|
-
return
|
|
175
|
+
function _slicedToArray(arr, i) {
|
|
176
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
201
177
|
}
|
|
202
|
-
function
|
|
178
|
+
function _superPropBase(object, property) {
|
|
203
179
|
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
204
|
-
object =
|
|
180
|
+
object = _getPrototypeOf(object);
|
|
205
181
|
if (object === null) break;
|
|
206
182
|
}
|
|
207
183
|
return object;
|
|
208
184
|
}
|
|
209
|
-
function
|
|
210
|
-
return
|
|
185
|
+
function _toConsumableArray(arr) {
|
|
186
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
211
187
|
}
|
|
212
|
-
function
|
|
188
|
+
var _typeof = function(obj) {
|
|
213
189
|
"@swc/helpers - typeof";
|
|
214
190
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
215
|
-
}
|
|
216
|
-
function
|
|
191
|
+
};
|
|
192
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
217
193
|
if (!o) return;
|
|
218
|
-
if (typeof o === "string") return
|
|
194
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
219
195
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
220
196
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
221
197
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
222
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
198
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
223
199
|
}
|
|
224
|
-
function
|
|
200
|
+
function _isNativeReflectConstruct() {
|
|
225
201
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
226
202
|
if (Reflect.construct.sham) return false;
|
|
227
203
|
if (typeof Proxy === "function") return true;
|
|
@@ -232,160 +208,57 @@ function _is_native_reflect_construct() {
|
|
|
232
208
|
return false;
|
|
233
209
|
}
|
|
234
210
|
}
|
|
235
|
-
function
|
|
236
|
-
var hasNativeReflectConstruct =
|
|
211
|
+
function _createSuper(Derived) {
|
|
212
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
237
213
|
return function _createSuperInternal() {
|
|
238
|
-
var Super =
|
|
214
|
+
var Super = _getPrototypeOf(Derived), result;
|
|
239
215
|
if (hasNativeReflectConstruct) {
|
|
240
|
-
var NewTarget =
|
|
216
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
241
217
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
242
218
|
} else {
|
|
243
219
|
result = Super.apply(this, arguments);
|
|
244
220
|
}
|
|
245
|
-
return
|
|
246
|
-
};
|
|
247
|
-
}
|
|
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: []
|
|
221
|
+
return _possibleConstructorReturn(this, result);
|
|
257
222
|
};
|
|
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
223
|
}
|
|
343
|
-
import
|
|
344
|
-
import {
|
|
345
|
-
import {
|
|
346
|
-
import {
|
|
347
|
-
import {
|
|
348
|
-
import {
|
|
349
|
-
import {
|
|
350
|
-
import {
|
|
351
|
-
|
|
224
|
+
import regeneratorRuntime from "regenerator-runtime";
|
|
225
|
+
import { isDataBind } from '@byteluck-fe/model-driven-core';
|
|
226
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from '@byteluck-fe/model-driven-shared';
|
|
227
|
+
import { Runtime } from './Runtime';
|
|
228
|
+
import { Store } from './Store';
|
|
229
|
+
import { findItem, proxyState } from './proxyState';
|
|
230
|
+
import { ActionManager } from './ActionManager';
|
|
231
|
+
import { DataManager } from './DataManager';
|
|
232
|
+
import { checkerSubtableValue, checkerValue } from './checkerValue';
|
|
233
|
+
if (typeof window !== 'undefined') {
|
|
352
234
|
// @ts-ignore
|
|
353
235
|
window.engines = {};
|
|
354
236
|
}
|
|
355
237
|
// setState的时候,存储options中转变量
|
|
356
238
|
var eventOptionsTemp = null;
|
|
357
239
|
// 当前正在注册的插件名称
|
|
358
|
-
var applyingPluginName =
|
|
359
|
-
// 整体渲染引擎 并且 提供发布订阅能力
|
|
360
|
-
|
|
240
|
+
var applyingPluginName = '';
|
|
241
|
+
var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
242
|
+
/*#__PURE__*/ function(Watcher1) {
|
|
361
243
|
"use strict";
|
|
362
|
-
_inherits(Engine,
|
|
363
|
-
var _super =
|
|
244
|
+
_inherits(Engine, Watcher1);
|
|
245
|
+
var _super = _createSuper(Engine);
|
|
364
246
|
function Engine(props) {
|
|
365
|
-
|
|
247
|
+
_classCallCheck(this, Engine);
|
|
366
248
|
var _this;
|
|
367
249
|
_this = _super.call(this);
|
|
368
|
-
|
|
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);
|
|
250
|
+
_this.rawStore = {};
|
|
373
251
|
// 提供子线程处理脚本以及修改数据的能力
|
|
374
252
|
// public worker: OkWorker
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
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);
|
|
253
|
+
_this.isMounted = false;
|
|
254
|
+
_this.id = genNonDuplicateId(8);
|
|
255
|
+
_this.__pluginsApplied = false;
|
|
256
|
+
_this.actionManager = new ActionManager();
|
|
257
|
+
_this._jobTasks = [];
|
|
258
|
+
_this.createControlInstance = _this.createInstance;
|
|
386
259
|
_this.$options = Object.freeze(props);
|
|
387
|
-
var
|
|
388
|
-
language, language =
|
|
260
|
+
var _$options = _this.$options, _autoMount = _$options.autoMount, autoMount = _autoMount === void 0 ? true : _autoMount, schema = _$options.schema, beforeCreateInstance = _$options.beforeCreateInstance, externalParams = _$options.externalParams, _language = _$options.// fieldModel,
|
|
261
|
+
language, language = _language === void 0 ? DEFAULT_LOCALE : _language, _debug = _$options.debug, debug = _debug === void 0 ? false : _debug;
|
|
389
262
|
RulesMessage.setLocale(language);
|
|
390
263
|
_this.debug = debug;
|
|
391
264
|
_this.runtime = new Runtime({
|
|
@@ -396,19 +269,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
396
269
|
_this.store = new Store({
|
|
397
270
|
instance: _this.runtime.instance
|
|
398
271
|
});
|
|
399
|
-
_this.debugLog(
|
|
272
|
+
_this.debugLog('engine is Instantiation complete');
|
|
400
273
|
// 自动执行挂载完成,也可以手动调用mount方法
|
|
401
274
|
autoMount && _this.mount();
|
|
402
275
|
return _this;
|
|
403
276
|
}
|
|
404
|
-
|
|
277
|
+
_createClass(Engine, [
|
|
405
278
|
{
|
|
406
279
|
key: "debugLog",
|
|
407
280
|
value: function debugLog() {
|
|
408
281
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
409
282
|
args[_key] = arguments[_key];
|
|
410
283
|
}
|
|
411
|
-
this.debug && log.apply(void 0,
|
|
284
|
+
this.debug && log.apply(void 0, _toConsumableArray(args));
|
|
412
285
|
}
|
|
413
286
|
},
|
|
414
287
|
{
|
|
@@ -427,8 +300,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
427
300
|
for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
|
|
428
301
|
arg[_key] = arguments[_key];
|
|
429
302
|
}
|
|
430
|
-
var
|
|
431
|
-
(
|
|
303
|
+
var _runtime;
|
|
304
|
+
(_runtime = this.runtime).register.apply(_runtime, _toConsumableArray(arg));
|
|
432
305
|
return this;
|
|
433
306
|
}
|
|
434
307
|
},
|
|
@@ -436,14 +309,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
436
309
|
key: "mount",
|
|
437
310
|
value: function mount() {
|
|
438
311
|
this.debugLog("engine的mount方法开始调用");
|
|
439
|
-
var
|
|
312
|
+
var _$options = this.$options, _plugins = _$options.plugins, plugins = _plugins === void 0 ? [] : _plugins;
|
|
440
313
|
this._handlerProxyState();
|
|
441
314
|
this.__plugins = plugins;
|
|
442
315
|
this.applyPlugins();
|
|
443
316
|
// 触发所有控件的默认值的change事件
|
|
444
317
|
this.setStates(this.getState());
|
|
445
318
|
this.debugLog("engine的mount方法调用结束");
|
|
446
|
-
if (this.debug && typeof window !==
|
|
319
|
+
if (this.debug && typeof window !== 'undefined') {
|
|
447
320
|
// @ts-ignore
|
|
448
321
|
window.engines[this.id] = this;
|
|
449
322
|
}
|
|
@@ -452,7 +325,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
452
325
|
{
|
|
453
326
|
key: "destroy",
|
|
454
327
|
value: function destroy() {
|
|
455
|
-
if (this.debug && typeof window !==
|
|
328
|
+
if (this.debug && typeof window !== 'undefined') {
|
|
456
329
|
// @ts-ignore
|
|
457
330
|
delete window.engines[this.id];
|
|
458
331
|
}
|
|
@@ -474,6 +347,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
474
347
|
}
|
|
475
348
|
// @ts-ignore
|
|
476
349
|
if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE)) {
|
|
350
|
+
var ref;
|
|
477
351
|
if (newValue === null) {
|
|
478
352
|
return [];
|
|
479
353
|
}
|
|
@@ -488,12 +362,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
488
362
|
}, {});
|
|
489
363
|
// @ts-ignore
|
|
490
364
|
var emptyState = this.getEmptyState(instance.id);
|
|
491
|
-
return newValue === null ||
|
|
492
|
-
|
|
493
|
-
checkerSubtableValue(fieldTypeMap, row, emptyState)
|
|
365
|
+
return (ref = newValue) === null || ref === void 0 ? void 0 : ref.map(function(row) {
|
|
366
|
+
// @ts-ignore
|
|
367
|
+
return checkerSubtableValue(fieldTypeMap, row, emptyState);
|
|
494
368
|
});
|
|
495
369
|
}
|
|
496
|
-
var keys = key.split(
|
|
370
|
+
var keys = key.split('.');
|
|
497
371
|
var lastKey = keys[keys.length - 1];
|
|
498
372
|
try {
|
|
499
373
|
return checkerValue(instance.fieldType, lastKey, newValue, oldValue);
|
|
@@ -526,7 +400,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
526
400
|
var newRows = [];
|
|
527
401
|
for(var i = 0; i < len; i++){
|
|
528
402
|
// @ts-ignore
|
|
529
|
-
var row = _this.listControlCreateRow(subtable,
|
|
403
|
+
var row = _this.listControlCreateRow(subtable, 'subtable-row');
|
|
530
404
|
row && newRows.push(row);
|
|
531
405
|
}
|
|
532
406
|
// @ts-ignore
|
|
@@ -541,19 +415,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
541
415
|
if (type && args) {
|
|
542
416
|
// const subtableOldLength = subtable.children.length
|
|
543
417
|
switch(type){
|
|
544
|
-
case
|
|
545
|
-
case
|
|
546
|
-
var
|
|
418
|
+
case 'push':
|
|
419
|
+
case 'unshift':
|
|
420
|
+
var _children;
|
|
547
421
|
var newRowLengths = args.length;
|
|
548
422
|
createdNewRows = createRows(newRowLengths);
|
|
549
423
|
createdNewRowsData = args;
|
|
550
|
-
(
|
|
424
|
+
(_children = subtable.children)[type].apply(_children, _toConsumableArray(createdNewRows));
|
|
551
425
|
this.runtime.getFlatInstances();
|
|
552
426
|
break;
|
|
553
|
-
case
|
|
427
|
+
case 'splice':
|
|
554
428
|
if (args.length > 2) {
|
|
555
429
|
var // @ts-ignore
|
|
556
|
-
|
|
430
|
+
_children1;
|
|
557
431
|
var newRowLengths1 = args.length - 2;
|
|
558
432
|
var newValues = args.slice(2);
|
|
559
433
|
createdNewRows = createRows(newRowLengths1);
|
|
@@ -562,10 +436,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
562
436
|
var start = args[0];
|
|
563
437
|
// 替换几个
|
|
564
438
|
var replace = args[1];
|
|
565
|
-
(
|
|
439
|
+
(_children1 = subtable.children)[type].apply(_children1, [
|
|
566
440
|
start,
|
|
567
441
|
replace
|
|
568
|
-
].concat(
|
|
442
|
+
].concat(_toConsumableArray(createdNewRows)));
|
|
569
443
|
this.runtime.getFlatInstances();
|
|
570
444
|
// newValues.forEach((item: any, index) => {
|
|
571
445
|
// let newIndex = start + index
|
|
@@ -573,7 +447,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
573
447
|
// })
|
|
574
448
|
} else {
|
|
575
449
|
var // @ts-ignore
|
|
576
|
-
|
|
450
|
+
_children2;
|
|
577
451
|
// 从哪儿开始
|
|
578
452
|
var start1 = args[0];
|
|
579
453
|
// 替换几个
|
|
@@ -581,28 +455,28 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
581
455
|
if (start1 + replace1 === subtable.children.length - 1) {
|
|
582
456
|
isDeleteLastOne = true;
|
|
583
457
|
}
|
|
584
|
-
(
|
|
458
|
+
(_children2 = subtable.children)[type].apply(_children2, _toConsumableArray(args));
|
|
585
459
|
this.runtime.getFlatInstances();
|
|
586
460
|
}
|
|
587
461
|
break;
|
|
588
462
|
default:
|
|
589
463
|
var // @ts-ignore
|
|
590
|
-
|
|
591
|
-
(
|
|
464
|
+
_children3;
|
|
465
|
+
(_children3 = subtable.children)[type].apply(_children3, _toConsumableArray(args));
|
|
592
466
|
this.runtime.getFlatInstances();
|
|
593
467
|
break;
|
|
594
468
|
}
|
|
595
|
-
if (type ===
|
|
469
|
+
if (type === 'splice') {
|
|
596
470
|
deleted = result;
|
|
597
471
|
} else if ([
|
|
598
|
-
|
|
599
|
-
|
|
472
|
+
'pop',
|
|
473
|
+
'shift'
|
|
600
474
|
].includes(type)) {
|
|
601
475
|
deleted = [
|
|
602
476
|
result
|
|
603
477
|
];
|
|
604
478
|
}
|
|
605
|
-
this.emit(
|
|
479
|
+
this.emit('list-change', {
|
|
606
480
|
instance: subtable,
|
|
607
481
|
value: this.getState(subtable.id),
|
|
608
482
|
options: Object.assign({}, options, {
|
|
@@ -630,26 +504,26 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
630
504
|
// if (instance instanceof RuntimeListControl) {
|
|
631
505
|
if (instance.controlType === CONTROL_BASE_TYPE.LIST) {
|
|
632
506
|
var // @ts-ignore
|
|
633
|
-
|
|
507
|
+
_children;
|
|
634
508
|
instance.children.length = 0;
|
|
635
509
|
var newValue = value;
|
|
636
510
|
// @ts-ignore
|
|
637
511
|
var newRows = [];
|
|
638
512
|
for(var i = 0; i < newValue.length; i++){
|
|
639
513
|
// @ts-ignore
|
|
640
|
-
var row = this.listControlCreateRow(instance,
|
|
514
|
+
var row = this.listControlCreateRow(instance, 'subtable-row');
|
|
641
515
|
row && newRows.push(row);
|
|
642
516
|
}
|
|
643
|
-
(
|
|
517
|
+
(_children = instance.children).push.apply(_children, _toConsumableArray(newRows));
|
|
644
518
|
this.runtime.getFlatInstances();
|
|
645
519
|
// 这里已经能拿到控件实例,所以在这里触发setStates,触发每一行每一个控件的change事件
|
|
646
520
|
// for (let i = 0; i < newValue.length; i++) {
|
|
647
521
|
// this.setStates(newValue[i], i, options)
|
|
648
522
|
// }
|
|
649
|
-
this.emit(
|
|
523
|
+
this.emit('list-change', {
|
|
650
524
|
instance: instance,
|
|
651
525
|
value: value,
|
|
652
|
-
options:
|
|
526
|
+
options: _objectSpread({}, options, {
|
|
653
527
|
// @ts-ignore
|
|
654
528
|
changed: newRows,
|
|
655
529
|
data: newValue,
|
|
@@ -657,11 +531,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
657
531
|
})
|
|
658
532
|
});
|
|
659
533
|
} else {
|
|
660
|
-
this.emit(
|
|
534
|
+
this.emit('change', {
|
|
661
535
|
instance: instance,
|
|
662
536
|
value: this.getState(instance.id, index),
|
|
663
537
|
rowIndex: index,
|
|
664
|
-
options:
|
|
538
|
+
options: _objectSpread({}, options, {
|
|
665
539
|
oldValue: oldValue
|
|
666
540
|
})
|
|
667
541
|
});
|
|
@@ -675,13 +549,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
675
549
|
if (this.__pluginsApplied) return;
|
|
676
550
|
this.__plugins.forEach(function(plugin) {
|
|
677
551
|
try {
|
|
678
|
-
var
|
|
679
|
-
applyingPluginName = (
|
|
552
|
+
var _pluginName;
|
|
553
|
+
applyingPluginName = (_pluginName = plugin.pluginName) !== null && _pluginName !== void 0 ? _pluginName : plugin.constructor.name;
|
|
680
554
|
plugin.apply(_this);
|
|
681
555
|
} catch (e) {
|
|
682
556
|
error("".concat(applyingPluginName, " Plugin apply Error \n ").concat(e));
|
|
683
557
|
} finally{
|
|
684
|
-
applyingPluginName =
|
|
558
|
+
applyingPluginName = '';
|
|
685
559
|
}
|
|
686
560
|
});
|
|
687
561
|
this.__pluginsApplied = true;
|
|
@@ -695,12 +569,34 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
695
569
|
// if (row instanceof RuntimeLayoutControl) {
|
|
696
570
|
// @ts-ignore
|
|
697
571
|
if (row.controlType === CONTROL_BASE_TYPE.LAYOUT) {
|
|
698
|
-
var
|
|
572
|
+
var _children;
|
|
699
573
|
var inst = row;
|
|
700
574
|
var template = JSONCopy(instance.props.headers);
|
|
701
575
|
// @ts-ignore
|
|
702
576
|
var columns = this.createControl(template);
|
|
703
|
-
|
|
577
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
578
|
+
try {
|
|
579
|
+
for(var _iterator = columns[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
580
|
+
var column = _step.value;
|
|
581
|
+
if (!column.parent) {
|
|
582
|
+
this.runtime.resetInstanceParent(column, inst);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
} catch (err) {
|
|
586
|
+
_didIteratorError = true;
|
|
587
|
+
_iteratorError = err;
|
|
588
|
+
} finally{
|
|
589
|
+
try {
|
|
590
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
591
|
+
_iterator.return();
|
|
592
|
+
}
|
|
593
|
+
} finally{
|
|
594
|
+
if (_didIteratorError) {
|
|
595
|
+
throw _iteratorError;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
(_children = inst.children).push.apply(_children, _toConsumableArray(columns));
|
|
704
600
|
}
|
|
705
601
|
//@ts-ignore
|
|
706
602
|
row.parent = instance;
|
|
@@ -711,7 +607,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
711
607
|
key: "listControlAddRow",
|
|
712
608
|
value: function listControlAddRow(instance) {
|
|
713
609
|
var // @ts-ignore
|
|
714
|
-
rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] :
|
|
610
|
+
rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'subtable-row';
|
|
715
611
|
var row = this.listControlCreateRow(instance, rowType);
|
|
716
612
|
if (!row) return;
|
|
717
613
|
instance.children.push(row);
|
|
@@ -723,42 +619,39 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
723
619
|
function emit(eventKey, payload) {
|
|
724
620
|
var _this = this;
|
|
725
621
|
var _this1 = this, _superprop_get_emit = function() {
|
|
726
|
-
return _get(
|
|
622
|
+
return _get(_getPrototypeOf(Engine.prototype), "emit", _this);
|
|
727
623
|
};
|
|
728
|
-
return
|
|
624
|
+
return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
|
729
625
|
var needWait, promiseResolver, promise, results;
|
|
730
|
-
return
|
|
731
|
-
switch(
|
|
626
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
627
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
732
628
|
case 0:
|
|
733
|
-
if (!(eventKey ===
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
if (_this1.isMounted) {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
2,
|
|
741
|
-
Promise.resolve([])
|
|
742
|
-
];
|
|
629
|
+
if (!(eventKey === 'engine-mounted')) {
|
|
630
|
+
_ctx.next = 11;
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
if (!_this1.isMounted) {
|
|
634
|
+
_ctx.next = 4;
|
|
635
|
+
break;
|
|
743
636
|
}
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
console.timeEnd(
|
|
757
|
-
|
|
758
|
-
case 2:
|
|
637
|
+
warn('The engine-mounted life cycle can only be triggered once');
|
|
638
|
+
return _ctx.abrupt("return", Promise.resolve([]));
|
|
639
|
+
case 4:
|
|
640
|
+
if (!_this1._jobTasks.length) {
|
|
641
|
+
_ctx.next = 10;
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
console.time('engine-mounted need wait');
|
|
645
|
+
needWait = _toConsumableArray(_this1._jobTasks);
|
|
646
|
+
_ctx.next = 9;
|
|
647
|
+
return Promise.all(needWait);
|
|
648
|
+
case 9:
|
|
649
|
+
console.timeEnd('engine-mounted need wait');
|
|
650
|
+
case 10:
|
|
759
651
|
_this1.isMounted = true;
|
|
760
|
-
|
|
761
|
-
|
|
652
|
+
case 11:
|
|
653
|
+
;
|
|
654
|
+
;
|
|
762
655
|
// 如果没有挂载的话,需要记录在挂载之前触发的所有任务
|
|
763
656
|
if (!_this1.isMounted) {
|
|
764
657
|
promise = new Promise(function(resolve) {
|
|
@@ -766,24 +659,22 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
766
659
|
});
|
|
767
660
|
_this1._jobTasks.push(promise);
|
|
768
661
|
}
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
case 4:
|
|
774
|
-
results = _state.sent();
|
|
662
|
+
_ctx.next = 16;
|
|
663
|
+
return _superprop_get_emit().call(_this1, eventKey, payload);
|
|
664
|
+
case 16:
|
|
665
|
+
results = _ctx.sent;
|
|
775
666
|
if (promiseResolver && promise) {
|
|
776
667
|
// 每一个任务完成的时候,都把自己从task中去掉
|
|
777
668
|
promiseResolver();
|
|
778
669
|
_this1._jobTasks.splice(_this1._jobTasks.indexOf(promise), 1);
|
|
779
670
|
}
|
|
780
|
-
return
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
671
|
+
return _ctx.abrupt("return", results);
|
|
672
|
+
case 19:
|
|
673
|
+
case "end":
|
|
674
|
+
return _ctx.stop();
|
|
784
675
|
}
|
|
785
|
-
});
|
|
786
|
-
})();
|
|
676
|
+
}, _callee);
|
|
677
|
+
}))();
|
|
787
678
|
}
|
|
788
679
|
},
|
|
789
680
|
{
|
|
@@ -792,7 +683,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
792
683
|
if (applyingPluginName) {
|
|
793
684
|
callback.applyingPluginName = applyingPluginName;
|
|
794
685
|
}
|
|
795
|
-
return _get(
|
|
686
|
+
return _get(_getPrototypeOf(Engine.prototype), "on", this).call(this, key, callback);
|
|
796
687
|
}
|
|
797
688
|
},
|
|
798
689
|
{
|
|
@@ -801,8 +692,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
801
692
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
802
693
|
args[_key] = arguments[_key];
|
|
803
694
|
}
|
|
804
|
-
var
|
|
805
|
-
return (
|
|
695
|
+
var _runtime;
|
|
696
|
+
return (_runtime = this.runtime).createControl.apply(_runtime, _toConsumableArray(args));
|
|
806
697
|
}
|
|
807
698
|
},
|
|
808
699
|
{
|
|
@@ -836,10 +727,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
836
727
|
if (controlId === undefined) {
|
|
837
728
|
return rules;
|
|
838
729
|
} else {
|
|
839
|
-
var
|
|
730
|
+
var ref, ref1;
|
|
840
731
|
return {
|
|
841
|
-
rules: (
|
|
842
|
-
antdRules: (
|
|
732
|
+
rules: (ref = rules.rules[controlId]) === null || ref === void 0 ? void 0 : ref.fields,
|
|
733
|
+
antdRules: (ref1 = rules.antdRules[controlId]) === null || ref1 === void 0 ? void 0 : ref1.fields
|
|
843
734
|
};
|
|
844
735
|
}
|
|
845
736
|
}
|
|
@@ -850,8 +741,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
850
741
|
if (controlId === undefined) {
|
|
851
742
|
return this.runtime.rules;
|
|
852
743
|
} else {
|
|
853
|
-
var
|
|
854
|
-
return (
|
|
744
|
+
var ref;
|
|
745
|
+
return (ref = this.runtime.rules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
|
|
855
746
|
}
|
|
856
747
|
}
|
|
857
748
|
},
|
|
@@ -861,8 +752,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
861
752
|
if (controlId === undefined) {
|
|
862
753
|
return this.runtime.antdRules;
|
|
863
754
|
} else {
|
|
864
|
-
var
|
|
865
|
-
return (
|
|
755
|
+
var ref;
|
|
756
|
+
return (ref = this.runtime.antdRules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
|
|
866
757
|
}
|
|
867
758
|
}
|
|
868
759
|
},
|
|
@@ -899,9 +790,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
899
790
|
key: "setState",
|
|
900
791
|
value: function setState(controlId, value, rowIndex, options) {
|
|
901
792
|
eventOptionsTemp = options;
|
|
902
|
-
this.debugLog(
|
|
793
|
+
this.debugLog('[%o]: 触发setState, 修改的值为%o, rowIndex=%o, options=%o', controlId, value, rowIndex, options);
|
|
903
794
|
this.store.setState(controlId, value, rowIndex);
|
|
904
|
-
this.debugLog(
|
|
795
|
+
this.debugLog('[%o]: setState完成, 修改的值为%o, rowIndex=%o', controlId, value, rowIndex);
|
|
905
796
|
eventOptionsTemp = null;
|
|
906
797
|
}
|
|
907
798
|
},
|
|
@@ -914,19 +805,20 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
914
805
|
var _this = this;
|
|
915
806
|
var newStates = states !== null && states !== void 0 ? states : {};
|
|
916
807
|
Object.keys(newStates).forEach(function(stateId) {
|
|
808
|
+
var _this2 = _this;
|
|
917
809
|
Object.entries(_this.store.controlIdMapping).forEach(function(param) {
|
|
918
|
-
var _param =
|
|
810
|
+
var _param = _slicedToArray(param, 2), controlId = _param[0], controlIdMapping = _param[1];
|
|
919
811
|
if (controlIdMapping.dataView === stateId) {
|
|
920
812
|
// state对象是dataView包裹的
|
|
921
813
|
var value = newStates[stateId][controlId];
|
|
922
814
|
if (value !== undefined) {
|
|
923
|
-
|
|
815
|
+
_this2.setState(controlId, value, rowIndex, options);
|
|
924
816
|
}
|
|
925
817
|
} else {
|
|
926
818
|
// state对象是单独的,没有被dataView包裹的
|
|
927
819
|
if (controlId === stateId || controlIdMapping.children && controlIdMapping.children[stateId]) {
|
|
928
820
|
if (newStates[stateId] !== undefined) {
|
|
929
|
-
|
|
821
|
+
_this2.setState(stateId, newStates[stateId], rowIndex, options);
|
|
930
822
|
}
|
|
931
823
|
}
|
|
932
824
|
}
|
|
@@ -954,12 +846,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
954
846
|
if (!dataBindMapping1) {
|
|
955
847
|
return;
|
|
956
848
|
}
|
|
957
|
-
var
|
|
849
|
+
var dataBind1 = dataBindMapping1.dataBind, controlId1 = dataBindMapping1.controlId;
|
|
958
850
|
var state = this.getState(controlId1, rowIndex);
|
|
959
851
|
//if (dataBind instanceof ObjectDataBind) {
|
|
960
|
-
if (!isDataBind(
|
|
961
|
-
return Object.entries(
|
|
962
|
-
var _param =
|
|
852
|
+
if (!isDataBind(dataBind1)) {
|
|
853
|
+
return Object.entries(dataBind1).reduce(function(result, param) {
|
|
854
|
+
var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
|
|
963
855
|
// objectDataBind的元素,跳过下一次赋值
|
|
964
856
|
if (dataBind.fieldCode === fieldCode) {
|
|
965
857
|
return result[key];
|
|
@@ -985,18 +877,18 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
985
877
|
var data = getFieldData.map(function(item) {
|
|
986
878
|
var obj = {};
|
|
987
879
|
for(var key in item){
|
|
988
|
-
var
|
|
989
|
-
var fieldCode = (
|
|
880
|
+
var ref, ref2, ref3;
|
|
881
|
+
var fieldCode = (ref2 = (ref = controlIdMapping[controlId]) === null || ref === void 0 ? void 0 : ref.children[key]) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.dataBind) === null || ref3 === void 0 ? void 0 : ref3.fieldCode;
|
|
990
882
|
//未绑定字段的控件,直接抛弃
|
|
991
|
-
if (fieldCode !==
|
|
992
|
-
var
|
|
883
|
+
if (fieldCode !== '') {
|
|
884
|
+
var ref4;
|
|
993
885
|
if (fieldCode) {
|
|
994
886
|
obj[fieldCode] = item[key];
|
|
995
|
-
} else if ((
|
|
887
|
+
} else if ((ref4 = controlIdMapping[controlId]) === null || ref4 === void 0 ? void 0 : ref4.children[key]) {
|
|
996
888
|
// 兼容一个控件需要绑定多个字段的情况
|
|
997
889
|
for(var keyChi in item[key]){
|
|
998
|
-
var
|
|
999
|
-
obj[(
|
|
890
|
+
var ref5, ref6;
|
|
891
|
+
obj[(ref6 = (ref5 = controlIdMapping[controlId]) === null || ref5 === void 0 ? void 0 : ref5.children[key]) === null || ref6 === void 0 ? void 0 : ref6.dataBind[keyChi].fieldCode] = item[key][keyChi];
|
|
1000
892
|
}
|
|
1001
893
|
}
|
|
1002
894
|
}
|
|
@@ -1005,45 +897,45 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1005
897
|
});
|
|
1006
898
|
return data;
|
|
1007
899
|
} else {
|
|
1008
|
-
var _loop = function(
|
|
1009
|
-
var
|
|
1010
|
-
if ((
|
|
1011
|
-
var
|
|
1012
|
-
|
|
1013
|
-
} else if ((
|
|
1014
|
-
var
|
|
900
|
+
var _loop = function(key1) {
|
|
901
|
+
var ref15, ref7, ref8, ref9;
|
|
902
|
+
if ((ref15 = controlIdMapping[key1]) === null || ref15 === void 0 ? void 0 : (ref7 = ref15.dataBind) === null || ref7 === void 0 ? void 0 : ref7.fieldCode) {
|
|
903
|
+
var ref10;
|
|
904
|
+
obj1[(ref10 = controlIdMapping[key1]) === null || ref10 === void 0 ? void 0 : ref10.dataBind.fieldCode] = getFieldData[key1];
|
|
905
|
+
} else if ((ref8 = controlIdMapping[key1]) === null || ref8 === void 0 ? void 0 : (ref9 = ref8.dataBind) === null || ref9 === void 0 ? void 0 : ref9.dataCode) {
|
|
906
|
+
var ref11;
|
|
1015
907
|
// 明细字表只循环一层明细子表未递归
|
|
1016
|
-
|
|
908
|
+
obj1[(ref11 = controlIdMapping[key1]) === null || ref11 === void 0 ? void 0 : ref11.dataBind.dataCode] = getFieldData[key1].map(function(item) {
|
|
1017
909
|
var objChi = {};
|
|
1018
910
|
for(var keyChi in item){
|
|
1019
|
-
var
|
|
1020
|
-
var fieldCode = (
|
|
911
|
+
var ref;
|
|
912
|
+
var fieldCode = (ref = controlIdMapping[key1].children[keyChi]) === null || ref === void 0 ? void 0 : ref.dataBind.fieldCode;
|
|
1021
913
|
//未绑定字段的控件,直接抛弃
|
|
1022
|
-
if (fieldCode !==
|
|
914
|
+
if (fieldCode !== '') {
|
|
1023
915
|
if (fieldCode) {
|
|
1024
916
|
objChi[fieldCode] = item[keyChi];
|
|
1025
917
|
} else {
|
|
1026
918
|
for(var keyChi1 in item[keyChi]){
|
|
1027
|
-
var
|
|
1028
|
-
objChi[(
|
|
919
|
+
var ref14;
|
|
920
|
+
objChi[(ref14 = controlIdMapping[key1].children[keyChi]) === null || ref14 === void 0 ? void 0 : ref14.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
|
|
1029
921
|
}
|
|
1030
922
|
}
|
|
1031
923
|
}
|
|
1032
924
|
}
|
|
1033
925
|
return objChi;
|
|
1034
926
|
});
|
|
1035
|
-
} else if (controlIdMapping[
|
|
927
|
+
} else if (controlIdMapping[key1]) {
|
|
1036
928
|
// 兼容一个控件需要绑定多个字段的情况
|
|
1037
|
-
for(var
|
|
1038
|
-
var
|
|
1039
|
-
|
|
929
|
+
for(var keyChi2 in getFieldData[key1]){
|
|
930
|
+
var ref12, ref13;
|
|
931
|
+
obj1[(ref13 = (ref12 = controlIdMapping[key1]) === null || ref12 === void 0 ? void 0 : ref12.dataBind[keyChi2]) === null || ref13 === void 0 ? void 0 : ref13.fieldCode] = getFieldData[key1][keyChi2];
|
|
1040
932
|
}
|
|
1041
933
|
}
|
|
1042
934
|
};
|
|
1043
935
|
// 主表
|
|
1044
|
-
var
|
|
1045
|
-
for(var
|
|
1046
|
-
return
|
|
936
|
+
var obj1 = {};
|
|
937
|
+
for(var key1 in getFieldData)_loop(key1);
|
|
938
|
+
return obj1;
|
|
1047
939
|
}
|
|
1048
940
|
}
|
|
1049
941
|
return;
|
|
@@ -1063,14 +955,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1063
955
|
if (!dataBindMapping) {
|
|
1064
956
|
return;
|
|
1065
957
|
}
|
|
1066
|
-
var
|
|
958
|
+
var dataBind2 = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
|
|
1067
959
|
// if (dataBind instanceof ObjectDataBind) {
|
|
1068
|
-
if (!isDataBind(
|
|
1069
|
-
var
|
|
1070
|
-
var oldState = (
|
|
960
|
+
if (!isDataBind(dataBind2)) {
|
|
961
|
+
var ref;
|
|
962
|
+
var oldState = (ref = JSONCopy(this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : this.getEmptyState(controlId);
|
|
1071
963
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1072
|
-
var newState = Object.entries(
|
|
1073
|
-
var _param =
|
|
964
|
+
var newState = Object.entries(dataBind2).reduce(function(result, param) {
|
|
965
|
+
var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
|
|
1074
966
|
// objectDataBind的元素,跳过下一次赋值
|
|
1075
967
|
if (dataBind.fieldCode === fieldCode) {
|
|
1076
968
|
result[key] = value;
|
|
@@ -1099,7 +991,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1099
991
|
}
|
|
1100
992
|
var skipKeys = [];
|
|
1101
993
|
mapping.fields.forEach(function(item) {
|
|
1102
|
-
var
|
|
994
|
+
var dataBind3 = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
|
|
1103
995
|
if (skipKeys.includes(fieldCode)) {
|
|
1104
996
|
return;
|
|
1105
997
|
}
|
|
@@ -1108,12 +1000,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1108
1000
|
}
|
|
1109
1001
|
// 对象类型的值
|
|
1110
1002
|
// if (dataBind instanceof ObjectDataBind) {
|
|
1111
|
-
if (!isDataBind(
|
|
1112
|
-
var
|
|
1113
|
-
var oldState = (
|
|
1003
|
+
if (!isDataBind(dataBind3)) {
|
|
1004
|
+
var ref;
|
|
1005
|
+
var oldState = (ref = JSONCopy(_this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : _this.getEmptyState(controlId);
|
|
1114
1006
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1115
|
-
var newState = Object.entries(
|
|
1116
|
-
var _param =
|
|
1007
|
+
var newState = Object.entries(dataBind3).reduce(function(result, param) {
|
|
1008
|
+
var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
|
|
1117
1009
|
// objectDataBind的元素,跳过下一次赋值
|
|
1118
1010
|
skipKeys.push(dataBind.fieldCode);
|
|
1119
1011
|
var value = state[dataBind.fieldCode];
|
|
@@ -1142,9 +1034,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1142
1034
|
return;
|
|
1143
1035
|
}
|
|
1144
1036
|
var skipKeys = [];
|
|
1145
|
-
var
|
|
1037
|
+
var result1 = {};
|
|
1146
1038
|
mapping.fields.forEach(function(item) {
|
|
1147
|
-
var
|
|
1039
|
+
var dataBind4 = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
|
|
1148
1040
|
if (skipKeys.includes(fieldCode)) {
|
|
1149
1041
|
return;
|
|
1150
1042
|
}
|
|
@@ -1153,11 +1045,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1153
1045
|
}
|
|
1154
1046
|
// 对象类型的值
|
|
1155
1047
|
// if (dataBind instanceof ObjectDataBind) {
|
|
1156
|
-
if (!isDataBind(
|
|
1048
|
+
if (!isDataBind(dataBind4)) {
|
|
1157
1049
|
var oldState = _this.getEmptyState(controlId);
|
|
1158
1050
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1159
|
-
|
|
1160
|
-
var _param =
|
|
1051
|
+
result1[item.controlId] = Object.entries(dataBind4).reduce(function(result, param) {
|
|
1052
|
+
var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
|
|
1161
1053
|
// objectDataBind的元素,跳过下一次赋值
|
|
1162
1054
|
skipKeys.push(dataBind.fieldCode);
|
|
1163
1055
|
var value = state[dataBind.fieldCode];
|
|
@@ -1167,10 +1059,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1167
1059
|
return result;
|
|
1168
1060
|
}, oldState);
|
|
1169
1061
|
} else {
|
|
1170
|
-
|
|
1062
|
+
result1[controlId] = state[fieldCode];
|
|
1171
1063
|
}
|
|
1172
1064
|
});
|
|
1173
|
-
return
|
|
1065
|
+
return result1;
|
|
1174
1066
|
}
|
|
1175
1067
|
},
|
|
1176
1068
|
{
|
|
@@ -1180,13 +1072,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1180
1072
|
* @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
|
|
1181
1073
|
*/ key: "setData",
|
|
1182
1074
|
value: function setData(dataSet, options) {
|
|
1183
|
-
var
|
|
1075
|
+
var _this6 = this;
|
|
1184
1076
|
this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
|
|
1185
1077
|
var newState = this.store.defaultState;
|
|
1186
1078
|
Object.keys(dataSet).map(function(dataCode) {
|
|
1187
1079
|
var entity = dataSet[dataCode];
|
|
1188
1080
|
if (Array.isArray(entity)) {
|
|
1189
|
-
var
|
|
1081
|
+
var _this4 = _this6;
|
|
1082
|
+
var mapping = _this6.getDataBindMapping(dataCode);
|
|
1190
1083
|
if (!mapping) {
|
|
1191
1084
|
return;
|
|
1192
1085
|
}
|
|
@@ -1194,21 +1087,22 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1194
1087
|
newState[mapping.dataViewId] = {};
|
|
1195
1088
|
}
|
|
1196
1089
|
if (!entity.length) {
|
|
1197
|
-
var
|
|
1198
|
-
newState[mapping.dataViewId][mapping.controlId] = (
|
|
1090
|
+
var _controlId;
|
|
1091
|
+
newState[mapping.dataViewId][mapping.controlId] = (_controlId = newState[mapping.dataViewId][mapping.controlId]) !== null && _controlId !== void 0 ? _controlId : [];
|
|
1199
1092
|
} else {
|
|
1200
1093
|
newState[mapping.dataViewId][mapping.controlId] = [];
|
|
1201
1094
|
}
|
|
1202
1095
|
entity.map(function(row) {
|
|
1203
|
-
var
|
|
1096
|
+
var _this = _this4;
|
|
1097
|
+
var newRow = JSONCopy(_this4.store.emptyState[mapping.dataViewId][mapping.controlId]);
|
|
1204
1098
|
var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
|
|
1205
1099
|
;
|
|
1206
1100
|
Object.keys(row).map(function(fieldCode) {
|
|
1207
|
-
var
|
|
1101
|
+
var ref, ref18;
|
|
1208
1102
|
if (skipKey.includes(fieldCode)) {
|
|
1209
1103
|
return;
|
|
1210
1104
|
}
|
|
1211
|
-
var fieldMapping = (
|
|
1105
|
+
var fieldMapping = (ref = _this.store.dataBindMapping[dataCode]) === null || ref === void 0 ? void 0 : (ref18 = ref.fields) === null || ref18 === void 0 ? void 0 : ref18.find(function(i) {
|
|
1212
1106
|
return i.fieldCode === fieldCode;
|
|
1213
1107
|
});
|
|
1214
1108
|
if (fieldMapping) {
|
|
@@ -1217,8 +1111,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1217
1111
|
newRow[fieldMapping.controlId] = row[fieldCode];
|
|
1218
1112
|
// } else if (fieldMapping.dataBind instanceof ObjectDataBind) {
|
|
1219
1113
|
} else if (!isDataBind(fieldMapping.dataBind)) {
|
|
1220
|
-
var
|
|
1221
|
-
var objValue = JSONCopy((
|
|
1114
|
+
var ref19;
|
|
1115
|
+
var objValue = JSONCopy((ref19 = _this.getEmptyState(fieldMapping.controlId)) !== null && ref19 !== void 0 ? ref19 : {});
|
|
1222
1116
|
Object.keys(fieldMapping.dataBind).map(function(key) {
|
|
1223
1117
|
var dataBind = fieldMapping.dataBind[key];
|
|
1224
1118
|
if (row[dataBind.fieldCode] !== undefined) {
|
|
@@ -1233,18 +1127,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1233
1127
|
newState[mapping.dataViewId][mapping.controlId].push(newRow);
|
|
1234
1128
|
});
|
|
1235
1129
|
} else if (entity) {
|
|
1236
|
-
var
|
|
1237
|
-
var
|
|
1130
|
+
var ref20;
|
|
1131
|
+
var skipKey1 = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
|
|
1238
1132
|
;
|
|
1239
|
-
var emptyState = JSONCopy(
|
|
1240
|
-
if (!((
|
|
1133
|
+
var emptyState = JSONCopy(_this6.store.emptyState);
|
|
1134
|
+
if (!((ref20 = Object.keys(entity)) === null || ref20 === void 0 ? void 0 : ref20.length)) {
|
|
1241
1135
|
// newState = this.store.defaultState
|
|
1242
1136
|
} else {
|
|
1137
|
+
var _this3 = _this6;
|
|
1243
1138
|
Object.keys(entity).map(function(fieldCode) {
|
|
1244
|
-
if (
|
|
1139
|
+
if (skipKey1.includes(fieldCode)) {
|
|
1245
1140
|
return;
|
|
1246
1141
|
}
|
|
1247
|
-
var mapping =
|
|
1142
|
+
var mapping = _this3.getDataBindMapping(dataCode, fieldCode);
|
|
1248
1143
|
if (mapping) {
|
|
1249
1144
|
if (!newState[mapping.dataViewId[0]]) {
|
|
1250
1145
|
newState[mapping.dataViewId[0]] = {};
|
|
@@ -1254,39 +1149,39 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1254
1149
|
newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
|
|
1255
1150
|
// } else if (mapping.dataBind instanceof ObjectDataBind) {
|
|
1256
1151
|
} else if (!isDataBind(mapping.dataBind)) {
|
|
1257
|
-
var
|
|
1258
|
-
var objValue = (
|
|
1152
|
+
var ref;
|
|
1153
|
+
var objValue = (ref = _this3.getEmptyState(mapping.controlId)) !== null && ref !== void 0 ? ref : {};
|
|
1259
1154
|
Object.keys(mapping.dataBind).map(function(key) {
|
|
1260
1155
|
var dataBind = mapping.dataBind[key];
|
|
1261
1156
|
if (entity[dataBind.fieldCode] !== undefined) {
|
|
1262
1157
|
objValue[key] = entity[dataBind.fieldCode];
|
|
1263
1158
|
}
|
|
1264
|
-
|
|
1159
|
+
skipKey1.push(dataBind.fieldCode);
|
|
1265
1160
|
});
|
|
1266
1161
|
newState[mapping.dataViewId[0]][mapping.controlId] = objValue;
|
|
1267
1162
|
}
|
|
1268
1163
|
}
|
|
1269
1164
|
});
|
|
1270
1165
|
}
|
|
1271
|
-
var newMapping =
|
|
1166
|
+
var newMapping = _this6.getDataBindMapping(dataCode);
|
|
1272
1167
|
if (newMapping) {
|
|
1273
|
-
var
|
|
1274
|
-
var mappingKeys = newMapping === null || newMapping === void 0 ? void 0 : (
|
|
1168
|
+
var ref16;
|
|
1169
|
+
var mappingKeys = newMapping === null || newMapping === void 0 ? void 0 : (ref16 = newMapping.fields) === null || ref16 === void 0 ? void 0 : ref16.map(function(item) {
|
|
1275
1170
|
return item === null || item === void 0 ? void 0 : item.controlId;
|
|
1276
1171
|
});
|
|
1277
|
-
var mappingValue =
|
|
1278
|
-
var
|
|
1279
|
-
var mainStateKeys = Object.keys((
|
|
1172
|
+
var mappingValue = _this6.getEmptyState(newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId);
|
|
1173
|
+
var ref17;
|
|
1174
|
+
var mainStateKeys = Object.keys((ref17 = newState === null || newState === void 0 ? void 0 : newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) !== null && ref17 !== void 0 ? ref17 : {});
|
|
1280
1175
|
mappingKeys === null || mappingKeys === void 0 ? void 0 : mappingKeys.forEach(function(key) {
|
|
1281
|
-
if (!mainStateKeys.includes(key) && key !==
|
|
1176
|
+
if (!mainStateKeys.includes(key) && key !== 'uid' && newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) {
|
|
1282
1177
|
if (Object.keys(newState).length) {
|
|
1283
|
-
Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId],
|
|
1178
|
+
Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId], _defineProperty({}, key, mappingValue[key]));
|
|
1284
1179
|
} else {
|
|
1285
|
-
Object.assign(newState,
|
|
1180
|
+
Object.assign(newState, _defineProperty({}, newMapping.controlId, _defineProperty({}, key, mappingValue[key])));
|
|
1286
1181
|
}
|
|
1287
1182
|
}
|
|
1288
1183
|
});
|
|
1289
|
-
|
|
1184
|
+
_this6.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
|
|
1290
1185
|
}
|
|
1291
1186
|
}
|
|
1292
1187
|
});
|
|
@@ -1397,9 +1292,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1397
1292
|
if (header) {
|
|
1398
1293
|
var instance = instances[0];
|
|
1399
1294
|
if (instance) {
|
|
1400
|
-
var
|
|
1295
|
+
var ref;
|
|
1401
1296
|
// @ts-ignore
|
|
1402
|
-
var parentId = (
|
|
1297
|
+
var parentId = (ref = instance.parent) === null || ref === void 0 ? void 0 : ref.id;
|
|
1403
1298
|
if (parentId) {
|
|
1404
1299
|
instances = this.runtime.instanceMap[parentId] || [];
|
|
1405
1300
|
}
|
|
@@ -1412,16 +1307,16 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1412
1307
|
{
|
|
1413
1308
|
key: "setInstance",
|
|
1414
1309
|
value: function setInstance(instance, props, value, rowIndex) {
|
|
1415
|
-
var _this = this;
|
|
1416
1310
|
try {
|
|
1417
|
-
if (typeof instance ===
|
|
1311
|
+
if (typeof instance === 'string' && rowIndex === -1) {
|
|
1312
|
+
var _this = this;
|
|
1418
1313
|
//修改明细表整列属性的逻辑
|
|
1419
1314
|
var instances = this.getInstances(instance, rowIndex === -1);
|
|
1420
1315
|
instances.map(function(_instance) {
|
|
1421
1316
|
if (_instance) {
|
|
1422
1317
|
_this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
|
|
1423
1318
|
updateValueFromKeys(_instance.props, props, value);
|
|
1424
|
-
_this.schemaEvent(
|
|
1319
|
+
_this.schemaEvent('schema-change', {
|
|
1425
1320
|
instance: _instance,
|
|
1426
1321
|
props: props,
|
|
1427
1322
|
value: value,
|
|
@@ -1430,19 +1325,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1430
1325
|
}
|
|
1431
1326
|
});
|
|
1432
1327
|
} else {
|
|
1433
|
-
var
|
|
1434
|
-
if (typeof instance ===
|
|
1435
|
-
|
|
1328
|
+
var _instance1;
|
|
1329
|
+
if (typeof instance === 'string') {
|
|
1330
|
+
_instance1 = this.getInstance(instance, rowIndex);
|
|
1436
1331
|
} else {
|
|
1437
|
-
|
|
1332
|
+
_instance1 = instance;
|
|
1438
1333
|
}
|
|
1439
|
-
if (!
|
|
1334
|
+
if (!_instance1) {
|
|
1440
1335
|
return;
|
|
1441
1336
|
}
|
|
1442
|
-
this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。",
|
|
1443
|
-
updateValueFromKeys(
|
|
1444
|
-
this.schemaEvent(
|
|
1445
|
-
instance:
|
|
1337
|
+
this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance1.id, _instance1, props, value);
|
|
1338
|
+
updateValueFromKeys(_instance1.props, props, value);
|
|
1339
|
+
this.schemaEvent('schema-change', {
|
|
1340
|
+
instance: _instance1,
|
|
1446
1341
|
props: props,
|
|
1447
1342
|
value: value,
|
|
1448
1343
|
rowIndex: rowIndex
|
|
@@ -1558,7 +1453,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1558
1453
|
CONTROL_TYPE.SUBTABLE_COLUMN);
|
|
1559
1454
|
if (isColumnChild) {
|
|
1560
1455
|
var instanceList = this.runtime.instanceMap[instance.id];
|
|
1561
|
-
if (Object.prototype.toString.call(instanceList) ===
|
|
1456
|
+
if (Object.prototype.toString.call(instanceList) === '[object Array]') {
|
|
1562
1457
|
var index = instanceList.findIndex(function(item) {
|
|
1563
1458
|
return item === instance;
|
|
1564
1459
|
});
|
|
@@ -1621,8 +1516,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1621
1516
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
1622
1517
|
args[_key] = arguments[_key];
|
|
1623
1518
|
}
|
|
1624
|
-
var
|
|
1625
|
-
return (
|
|
1519
|
+
var _runtime;
|
|
1520
|
+
return (_runtime = this.runtime).registerControlConfig.apply(_runtime, _toConsumableArray(args));
|
|
1626
1521
|
}
|
|
1627
1522
|
},
|
|
1628
1523
|
{
|
|
@@ -1634,12 +1529,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1634
1529
|
{
|
|
1635
1530
|
key: "inList",
|
|
1636
1531
|
value: function inList(controlId) {
|
|
1637
|
-
var
|
|
1638
|
-
var mapping = (
|
|
1532
|
+
var _controlIdMapping;
|
|
1533
|
+
var mapping = (_controlIdMapping = this.store.controlIdMapping) !== null && _controlIdMapping !== void 0 ? _controlIdMapping : {};
|
|
1639
1534
|
var listKey = undefined;
|
|
1640
1535
|
Object.keys(mapping).some(function(key) {
|
|
1641
|
-
var
|
|
1642
|
-
var matched = (
|
|
1536
|
+
var ref, ref21;
|
|
1537
|
+
var matched = (ref = mapping[key]) === null || ref === void 0 ? void 0 : (ref21 = ref.children) === null || ref21 === void 0 ? void 0 : ref21.hasOwnProperty(controlId);
|
|
1643
1538
|
if (matched) {
|
|
1644
1539
|
listKey = key;
|
|
1645
1540
|
}
|
|
@@ -1653,7 +1548,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1653
1548
|
key: "register",
|
|
1654
1549
|
value: // 注册外部控件
|
|
1655
1550
|
function register(control) {
|
|
1656
|
-
return Runtime.register(control,
|
|
1551
|
+
return Runtime.register(control, 'Runtime');
|
|
1657
1552
|
}
|
|
1658
1553
|
},
|
|
1659
1554
|
{
|