@byteluck-fe/model-driven-engine 2.1.0-sourcemap.2 → 2.1.0-sourcemap.3

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.
@@ -431,7 +431,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
431
431
  };
432
432
  _proto._proxyStateBeforeSetCallback = function _proxyStateBeforeSetCallback(state, key, newValue, oldValue) {
433
433
  var _this = this;
434
- var instance = findItem(this.runtime.flatInstances, key);
434
+ var instance = findItem(this.runtime.flatInstances, key, this.runtime.instanceMap);
435
435
  // 找不到控件说明不是改动控件上的字段,直接通过
436
436
  if (!instance) {
437
437
  return newValue;
@@ -472,7 +472,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
472
472
  };
473
473
  _proto._handlerArrayUpdate = function _handlerArrayUpdate(state, key, type, args, result) {
474
474
  var _this = this;
475
- var subtable = findItem(this.runtime.flatInstances, key);
475
+ var subtable = findItem(this.runtime.flatInstances, key, this.runtime.instanceMap);
476
476
  if (!_instanceof(subtable, RuntimeListControl)) return;
477
477
  // 新增多行方法
478
478
  var createRows = function(len) {
@@ -562,7 +562,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
562
562
  }
563
563
  };
564
564
  _proto._handlerObjectUpdate = function _handlerObjectUpdate(state, key, value, oldValue) {
565
- var instance = findItem(this.runtime.flatInstances, key);
565
+ var instance = findItem(this.runtime.flatInstances, key, this.runtime.instanceMap);
566
566
  if (!instance) {
567
567
  return;
568
568
  }
@@ -32,6 +32,7 @@ function _unsupportedIterableToArray(o, minLen) {
32
32
  }
33
33
  import { RuntimeFormControl } from "@byteluck-fe/model-driven-core";
34
34
  import { error, logerror } from "@byteluck-fe/model-driven-shared";
35
+ var cc = console;
35
36
  var proxyArrayApi = [
36
37
  "splice",
37
38
  "push",
@@ -221,15 +222,22 @@ function flatInstanceForChildren(controls) {
221
222
  * 在flatInstance中通过key查找出对应的instance
222
223
  * @param flatInstance 拍平的instance数组
223
224
  * @param key 操作的数据在state的key - 可以是深层次的 subtable.0.input等
224
- * */ export function findItem(flatInstance, key) {
225
+ * */ export function findItem(flatInstance, key, instanceMap) {
225
226
  if (key === "") return undefined;
226
227
  var keys = key.split(".");
227
228
  if (keys.length === 0) return undefined;
228
229
  var oneKey = keys[0];
229
230
  var otherKeys = keys.slice(1);
231
+ cc.time("findItem flatInstance find");
230
232
  var initInstance = flatInstance.find(function(item) {
231
233
  return item.id === oneKey;
232
234
  });
235
+ cc.log("\uD83C\uDFE0 findItem flatInstance find result", initInstance);
236
+ cc.timeEnd("findItem flatInstance find");
237
+ cc.time("findItem instanceMap match");
238
+ var initInstance2 = instanceMap[oneKey];
239
+ cc.log("\uD83C\uDFE0 findItem instanceMap match result", initInstance2);
240
+ cc.timeEnd("findItem instanceMap match");
233
241
  if (otherKeys.length === 0) return initInstance;
234
242
  // @ts-ignore
235
243
  return otherKeys.reduce(function(prevItem, key) {