@byteluck-fe/model-driven-engine 2.3.11 → 2.4.1-beta.1
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 +56 -173
- package/dist/esm/common/DataManager.js +25 -134
- package/dist/esm/common/Engine.js +281 -407
- package/dist/esm/common/OkWorker.js +17 -31
- package/dist/esm/common/Plugin.js +2 -2
- package/dist/esm/common/Runtime.js +35 -50
- package/dist/esm/common/Store.js +53 -53
- package/dist/esm/common/checkerValue.js +109 -109
- package/dist/esm/common/index.js +2 -2
- package/dist/esm/common/proxyState.js +58 -58
- package/dist/esm/index.js +3 -3
- package/dist/esm/plugins/CalcPlugin.js +81 -89
- package/dist/esm/plugins/ControlsEventPlugin.js +73 -196
- package/dist/esm/plugins/ES6ModulePlugin.js +21 -37
- 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/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 +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,19 +109,19 @@ function _inherits(subClass, superClass) {
|
|
|
109
109
|
configurable: true
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
|
-
if (superClass)
|
|
112
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
113
113
|
}
|
|
114
114
|
function _instanceof(left, right) {
|
|
115
115
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
116
|
-
return
|
|
116
|
+
return right[Symbol.hasInstance](left);
|
|
117
117
|
} else {
|
|
118
118
|
return left instanceof right;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function _iterableToArray(iter) {
|
|
122
122
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function _iterableToArrayLimit(arr, i) {
|
|
125
125
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
126
126
|
if (_i == null) return;
|
|
127
127
|
var _arr = [];
|
|
@@ -145,13 +145,13 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
145
145
|
}
|
|
146
146
|
return _arr;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function _nonIterableRest() {
|
|
149
149
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function _nonIterableSpread() {
|
|
152
152
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function _objectSpread(target) {
|
|
155
155
|
for(var i = 1; i < arguments.length; i++){
|
|
156
156
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
157
157
|
var ownKeys = Object.keys(source);
|
|
@@ -161,74 +161,50 @@ function _object_spread(target) {
|
|
|
161
161
|
}));
|
|
162
162
|
}
|
|
163
163
|
ownKeys.forEach(function(key) {
|
|
164
|
-
|
|
164
|
+
_defineProperty(target, key, source[key]);
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
return target;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
170
|
-
|
|
171
|
-
if (Object.getOwnPropertySymbols) {
|
|
172
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
173
|
-
if (enumerableOnly) {
|
|
174
|
-
symbols = symbols.filter(function(sym) {
|
|
175
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
keys.push.apply(keys, symbols);
|
|
179
|
-
}
|
|
180
|
-
return keys;
|
|
181
|
-
}
|
|
182
|
-
function _object_spread_props(target, source) {
|
|
183
|
-
source = source != null ? source : {};
|
|
184
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
185
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
186
|
-
} else {
|
|
187
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
188
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
return target;
|
|
192
|
-
}
|
|
193
|
-
function _possible_constructor_return(self, call) {
|
|
194
|
-
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
169
|
+
function _possibleConstructorReturn(self, call) {
|
|
170
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
195
171
|
return call;
|
|
196
172
|
}
|
|
197
|
-
return
|
|
173
|
+
return _assertThisInitialized(self);
|
|
198
174
|
}
|
|
199
|
-
function
|
|
200
|
-
|
|
175
|
+
function _setPrototypeOf(o, p) {
|
|
176
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
201
177
|
o.__proto__ = p;
|
|
202
178
|
return o;
|
|
203
179
|
};
|
|
204
|
-
return
|
|
180
|
+
return _setPrototypeOf(o, p);
|
|
205
181
|
}
|
|
206
|
-
function
|
|
207
|
-
return
|
|
182
|
+
function _slicedToArray(arr, i) {
|
|
183
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
208
184
|
}
|
|
209
|
-
function
|
|
185
|
+
function _superPropBase(object, property) {
|
|
210
186
|
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
211
|
-
object =
|
|
187
|
+
object = _getPrototypeOf(object);
|
|
212
188
|
if (object === null) break;
|
|
213
189
|
}
|
|
214
190
|
return object;
|
|
215
191
|
}
|
|
216
|
-
function
|
|
217
|
-
return
|
|
192
|
+
function _toConsumableArray(arr) {
|
|
193
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
218
194
|
}
|
|
219
|
-
function
|
|
195
|
+
var _typeof = function(obj) {
|
|
220
196
|
"@swc/helpers - typeof";
|
|
221
197
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
222
|
-
}
|
|
223
|
-
function
|
|
198
|
+
};
|
|
199
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
224
200
|
if (!o) return;
|
|
225
|
-
if (typeof o === "string") return
|
|
201
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
226
202
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
227
203
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
228
204
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
229
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
205
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
230
206
|
}
|
|
231
|
-
function
|
|
207
|
+
function _isNativeReflectConstruct() {
|
|
232
208
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
233
209
|
if (Reflect.construct.sham) return false;
|
|
234
210
|
if (typeof Proxy === "function") return true;
|
|
@@ -239,160 +215,57 @@ function _is_native_reflect_construct() {
|
|
|
239
215
|
return false;
|
|
240
216
|
}
|
|
241
217
|
}
|
|
242
|
-
function
|
|
243
|
-
var hasNativeReflectConstruct =
|
|
218
|
+
function _createSuper(Derived) {
|
|
219
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
244
220
|
return function _createSuperInternal() {
|
|
245
|
-
var Super =
|
|
221
|
+
var Super = _getPrototypeOf(Derived), result;
|
|
246
222
|
if (hasNativeReflectConstruct) {
|
|
247
|
-
var NewTarget =
|
|
223
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
248
224
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
249
225
|
} else {
|
|
250
226
|
result = Super.apply(this, arguments);
|
|
251
227
|
}
|
|
252
|
-
return
|
|
228
|
+
return _possibleConstructorReturn(this, result);
|
|
253
229
|
};
|
|
254
230
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
return g = {
|
|
266
|
-
next: verb(0),
|
|
267
|
-
"throw": verb(1),
|
|
268
|
-
"return": verb(2)
|
|
269
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
270
|
-
return this;
|
|
271
|
-
}), g;
|
|
272
|
-
function verb(n) {
|
|
273
|
-
return function(v) {
|
|
274
|
-
return step([
|
|
275
|
-
n,
|
|
276
|
-
v
|
|
277
|
-
]);
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
function step(op) {
|
|
281
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
282
|
-
while(_)try {
|
|
283
|
-
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;
|
|
284
|
-
if (y = 0, t) op = [
|
|
285
|
-
op[0] & 2,
|
|
286
|
-
t.value
|
|
287
|
-
];
|
|
288
|
-
switch(op[0]){
|
|
289
|
-
case 0:
|
|
290
|
-
case 1:
|
|
291
|
-
t = op;
|
|
292
|
-
break;
|
|
293
|
-
case 4:
|
|
294
|
-
_.label++;
|
|
295
|
-
return {
|
|
296
|
-
value: op[1],
|
|
297
|
-
done: false
|
|
298
|
-
};
|
|
299
|
-
case 5:
|
|
300
|
-
_.label++;
|
|
301
|
-
y = op[1];
|
|
302
|
-
op = [
|
|
303
|
-
0
|
|
304
|
-
];
|
|
305
|
-
continue;
|
|
306
|
-
case 7:
|
|
307
|
-
op = _.ops.pop();
|
|
308
|
-
_.trys.pop();
|
|
309
|
-
continue;
|
|
310
|
-
default:
|
|
311
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
312
|
-
_ = 0;
|
|
313
|
-
continue;
|
|
314
|
-
}
|
|
315
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
316
|
-
_.label = op[1];
|
|
317
|
-
break;
|
|
318
|
-
}
|
|
319
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
320
|
-
_.label = t[1];
|
|
321
|
-
t = op;
|
|
322
|
-
break;
|
|
323
|
-
}
|
|
324
|
-
if (t && _.label < t[2]) {
|
|
325
|
-
_.label = t[2];
|
|
326
|
-
_.ops.push(op);
|
|
327
|
-
break;
|
|
328
|
-
}
|
|
329
|
-
if (t[2]) _.ops.pop();
|
|
330
|
-
_.trys.pop();
|
|
331
|
-
continue;
|
|
332
|
-
}
|
|
333
|
-
op = body.call(thisArg, _);
|
|
334
|
-
} catch (e) {
|
|
335
|
-
op = [
|
|
336
|
-
6,
|
|
337
|
-
e
|
|
338
|
-
];
|
|
339
|
-
y = 0;
|
|
340
|
-
} finally{
|
|
341
|
-
f = t = 0;
|
|
342
|
-
}
|
|
343
|
-
if (op[0] & 5) throw op[1];
|
|
344
|
-
return {
|
|
345
|
-
value: op[0] ? op[1] : void 0,
|
|
346
|
-
done: true
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
import { DataBind, ObjectDataBind, RuntimeListControl } from "@byteluck-fe/model-driven-core";
|
|
351
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
|
|
352
|
-
import { Runtime } from "./Runtime";
|
|
353
|
-
import { Store } from "./Store";
|
|
354
|
-
import { findItem, proxyState } from "./proxyState";
|
|
355
|
-
import { ActionManager } from "./ActionManager";
|
|
356
|
-
import { DataManager } from "./DataManager";
|
|
357
|
-
import { checkerSubtableValue, checkerValue } from "./checkerValue";
|
|
358
|
-
if (typeof window !== "undefined") {
|
|
231
|
+
import regeneratorRuntime from "regenerator-runtime";
|
|
232
|
+
import { DataBind, ObjectDataBind, RuntimeListControl } from '@byteluck-fe/model-driven-core';
|
|
233
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from '@byteluck-fe/model-driven-shared';
|
|
234
|
+
import { Runtime } from './Runtime';
|
|
235
|
+
import { Store } from './Store';
|
|
236
|
+
import { findItem, proxyState } from './proxyState';
|
|
237
|
+
import { ActionManager } from './ActionManager';
|
|
238
|
+
import { DataManager } from './DataManager';
|
|
239
|
+
import { checkerSubtableValue, checkerValue } from './checkerValue';
|
|
240
|
+
if (typeof window !== 'undefined') {
|
|
359
241
|
// @ts-ignore
|
|
360
242
|
window.engines = {};
|
|
361
243
|
}
|
|
362
244
|
// setState的时候,存储options中转变量
|
|
363
245
|
var eventOptionsTemp = null;
|
|
364
246
|
// 当前正在注册的插件名称
|
|
365
|
-
var applyingPluginName =
|
|
366
|
-
// 整体渲染引擎 并且 提供发布订阅能力
|
|
367
|
-
|
|
247
|
+
var applyingPluginName = '';
|
|
248
|
+
var Engine = // 整体渲染引擎 并且 提供发布订阅能力
|
|
249
|
+
/*#__PURE__*/ function(Watcher1) {
|
|
368
250
|
"use strict";
|
|
369
|
-
_inherits(Engine,
|
|
370
|
-
var _super =
|
|
251
|
+
_inherits(Engine, Watcher1);
|
|
252
|
+
var _super = _createSuper(Engine);
|
|
371
253
|
function Engine(props) {
|
|
372
|
-
|
|
254
|
+
_classCallCheck(this, Engine);
|
|
373
255
|
var _this;
|
|
374
256
|
_this = _super.call(this);
|
|
375
|
-
|
|
376
|
-
_define_property(_assert_this_initialized(_this), "rawStore", {});
|
|
377
|
-
_define_property(_assert_this_initialized(_this), "parent", void 0);
|
|
378
|
-
// 提供注册运行态控件以及实例化控件的能力
|
|
379
|
-
_define_property(_assert_this_initialized(_this), "runtime", void 0);
|
|
257
|
+
_this.rawStore = {};
|
|
380
258
|
// 提供子线程处理脚本以及修改数据的能力
|
|
381
259
|
// public worker: OkWorker
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
_define_property(_assert_this_initialized(_this), "$options", void 0);
|
|
389
|
-
_define_property(_assert_this_initialized(_this), "actionManager", new ActionManager());
|
|
390
|
-
_define_property(_assert_this_initialized(_this), "dataManager", void 0);
|
|
391
|
-
_define_property(_assert_this_initialized(_this), "_jobTasks", []);
|
|
392
|
-
_define_property(_assert_this_initialized(_this), "createControlInstance", _this.createInstance);
|
|
260
|
+
_this.isMounted = false;
|
|
261
|
+
_this.id = genNonDuplicateId(8);
|
|
262
|
+
_this.__pluginsApplied = false;
|
|
263
|
+
_this.actionManager = new ActionManager();
|
|
264
|
+
_this._jobTasks = [];
|
|
265
|
+
_this.createControlInstance = _this.createInstance;
|
|
393
266
|
_this.$options = Object.freeze(props);
|
|
394
|
-
var
|
|
395
|
-
language, language =
|
|
267
|
+
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,
|
|
268
|
+
language, language = _language === void 0 ? DEFAULT_LOCALE : _language, _debug = _$options.debug, debug = _debug === void 0 ? false : _debug;
|
|
396
269
|
RulesMessage.setLocale(language);
|
|
397
270
|
_this.debug = debug;
|
|
398
271
|
_this.runtime = new Runtime({
|
|
@@ -403,19 +276,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
403
276
|
_this.store = new Store({
|
|
404
277
|
instance: _this.runtime.instance
|
|
405
278
|
});
|
|
406
|
-
_this.debugLog(
|
|
279
|
+
_this.debugLog('engine is Instantiation complete');
|
|
407
280
|
// 自动执行挂载完成,也可以手动调用mount方法
|
|
408
281
|
autoMount && _this.mount();
|
|
409
282
|
return _this;
|
|
410
283
|
}
|
|
411
|
-
|
|
284
|
+
_createClass(Engine, [
|
|
412
285
|
{
|
|
413
286
|
key: "debugLog",
|
|
414
287
|
value: function debugLog() {
|
|
415
288
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
416
289
|
args[_key] = arguments[_key];
|
|
417
290
|
}
|
|
418
|
-
this.debug && log.apply(void 0,
|
|
291
|
+
this.debug && log.apply(void 0, _toConsumableArray(args));
|
|
419
292
|
}
|
|
420
293
|
},
|
|
421
294
|
{
|
|
@@ -434,8 +307,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
434
307
|
for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
|
|
435
308
|
arg[_key] = arguments[_key];
|
|
436
309
|
}
|
|
437
|
-
var
|
|
438
|
-
(
|
|
310
|
+
var _runtime;
|
|
311
|
+
(_runtime = this.runtime).register.apply(_runtime, _toConsumableArray(arg));
|
|
439
312
|
return this;
|
|
440
313
|
}
|
|
441
314
|
},
|
|
@@ -443,14 +316,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
443
316
|
key: "mount",
|
|
444
317
|
value: function mount() {
|
|
445
318
|
this.debugLog("engine的mount方法开始调用");
|
|
446
|
-
var
|
|
319
|
+
var _$options = this.$options, _plugins = _$options.plugins, plugins = _plugins === void 0 ? [] : _plugins;
|
|
447
320
|
this._handlerProxyState();
|
|
448
321
|
this.__plugins = plugins;
|
|
449
322
|
this.applyPlugins();
|
|
450
323
|
// 触发所有控件的默认值的change事件
|
|
451
324
|
this.setStates(this.getState());
|
|
452
325
|
this.debugLog("engine的mount方法调用结束");
|
|
453
|
-
if (this.debug && typeof window !==
|
|
326
|
+
if (this.debug && typeof window !== 'undefined') {
|
|
454
327
|
// @ts-ignore
|
|
455
328
|
window.engines[this.id] = this;
|
|
456
329
|
}
|
|
@@ -459,7 +332,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
459
332
|
{
|
|
460
333
|
key: "destroy",
|
|
461
334
|
value: function destroy() {
|
|
462
|
-
if (this.debug && typeof window !==
|
|
335
|
+
if (this.debug && typeof window !== 'undefined') {
|
|
463
336
|
// @ts-ignore
|
|
464
337
|
delete window.engines[this.id];
|
|
465
338
|
}
|
|
@@ -481,6 +354,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
481
354
|
}
|
|
482
355
|
// @ts-ignore
|
|
483
356
|
if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE)) {
|
|
357
|
+
var ref;
|
|
484
358
|
if (newValue === null) {
|
|
485
359
|
return [];
|
|
486
360
|
}
|
|
@@ -495,12 +369,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
495
369
|
}, {});
|
|
496
370
|
// @ts-ignore
|
|
497
371
|
var emptyState = this.getEmptyState(instance.id);
|
|
498
|
-
return newValue === null ||
|
|
499
|
-
|
|
500
|
-
checkerSubtableValue(fieldTypeMap, row, emptyState)
|
|
372
|
+
return (ref = newValue) === null || ref === void 0 ? void 0 : ref.map(function(row) {
|
|
373
|
+
// @ts-ignore
|
|
374
|
+
return checkerSubtableValue(fieldTypeMap, row, emptyState);
|
|
501
375
|
});
|
|
502
376
|
}
|
|
503
|
-
var keys = key.split(
|
|
377
|
+
var keys = key.split('.');
|
|
504
378
|
var lastKey = keys[keys.length - 1];
|
|
505
379
|
try {
|
|
506
380
|
return checkerValue(instance.fieldType, lastKey, newValue, oldValue);
|
|
@@ -532,7 +406,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
532
406
|
var newRows = [];
|
|
533
407
|
for(var i = 0; i < len; i++){
|
|
534
408
|
// @ts-ignore
|
|
535
|
-
var row = _this.listControlCreateRow(subtable,
|
|
409
|
+
var row = _this.listControlCreateRow(subtable, 'subtable-row');
|
|
536
410
|
row && newRows.push(row);
|
|
537
411
|
}
|
|
538
412
|
// @ts-ignore
|
|
@@ -546,19 +420,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
546
420
|
if (type && args) {
|
|
547
421
|
// const subtableOldLength = subtable.children.length
|
|
548
422
|
switch(type){
|
|
549
|
-
case
|
|
550
|
-
case
|
|
551
|
-
var
|
|
423
|
+
case 'push':
|
|
424
|
+
case 'unshift':
|
|
425
|
+
var _children;
|
|
552
426
|
var newRowLengths = args.length;
|
|
553
427
|
createdNewRows = createRows(newRowLengths);
|
|
554
428
|
createdNewRowsData = args;
|
|
555
|
-
(
|
|
429
|
+
(_children = subtable.children)[type].apply(_children, _toConsumableArray(createdNewRows));
|
|
556
430
|
this.runtime.getFlatInstances();
|
|
557
431
|
break;
|
|
558
|
-
case
|
|
432
|
+
case 'splice':
|
|
559
433
|
if (args.length > 2) {
|
|
560
434
|
var // @ts-ignore
|
|
561
|
-
|
|
435
|
+
_children1;
|
|
562
436
|
var newRowLengths1 = args.length - 2;
|
|
563
437
|
var newValues = args.slice(2);
|
|
564
438
|
createdNewRows = createRows(newRowLengths1);
|
|
@@ -567,10 +441,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
567
441
|
var start = args[0];
|
|
568
442
|
// 替换几个
|
|
569
443
|
var replace = args[1];
|
|
570
|
-
(
|
|
444
|
+
(_children1 = subtable.children)[type].apply(_children1, [
|
|
571
445
|
start,
|
|
572
446
|
replace
|
|
573
|
-
].concat(
|
|
447
|
+
].concat(_toConsumableArray(createdNewRows)));
|
|
574
448
|
this.runtime.getFlatInstances();
|
|
575
449
|
// newValues.forEach((item: any, index) => {
|
|
576
450
|
// let newIndex = start + index
|
|
@@ -578,29 +452,29 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
578
452
|
// })
|
|
579
453
|
} else {
|
|
580
454
|
var // @ts-ignore
|
|
581
|
-
|
|
582
|
-
(
|
|
455
|
+
_children2;
|
|
456
|
+
(_children2 = subtable.children)[type].apply(_children2, _toConsumableArray(args));
|
|
583
457
|
this.runtime.getFlatInstances();
|
|
584
458
|
}
|
|
585
459
|
break;
|
|
586
460
|
default:
|
|
587
461
|
var // @ts-ignore
|
|
588
|
-
|
|
589
|
-
(
|
|
462
|
+
_children3;
|
|
463
|
+
(_children3 = subtable.children)[type].apply(_children3, _toConsumableArray(args));
|
|
590
464
|
this.runtime.getFlatInstances();
|
|
591
465
|
break;
|
|
592
466
|
}
|
|
593
|
-
if (type ===
|
|
467
|
+
if (type === 'splice') {
|
|
594
468
|
deleted = result;
|
|
595
469
|
} else if ([
|
|
596
|
-
|
|
597
|
-
|
|
470
|
+
'pop',
|
|
471
|
+
'shift'
|
|
598
472
|
].includes(type)) {
|
|
599
473
|
deleted = [
|
|
600
474
|
result
|
|
601
475
|
];
|
|
602
476
|
}
|
|
603
|
-
this.emit(
|
|
477
|
+
this.emit('list-change', {
|
|
604
478
|
instance: subtable,
|
|
605
479
|
value: this.getState(subtable.id),
|
|
606
480
|
options: Object.assign({}, options, {
|
|
@@ -627,26 +501,26 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
627
501
|
// if (instance instanceof RuntimeListControl) {
|
|
628
502
|
if (instance.controlType === CONTROL_BASE_TYPE.LIST) {
|
|
629
503
|
var // @ts-ignore
|
|
630
|
-
|
|
504
|
+
_children;
|
|
631
505
|
instance.children.length = 0;
|
|
632
506
|
var newValue = value;
|
|
633
507
|
// @ts-ignore
|
|
634
508
|
var newRows = [];
|
|
635
509
|
for(var i = 0; i < newValue.length; i++){
|
|
636
510
|
// @ts-ignore
|
|
637
|
-
var row = this.listControlCreateRow(instance,
|
|
511
|
+
var row = this.listControlCreateRow(instance, 'subtable-row');
|
|
638
512
|
row && newRows.push(row);
|
|
639
513
|
}
|
|
640
|
-
(
|
|
514
|
+
(_children = instance.children).push.apply(_children, _toConsumableArray(newRows));
|
|
641
515
|
this.runtime.getFlatInstances();
|
|
642
516
|
// 这里已经能拿到控件实例,所以在这里触发setStates,触发每一行每一个控件的change事件
|
|
643
517
|
// for (let i = 0; i < newValue.length; i++) {
|
|
644
518
|
// this.setStates(newValue[i], i, options)
|
|
645
519
|
// }
|
|
646
|
-
this.emit(
|
|
520
|
+
this.emit('list-change', {
|
|
647
521
|
instance: instance,
|
|
648
522
|
value: value,
|
|
649
|
-
options:
|
|
523
|
+
options: _objectSpread({}, options, {
|
|
650
524
|
// @ts-ignore
|
|
651
525
|
changed: newRows,
|
|
652
526
|
data: newValue,
|
|
@@ -654,11 +528,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
654
528
|
})
|
|
655
529
|
});
|
|
656
530
|
} else {
|
|
657
|
-
this.emit(
|
|
531
|
+
this.emit('change', {
|
|
658
532
|
instance: instance,
|
|
659
533
|
value: this.getState(instance.id, index),
|
|
660
534
|
rowIndex: index,
|
|
661
|
-
options:
|
|
535
|
+
options: _objectSpread({}, options, {
|
|
662
536
|
oldValue: oldValue
|
|
663
537
|
})
|
|
664
538
|
});
|
|
@@ -672,13 +546,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
672
546
|
if (this.__pluginsApplied) return;
|
|
673
547
|
this.__plugins.forEach(function(plugin) {
|
|
674
548
|
try {
|
|
675
|
-
var
|
|
676
|
-
applyingPluginName = (
|
|
549
|
+
var _pluginName;
|
|
550
|
+
applyingPluginName = (_pluginName = plugin.pluginName) !== null && _pluginName !== void 0 ? _pluginName : plugin.constructor.name;
|
|
677
551
|
plugin.apply(_this);
|
|
678
552
|
} catch (e) {
|
|
679
553
|
error("".concat(applyingPluginName, " Plugin apply Error \n ").concat(e));
|
|
680
554
|
} finally{
|
|
681
|
-
applyingPluginName =
|
|
555
|
+
applyingPluginName = '';
|
|
682
556
|
}
|
|
683
557
|
});
|
|
684
558
|
this.__pluginsApplied = true;
|
|
@@ -692,12 +566,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
692
566
|
// if (row instanceof RuntimeLayoutControl) {
|
|
693
567
|
// @ts-ignore
|
|
694
568
|
if (row.controlType === CONTROL_BASE_TYPE.LAYOUT) {
|
|
695
|
-
var
|
|
569
|
+
var _children;
|
|
696
570
|
var inst = row;
|
|
697
571
|
var template = JSONCopy(instance.props.headers);
|
|
698
572
|
// @ts-ignore
|
|
699
573
|
var columns = this.createControl(template);
|
|
700
|
-
(
|
|
574
|
+
(_children = inst.children).push.apply(_children, _toConsumableArray(columns));
|
|
701
575
|
}
|
|
702
576
|
return row;
|
|
703
577
|
}
|
|
@@ -706,7 +580,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
706
580
|
key: "listControlAddRow",
|
|
707
581
|
value: function listControlAddRow(instance) {
|
|
708
582
|
var // @ts-ignore
|
|
709
|
-
rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] :
|
|
583
|
+
rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'subtable-row';
|
|
710
584
|
var row = this.listControlCreateRow(instance, rowType);
|
|
711
585
|
if (!row) return;
|
|
712
586
|
instance.children.push(row);
|
|
@@ -718,42 +592,39 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
718
592
|
function emit(eventKey, payload) {
|
|
719
593
|
var _this = this;
|
|
720
594
|
var _this1 = this, _superprop_get_emit = function() {
|
|
721
|
-
return _get(
|
|
595
|
+
return _get(_getPrototypeOf(Engine.prototype), "emit", _this);
|
|
722
596
|
};
|
|
723
|
-
return
|
|
597
|
+
return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
|
724
598
|
var needWait, promiseResolver, promise, results;
|
|
725
|
-
return
|
|
726
|
-
switch(
|
|
599
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
600
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
727
601
|
case 0:
|
|
728
|
-
if (!(eventKey ===
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
if (_this1.isMounted) {
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
2,
|
|
736
|
-
Promise.resolve([])
|
|
737
|
-
];
|
|
602
|
+
if (!(eventKey === 'engine-mounted')) {
|
|
603
|
+
_ctx.next = 11;
|
|
604
|
+
break;
|
|
605
|
+
}
|
|
606
|
+
if (!_this1.isMounted) {
|
|
607
|
+
_ctx.next = 4;
|
|
608
|
+
break;
|
|
738
609
|
}
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
console.timeEnd(
|
|
752
|
-
|
|
753
|
-
case 2:
|
|
610
|
+
warn('The engine-mounted life cycle can only be triggered once');
|
|
611
|
+
return _ctx.abrupt("return", Promise.resolve([]));
|
|
612
|
+
case 4:
|
|
613
|
+
if (!_this1._jobTasks.length) {
|
|
614
|
+
_ctx.next = 10;
|
|
615
|
+
break;
|
|
616
|
+
}
|
|
617
|
+
console.time('engine-mounted need wait');
|
|
618
|
+
needWait = _toConsumableArray(_this1._jobTasks);
|
|
619
|
+
_ctx.next = 9;
|
|
620
|
+
return Promise.all(needWait);
|
|
621
|
+
case 9:
|
|
622
|
+
console.timeEnd('engine-mounted need wait');
|
|
623
|
+
case 10:
|
|
754
624
|
_this1.isMounted = true;
|
|
755
|
-
|
|
756
|
-
|
|
625
|
+
case 11:
|
|
626
|
+
;
|
|
627
|
+
;
|
|
757
628
|
// 如果没有挂载的话,需要记录在挂载之前触发的所有任务
|
|
758
629
|
if (!_this1.isMounted) {
|
|
759
630
|
promise = new Promise(function(resolve) {
|
|
@@ -761,24 +632,22 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
761
632
|
});
|
|
762
633
|
_this1._jobTasks.push(promise);
|
|
763
634
|
}
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
case 4:
|
|
769
|
-
results = _state.sent();
|
|
635
|
+
_ctx.next = 16;
|
|
636
|
+
return _superprop_get_emit().call(_this1, eventKey, payload);
|
|
637
|
+
case 16:
|
|
638
|
+
results = _ctx.sent;
|
|
770
639
|
if (promiseResolver && promise) {
|
|
771
640
|
// 每一个任务完成的时候,都把自己从task中去掉
|
|
772
641
|
promiseResolver();
|
|
773
642
|
_this1._jobTasks.splice(_this1._jobTasks.indexOf(promise), 1);
|
|
774
643
|
}
|
|
775
|
-
return
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
644
|
+
return _ctx.abrupt("return", results);
|
|
645
|
+
case 19:
|
|
646
|
+
case "end":
|
|
647
|
+
return _ctx.stop();
|
|
779
648
|
}
|
|
780
|
-
});
|
|
781
|
-
})();
|
|
649
|
+
}, _callee);
|
|
650
|
+
}))();
|
|
782
651
|
}
|
|
783
652
|
},
|
|
784
653
|
{
|
|
@@ -787,7 +656,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
787
656
|
if (applyingPluginName) {
|
|
788
657
|
callback.applyingPluginName = applyingPluginName;
|
|
789
658
|
}
|
|
790
|
-
return _get(
|
|
659
|
+
return _get(_getPrototypeOf(Engine.prototype), "on", this).call(this, key, callback);
|
|
791
660
|
}
|
|
792
661
|
},
|
|
793
662
|
{
|
|
@@ -796,8 +665,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
796
665
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
797
666
|
args[_key] = arguments[_key];
|
|
798
667
|
}
|
|
799
|
-
var
|
|
800
|
-
return (
|
|
668
|
+
var _runtime;
|
|
669
|
+
return (_runtime = this.runtime).createControl.apply(_runtime, _toConsumableArray(args));
|
|
801
670
|
}
|
|
802
671
|
},
|
|
803
672
|
{
|
|
@@ -825,10 +694,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
825
694
|
if (controlId === undefined) {
|
|
826
695
|
return rules;
|
|
827
696
|
} else {
|
|
828
|
-
var
|
|
697
|
+
var ref, ref1;
|
|
829
698
|
return {
|
|
830
|
-
rules: (
|
|
831
|
-
antdRules: (
|
|
699
|
+
rules: (ref = rules.rules[controlId]) === null || ref === void 0 ? void 0 : ref.fields,
|
|
700
|
+
antdRules: (ref1 = rules.antdRules[controlId]) === null || ref1 === void 0 ? void 0 : ref1.fields
|
|
832
701
|
};
|
|
833
702
|
}
|
|
834
703
|
}
|
|
@@ -839,8 +708,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
839
708
|
if (controlId === undefined) {
|
|
840
709
|
return this.runtime.rules;
|
|
841
710
|
} else {
|
|
842
|
-
var
|
|
843
|
-
return (
|
|
711
|
+
var ref;
|
|
712
|
+
return (ref = this.runtime.rules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
|
|
844
713
|
}
|
|
845
714
|
}
|
|
846
715
|
},
|
|
@@ -850,8 +719,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
850
719
|
if (controlId === undefined) {
|
|
851
720
|
return this.runtime.antdRules;
|
|
852
721
|
} else {
|
|
853
|
-
var
|
|
854
|
-
return (
|
|
722
|
+
var ref;
|
|
723
|
+
return (ref = this.runtime.antdRules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
|
|
855
724
|
}
|
|
856
725
|
}
|
|
857
726
|
},
|
|
@@ -888,9 +757,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
888
757
|
key: "setState",
|
|
889
758
|
value: function setState(controlId, value, rowIndex, options) {
|
|
890
759
|
eventOptionsTemp = options;
|
|
891
|
-
this.debugLog(
|
|
760
|
+
this.debugLog('[%o]: 触发setState, 修改的值为%o, rowIndex=%o, options=%o', controlId, value, rowIndex, options);
|
|
892
761
|
this.store.setState(controlId, value, rowIndex);
|
|
893
|
-
this.debugLog(
|
|
762
|
+
this.debugLog('[%o]: setState完成, 修改的值为%o, rowIndex=%o', controlId, value, rowIndex);
|
|
894
763
|
eventOptionsTemp = null;
|
|
895
764
|
}
|
|
896
765
|
},
|
|
@@ -903,19 +772,20 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
903
772
|
var _this = this;
|
|
904
773
|
var newStates = states !== null && states !== void 0 ? states : {};
|
|
905
774
|
Object.keys(newStates).forEach(function(stateId) {
|
|
775
|
+
var _this2 = _this;
|
|
906
776
|
Object.entries(_this.store.controlIdMapping).forEach(function(param) {
|
|
907
|
-
var _param =
|
|
777
|
+
var _param = _slicedToArray(param, 2), controlId = _param[0], controlIdMapping = _param[1];
|
|
908
778
|
if (controlIdMapping.dataView === stateId) {
|
|
909
779
|
// state对象是dataView包裹的
|
|
910
780
|
var value = newStates[stateId][controlId];
|
|
911
781
|
if (value !== undefined) {
|
|
912
|
-
|
|
782
|
+
_this2.setState(controlId, value, rowIndex, options);
|
|
913
783
|
}
|
|
914
784
|
} else {
|
|
915
785
|
// state对象是单独的,没有被dataView包裹的
|
|
916
786
|
if (controlId === stateId || controlIdMapping.children && controlIdMapping.children[stateId]) {
|
|
917
787
|
if (newStates[stateId] !== undefined) {
|
|
918
|
-
|
|
788
|
+
_this2.setState(stateId, newStates[stateId], rowIndex, options);
|
|
919
789
|
}
|
|
920
790
|
}
|
|
921
791
|
}
|
|
@@ -943,11 +813,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
943
813
|
if (!dataBindMapping1) {
|
|
944
814
|
return;
|
|
945
815
|
}
|
|
946
|
-
var
|
|
816
|
+
var dataBind1 = dataBindMapping1.dataBind, controlId1 = dataBindMapping1.controlId;
|
|
947
817
|
var state = this.getState(controlId1, rowIndex);
|
|
948
|
-
if (_instanceof(
|
|
949
|
-
return Object.entries(
|
|
950
|
-
var _param =
|
|
818
|
+
if (_instanceof(dataBind1, ObjectDataBind)) {
|
|
819
|
+
return Object.entries(dataBind1).reduce(function(result, param) {
|
|
820
|
+
var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
|
|
951
821
|
// objectDataBind的元素,跳过下一次赋值
|
|
952
822
|
if (dataBind.fieldCode === fieldCode) {
|
|
953
823
|
return result[key];
|
|
@@ -973,15 +843,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
973
843
|
var data = getFieldData.map(function(item) {
|
|
974
844
|
var obj = {};
|
|
975
845
|
for(var key in item){
|
|
976
|
-
var
|
|
977
|
-
if ((
|
|
978
|
-
var
|
|
979
|
-
obj[(
|
|
980
|
-
} else if ((
|
|
846
|
+
var ref, ref2, ref3, ref4;
|
|
847
|
+
if ((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) {
|
|
848
|
+
var ref5;
|
|
849
|
+
obj[(ref5 = controlIdMapping[controlId].children[key]) === null || ref5 === void 0 ? void 0 : ref5.dataBind.fieldCode] = item[key];
|
|
850
|
+
} else if ((ref4 = controlIdMapping[controlId]) === null || ref4 === void 0 ? void 0 : ref4.children[key]) {
|
|
981
851
|
// 兼容一个控件需要绑定多个字段的情况
|
|
982
852
|
for(var keyChi in item[key]){
|
|
983
|
-
var
|
|
984
|
-
obj[(
|
|
853
|
+
var ref6, ref7;
|
|
854
|
+
obj[(ref7 = (ref6 = controlIdMapping[controlId]) === null || ref6 === void 0 ? void 0 : ref6.children[key]) === null || ref7 === void 0 ? void 0 : ref7.dataBind[keyChi].fieldCode] = item[key][keyChi];
|
|
985
855
|
}
|
|
986
856
|
}
|
|
987
857
|
}
|
|
@@ -989,43 +859,43 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
989
859
|
});
|
|
990
860
|
return data;
|
|
991
861
|
} else {
|
|
992
|
-
var _loop = function(
|
|
993
|
-
var
|
|
994
|
-
if ((
|
|
995
|
-
var
|
|
996
|
-
|
|
997
|
-
} else if ((
|
|
998
|
-
var
|
|
862
|
+
var _loop = function(key1) {
|
|
863
|
+
var ref17, ref8, ref9, ref10;
|
|
864
|
+
if ((ref17 = controlIdMapping[key1]) === null || ref17 === void 0 ? void 0 : (ref8 = ref17.dataBind) === null || ref8 === void 0 ? void 0 : ref8.fieldCode) {
|
|
865
|
+
var ref11;
|
|
866
|
+
obj1[(ref11 = controlIdMapping[key1]) === null || ref11 === void 0 ? void 0 : ref11.dataBind.fieldCode] = getFieldData[key1];
|
|
867
|
+
} else if ((ref9 = controlIdMapping[key1]) === null || ref9 === void 0 ? void 0 : (ref10 = ref9.dataBind) === null || ref10 === void 0 ? void 0 : ref10.dataCode) {
|
|
868
|
+
var ref12;
|
|
999
869
|
// 明细字表只循环一层明细子表未递归
|
|
1000
|
-
|
|
870
|
+
obj1[(ref12 = controlIdMapping[key1]) === null || ref12 === void 0 ? void 0 : ref12.dataBind.dataCode] = getFieldData[key1].map(function(item) {
|
|
1001
871
|
var objChi = {};
|
|
1002
872
|
for(var keyChi in item){
|
|
1003
|
-
var
|
|
1004
|
-
if ((
|
|
1005
|
-
var
|
|
1006
|
-
objChi[(
|
|
873
|
+
var ref;
|
|
874
|
+
if ((ref = controlIdMapping[key1].children[keyChi]) === null || ref === void 0 ? void 0 : ref.dataBind.fieldCode) {
|
|
875
|
+
var ref15;
|
|
876
|
+
objChi[(ref15 = controlIdMapping[key1].children[keyChi]) === null || ref15 === void 0 ? void 0 : ref15.dataBind.fieldCode] = item[keyChi];
|
|
1007
877
|
} else {
|
|
1008
878
|
for(var keyChi1 in item[keyChi]){
|
|
1009
|
-
var
|
|
1010
|
-
objChi[(
|
|
879
|
+
var ref16;
|
|
880
|
+
objChi[(ref16 = controlIdMapping[key1].children[keyChi]) === null || ref16 === void 0 ? void 0 : ref16.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
|
|
1011
881
|
//
|
|
1012
882
|
}
|
|
1013
883
|
}
|
|
1014
884
|
}
|
|
1015
885
|
return objChi;
|
|
1016
886
|
});
|
|
1017
|
-
} else if (controlIdMapping[
|
|
887
|
+
} else if (controlIdMapping[key1]) {
|
|
1018
888
|
// 兼容一个控件需要绑定多个字段的情况
|
|
1019
|
-
for(var
|
|
1020
|
-
var
|
|
1021
|
-
|
|
889
|
+
for(var keyChi2 in getFieldData[key1]){
|
|
890
|
+
var ref13, ref14;
|
|
891
|
+
obj1[(ref14 = (ref13 = controlIdMapping[key1]) === null || ref13 === void 0 ? void 0 : ref13.dataBind[keyChi2]) === null || ref14 === void 0 ? void 0 : ref14.fieldCode] = getFieldData[key1][keyChi2];
|
|
1022
892
|
}
|
|
1023
893
|
}
|
|
1024
894
|
};
|
|
1025
895
|
// 主表
|
|
1026
|
-
var
|
|
1027
|
-
for(var
|
|
1028
|
-
return
|
|
896
|
+
var obj1 = {};
|
|
897
|
+
for(var key1 in getFieldData)_loop(key1);
|
|
898
|
+
return obj1;
|
|
1029
899
|
}
|
|
1030
900
|
}
|
|
1031
901
|
return;
|
|
@@ -1045,13 +915,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1045
915
|
if (!dataBindMapping) {
|
|
1046
916
|
return;
|
|
1047
917
|
}
|
|
1048
|
-
var
|
|
1049
|
-
if (_instanceof(
|
|
1050
|
-
var
|
|
1051
|
-
var oldState = (
|
|
918
|
+
var dataBind2 = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
|
|
919
|
+
if (_instanceof(dataBind2, ObjectDataBind)) {
|
|
920
|
+
var ref;
|
|
921
|
+
var oldState = (ref = JSONCopy(this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : this.getEmptyState(controlId);
|
|
1052
922
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1053
|
-
var newState = Object.entries(
|
|
1054
|
-
var _param =
|
|
923
|
+
var newState = Object.entries(dataBind2).reduce(function(result, param) {
|
|
924
|
+
var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
|
|
1055
925
|
// objectDataBind的元素,跳过下一次赋值
|
|
1056
926
|
if (dataBind.fieldCode === fieldCode) {
|
|
1057
927
|
result[key] = value;
|
|
@@ -1080,7 +950,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1080
950
|
}
|
|
1081
951
|
var skipKeys = [];
|
|
1082
952
|
mapping.fields.forEach(function(item) {
|
|
1083
|
-
var
|
|
953
|
+
var dataBind3 = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
|
|
1084
954
|
if (skipKeys.includes(fieldCode)) {
|
|
1085
955
|
return;
|
|
1086
956
|
}
|
|
@@ -1088,12 +958,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1088
958
|
return;
|
|
1089
959
|
}
|
|
1090
960
|
// 对象类型的值
|
|
1091
|
-
if (_instanceof(
|
|
1092
|
-
var
|
|
1093
|
-
var oldState = (
|
|
961
|
+
if (_instanceof(dataBind3, ObjectDataBind)) {
|
|
962
|
+
var ref;
|
|
963
|
+
var oldState = (ref = JSONCopy(_this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : _this.getEmptyState(controlId);
|
|
1094
964
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1095
|
-
var newState = Object.entries(
|
|
1096
|
-
var _param =
|
|
965
|
+
var newState = Object.entries(dataBind3).reduce(function(result, param) {
|
|
966
|
+
var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
|
|
1097
967
|
// objectDataBind的元素,跳过下一次赋值
|
|
1098
968
|
skipKeys.push(dataBind.fieldCode);
|
|
1099
969
|
var value = state[dataBind.fieldCode];
|
|
@@ -1122,9 +992,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1122
992
|
return;
|
|
1123
993
|
}
|
|
1124
994
|
var skipKeys = [];
|
|
1125
|
-
var
|
|
995
|
+
var result1 = {};
|
|
1126
996
|
mapping.fields.forEach(function(item) {
|
|
1127
|
-
var
|
|
997
|
+
var dataBind4 = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
|
|
1128
998
|
if (skipKeys.includes(fieldCode)) {
|
|
1129
999
|
return;
|
|
1130
1000
|
}
|
|
@@ -1132,11 +1002,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1132
1002
|
return;
|
|
1133
1003
|
}
|
|
1134
1004
|
// 对象类型的值
|
|
1135
|
-
if (_instanceof(
|
|
1005
|
+
if (_instanceof(dataBind4, ObjectDataBind)) {
|
|
1136
1006
|
var oldState = _this.getEmptyState(controlId);
|
|
1137
1007
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1138
|
-
|
|
1139
|
-
var _param =
|
|
1008
|
+
result1[item.controlId] = Object.entries(dataBind4).reduce(function(result, param) {
|
|
1009
|
+
var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
|
|
1140
1010
|
// objectDataBind的元素,跳过下一次赋值
|
|
1141
1011
|
skipKeys.push(dataBind.fieldCode);
|
|
1142
1012
|
var value = state[dataBind.fieldCode];
|
|
@@ -1146,10 +1016,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1146
1016
|
return result;
|
|
1147
1017
|
}, oldState);
|
|
1148
1018
|
} else {
|
|
1149
|
-
|
|
1019
|
+
result1[controlId] = state[fieldCode];
|
|
1150
1020
|
}
|
|
1151
1021
|
});
|
|
1152
|
-
return
|
|
1022
|
+
return result1;
|
|
1153
1023
|
}
|
|
1154
1024
|
},
|
|
1155
1025
|
{
|
|
@@ -1159,34 +1029,36 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1159
1029
|
* @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
|
|
1160
1030
|
*/ key: "setData",
|
|
1161
1031
|
value: function setData(dataSet, options) {
|
|
1162
|
-
var
|
|
1032
|
+
var _this7 = this;
|
|
1163
1033
|
this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
|
|
1164
1034
|
var newState = {};
|
|
1165
1035
|
Object.keys(dataSet).map(function(dataCode) {
|
|
1166
1036
|
var entity = dataSet[dataCode];
|
|
1167
1037
|
if (Array.isArray(entity)) {
|
|
1038
|
+
var _this5 = _this7;
|
|
1168
1039
|
entity.map(function(row) {
|
|
1169
|
-
var
|
|
1040
|
+
var _this = _this5;
|
|
1041
|
+
var mapping = _this5.getDataBindMapping(dataCode);
|
|
1170
1042
|
if (!mapping) {
|
|
1171
1043
|
return;
|
|
1172
1044
|
}
|
|
1173
|
-
var newRow = JSONCopy(
|
|
1045
|
+
var newRow = JSONCopy(_this5.store.emptyState[mapping.dataViewId][mapping.controlId]);
|
|
1174
1046
|
var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
|
|
1175
1047
|
;
|
|
1176
1048
|
Object.keys(row).map(function(fieldCode) {
|
|
1177
|
-
var
|
|
1049
|
+
var ref, ref22;
|
|
1178
1050
|
if (skipKey.includes(fieldCode)) {
|
|
1179
1051
|
return;
|
|
1180
1052
|
}
|
|
1181
|
-
var fieldMapping = (
|
|
1053
|
+
var fieldMapping = (ref = _this.store.dataBindMapping[dataCode]) === null || ref === void 0 ? void 0 : (ref22 = ref.fields) === null || ref22 === void 0 ? void 0 : ref22.find(function(i) {
|
|
1182
1054
|
return i.fieldCode === fieldCode;
|
|
1183
1055
|
});
|
|
1184
1056
|
if (fieldMapping) {
|
|
1185
1057
|
if (_instanceof(fieldMapping.dataBind, DataBind) && row[fieldCode] !== undefined) {
|
|
1186
1058
|
newRow[fieldMapping.controlId] = row[fieldCode];
|
|
1187
1059
|
} else if (_instanceof(fieldMapping.dataBind, ObjectDataBind)) {
|
|
1188
|
-
var
|
|
1189
|
-
var objValue = JSONCopy((
|
|
1060
|
+
var ref23;
|
|
1061
|
+
var objValue = JSONCopy((ref23 = _this.getEmptyState(fieldMapping.controlId)) !== null && ref23 !== void 0 ? ref23 : {});
|
|
1190
1062
|
Object.keys(fieldMapping.dataBind).map(function(key) {
|
|
1191
1063
|
var dataBind = fieldMapping.dataBind[key];
|
|
1192
1064
|
if (row[dataBind.fieldCode] !== undefined) {
|
|
@@ -1207,29 +1079,31 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1207
1079
|
newState[mapping.dataViewId][mapping.controlId].push(newRow);
|
|
1208
1080
|
});
|
|
1209
1081
|
} else if (entity) {
|
|
1210
|
-
var
|
|
1211
|
-
var
|
|
1082
|
+
var ref24;
|
|
1083
|
+
var skipKey1 = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
|
|
1212
1084
|
;
|
|
1213
|
-
var emptyState = JSONCopy(
|
|
1214
|
-
if (!((
|
|
1215
|
-
var
|
|
1085
|
+
var emptyState = JSONCopy(_this7.store.emptyState);
|
|
1086
|
+
if (!((ref24 = Object.keys(entity)) === null || ref24 === void 0 ? void 0 : ref24.length)) {
|
|
1087
|
+
var _this3 = _this7;
|
|
1088
|
+
var ref18;
|
|
1216
1089
|
//判断entity 为空对象就给表单赋值默认值
|
|
1217
1090
|
newState = JSONCopy(emptyState);
|
|
1218
|
-
var
|
|
1219
|
-
var dataViewControlId = (
|
|
1220
|
-
var
|
|
1221
|
-
var state = (
|
|
1091
|
+
var ref19;
|
|
1092
|
+
var dataViewControlId = (ref19 = (ref18 = _this7.getDataBindMapping(dataCode)) === null || ref18 === void 0 ? void 0 : ref18.controlId) !== null && ref19 !== void 0 ? ref19 : '';
|
|
1093
|
+
var _dataViewControlId;
|
|
1094
|
+
var state = (_dataViewControlId = emptyState[dataViewControlId]) !== null && _dataViewControlId !== void 0 ? _dataViewControlId : {};
|
|
1222
1095
|
Object.keys(state).map(function(key) {
|
|
1223
|
-
if (
|
|
1096
|
+
if (_this3.getControlIdMapping()[key].children !== undefined) {
|
|
1224
1097
|
newState[dataViewControlId][key] = undefined;
|
|
1225
1098
|
}
|
|
1226
1099
|
});
|
|
1227
1100
|
} else {
|
|
1101
|
+
var _this4 = _this7;
|
|
1228
1102
|
Object.keys(entity).map(function(fieldCode) {
|
|
1229
|
-
if (
|
|
1103
|
+
if (skipKey1.includes(fieldCode)) {
|
|
1230
1104
|
return;
|
|
1231
1105
|
}
|
|
1232
|
-
var mapping =
|
|
1106
|
+
var mapping = _this4.getDataBindMapping(dataCode, fieldCode);
|
|
1233
1107
|
if (mapping) {
|
|
1234
1108
|
if (!newState[mapping.dataViewId[0]]) {
|
|
1235
1109
|
newState[mapping.dataViewId[0]] = {};
|
|
@@ -1237,39 +1111,39 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1237
1111
|
if (_instanceof(mapping.dataBind, DataBind) && entity[fieldCode] !== undefined) {
|
|
1238
1112
|
newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
|
|
1239
1113
|
} else if (_instanceof(mapping.dataBind, ObjectDataBind)) {
|
|
1240
|
-
var
|
|
1241
|
-
var objValue = (
|
|
1114
|
+
var ref;
|
|
1115
|
+
var objValue = (ref = _this4.getEmptyState(mapping.controlId)) !== null && ref !== void 0 ? ref : {};
|
|
1242
1116
|
Object.keys(mapping.dataBind).map(function(key) {
|
|
1243
1117
|
var dataBind = mapping.dataBind[key];
|
|
1244
1118
|
if (entity[dataBind.fieldCode] !== undefined) {
|
|
1245
1119
|
objValue[key] = entity[dataBind.fieldCode];
|
|
1246
1120
|
}
|
|
1247
|
-
|
|
1121
|
+
skipKey1.push(dataBind.fieldCode);
|
|
1248
1122
|
});
|
|
1249
1123
|
newState[mapping.dataViewId[0]][mapping.controlId] = objValue;
|
|
1250
1124
|
}
|
|
1251
1125
|
}
|
|
1252
1126
|
});
|
|
1253
1127
|
}
|
|
1254
|
-
var newMapping =
|
|
1128
|
+
var newMapping = _this7.getDataBindMapping(dataCode);
|
|
1255
1129
|
if (newMapping) {
|
|
1256
|
-
var
|
|
1257
|
-
var mappingKeys = newMapping === null || newMapping === void 0 ? void 0 : (
|
|
1130
|
+
var ref20;
|
|
1131
|
+
var mappingKeys = newMapping === null || newMapping === void 0 ? void 0 : (ref20 = newMapping.fields) === null || ref20 === void 0 ? void 0 : ref20.map(function(item) {
|
|
1258
1132
|
return item === null || item === void 0 ? void 0 : item.controlId;
|
|
1259
1133
|
});
|
|
1260
|
-
var mappingValue =
|
|
1261
|
-
var
|
|
1262
|
-
var mainStateKeys = Object.keys((
|
|
1134
|
+
var mappingValue = _this7.getEmptyState(newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId);
|
|
1135
|
+
var ref21;
|
|
1136
|
+
var mainStateKeys = Object.keys((ref21 = newState === null || newState === void 0 ? void 0 : newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) !== null && ref21 !== void 0 ? ref21 : {});
|
|
1263
1137
|
mappingKeys === null || mappingKeys === void 0 ? void 0 : mappingKeys.forEach(function(key) {
|
|
1264
|
-
if (!mainStateKeys.includes(key) && key !==
|
|
1138
|
+
if (!mainStateKeys.includes(key) && key !== 'uid' && newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) {
|
|
1265
1139
|
if (Object.keys(newState).length) {
|
|
1266
|
-
Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId],
|
|
1140
|
+
Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId], _defineProperty({}, key, mappingValue[key]));
|
|
1267
1141
|
} else {
|
|
1268
|
-
Object.assign(newState,
|
|
1142
|
+
Object.assign(newState, _defineProperty({}, newMapping.controlId, _defineProperty({}, key, mappingValue[key])));
|
|
1269
1143
|
}
|
|
1270
1144
|
}
|
|
1271
1145
|
});
|
|
1272
|
-
|
|
1146
|
+
_this7.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
|
|
1273
1147
|
}
|
|
1274
1148
|
}
|
|
1275
1149
|
});
|
|
@@ -1336,13 +1210,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1336
1210
|
}
|
|
1337
1211
|
}
|
|
1338
1212
|
} else {
|
|
1339
|
-
var
|
|
1340
|
-
var controlIdMapping = (
|
|
1341
|
-
var
|
|
1342
|
-
var
|
|
1343
|
-
var _param =
|
|
1213
|
+
var ref;
|
|
1214
|
+
var controlIdMapping = (ref = this.getControlIdMapping()) !== null && ref !== void 0 ? ref : {};
|
|
1215
|
+
var ref25;
|
|
1216
|
+
var ref26 = _slicedToArray((ref25 = Object.entries(controlIdMapping).find(function(param) {
|
|
1217
|
+
var _param = _slicedToArray(param, 2), _ = _param[0], mapping = _param[1];
|
|
1344
1218
|
return mapping.children && controlId in mapping.children;
|
|
1345
|
-
})) !== null &&
|
|
1219
|
+
})) !== null && ref25 !== void 0 ? ref25 : [], 1), subtableId = ref26[0];
|
|
1346
1220
|
if (subtableId) {
|
|
1347
1221
|
var subtable = this.getInstance(subtableId);
|
|
1348
1222
|
// @ts-ignore
|
|
@@ -1369,16 +1243,16 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1369
1243
|
{
|
|
1370
1244
|
key: "setInstance",
|
|
1371
1245
|
value: function setInstance(instance, props, value, rowIndex) {
|
|
1372
|
-
var _this = this;
|
|
1373
1246
|
try {
|
|
1374
|
-
if (typeof instance ===
|
|
1247
|
+
if (typeof instance === 'string' && rowIndex === -1) {
|
|
1248
|
+
var _this = this;
|
|
1375
1249
|
//修改明细表整列属性的逻辑
|
|
1376
1250
|
var instances = this.getInstances(instance, rowIndex === -1);
|
|
1377
1251
|
instances.map(function(_instance) {
|
|
1378
1252
|
if (_instance) {
|
|
1379
1253
|
_this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
|
|
1380
1254
|
updateValueFromKeys(_instance.props, props, value);
|
|
1381
|
-
_this.schemaEvent(
|
|
1255
|
+
_this.schemaEvent('schema-change', {
|
|
1382
1256
|
instance: _instance,
|
|
1383
1257
|
props: props,
|
|
1384
1258
|
value: value,
|
|
@@ -1387,19 +1261,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1387
1261
|
}
|
|
1388
1262
|
});
|
|
1389
1263
|
} else {
|
|
1390
|
-
var
|
|
1391
|
-
if (typeof instance ===
|
|
1392
|
-
|
|
1264
|
+
var _instance1;
|
|
1265
|
+
if (typeof instance === 'string') {
|
|
1266
|
+
_instance1 = this.getInstance(instance, rowIndex);
|
|
1393
1267
|
} else {
|
|
1394
|
-
|
|
1268
|
+
_instance1 = instance;
|
|
1395
1269
|
}
|
|
1396
|
-
if (!
|
|
1270
|
+
if (!_instance1) {
|
|
1397
1271
|
return;
|
|
1398
1272
|
}
|
|
1399
|
-
this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。",
|
|
1400
|
-
updateValueFromKeys(
|
|
1401
|
-
this.schemaEvent(
|
|
1402
|
-
instance:
|
|
1273
|
+
this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance1.id, _instance1, props, value);
|
|
1274
|
+
updateValueFromKeys(_instance1.props, props, value);
|
|
1275
|
+
this.schemaEvent('schema-change', {
|
|
1276
|
+
instance: _instance1,
|
|
1403
1277
|
props: props,
|
|
1404
1278
|
value: value,
|
|
1405
1279
|
rowIndex: rowIndex
|
|
@@ -1549,8 +1423,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1549
1423
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
1550
1424
|
args[_key] = arguments[_key];
|
|
1551
1425
|
}
|
|
1552
|
-
var
|
|
1553
|
-
return (
|
|
1426
|
+
var _runtime;
|
|
1427
|
+
return (_runtime = this.runtime).registerControlConfig.apply(_runtime, _toConsumableArray(args));
|
|
1554
1428
|
}
|
|
1555
1429
|
},
|
|
1556
1430
|
{
|
|
@@ -1562,11 +1436,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1562
1436
|
{
|
|
1563
1437
|
key: "inList",
|
|
1564
1438
|
value: function inList(controlId) {
|
|
1565
|
-
var
|
|
1566
|
-
var mapping = (
|
|
1439
|
+
var _controlIdMapping;
|
|
1440
|
+
var mapping = (_controlIdMapping = this.store.controlIdMapping) !== null && _controlIdMapping !== void 0 ? _controlIdMapping : {};
|
|
1567
1441
|
var result = Object.keys(mapping).some(function(key) {
|
|
1568
|
-
var
|
|
1569
|
-
return (
|
|
1442
|
+
var ref, ref27;
|
|
1443
|
+
return (ref = mapping[key]) === null || ref === void 0 ? void 0 : (ref27 = ref.children) === null || ref27 === void 0 ? void 0 : ref27.hasOwnProperty(controlId);
|
|
1570
1444
|
});
|
|
1571
1445
|
return result;
|
|
1572
1446
|
}
|
|
@@ -1580,7 +1454,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1580
1454
|
arg[_key] = arguments[_key];
|
|
1581
1455
|
}
|
|
1582
1456
|
var _Runtime;
|
|
1583
|
-
return (_Runtime = Runtime).register.apply(_Runtime,
|
|
1457
|
+
return (_Runtime = Runtime).register.apply(_Runtime, _toConsumableArray(arg));
|
|
1584
1458
|
}
|
|
1585
1459
|
},
|
|
1586
1460
|
{
|
|
@@ -1593,4 +1467,4 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1593
1467
|
return Engine;
|
|
1594
1468
|
}(Watcher);
|
|
1595
1469
|
export { Engine };
|
|
1596
|
-
console.log(
|
|
1470
|
+
console.log('a');
|