@byteluck-fe/model-driven-engine 2.7.0-alpha.31a → 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.
Files changed (41) hide show
  1. package/README.md +30 -30
  2. package/dist/esm/common/ActionManager.js +60 -177
  3. package/dist/esm/common/DataManager.js +25 -134
  4. package/dist/esm/common/Engine.js +292 -397
  5. package/dist/esm/common/OkWorker.js +17 -31
  6. package/dist/esm/common/Plugin.js +2 -2
  7. package/dist/esm/common/Runtime.js +41 -56
  8. package/dist/esm/common/Store.js +62 -63
  9. package/dist/esm/common/checkerValue.js +108 -108
  10. package/dist/esm/common/index.js +2 -2
  11. package/dist/esm/common/proxyState.js +76 -76
  12. package/dist/esm/index.js +3 -3
  13. package/dist/esm/plugins/CalcPlugin.js +119 -127
  14. package/dist/esm/plugins/ControlsEventPlugin.js +73 -196
  15. package/dist/esm/plugins/ES6ModulePlugin.js +22 -39
  16. package/dist/esm/plugins/LifecycleEventPlugin.js +79 -198
  17. package/dist/esm/plugins/StylePlugin.js +11 -26
  18. package/dist/esm/plugins/index.js +5 -5
  19. package/dist/esm/utils/index.js +1 -1
  20. package/dist/esm/utils/runtimeUtils.js +7 -5
  21. package/dist/index.umd.js +8 -8
  22. package/dist/types/common/ActionManager.d.ts +14 -14
  23. package/dist/types/common/DataManager.d.ts +10 -10
  24. package/dist/types/common/Engine.d.ts +181 -181
  25. package/dist/types/common/OkWorker.d.ts +13 -13
  26. package/dist/types/common/Plugin.d.ts +6 -6
  27. package/dist/types/common/Runtime.d.ts +26 -26
  28. package/dist/types/common/Store.d.ts +50 -50
  29. package/dist/types/common/checkerValue.d.ts +3 -3
  30. package/dist/types/common/index.d.ts +2 -2
  31. package/dist/types/common/proxyState.d.ts +30 -30
  32. package/dist/types/index.d.ts +3 -3
  33. package/dist/types/plugins/CalcPlugin.d.ts +121 -121
  34. package/dist/types/plugins/ControlsEventPlugin.d.ts +15 -15
  35. package/dist/types/plugins/ES6ModulePlugin.d.ts +27 -27
  36. package/dist/types/plugins/LifecycleEventPlugin.d.ts +14 -14
  37. package/dist/types/plugins/StylePlugin.d.ts +12 -12
  38. package/dist/types/plugins/index.d.ts +5 -5
  39. package/dist/types/utils/index.d.ts +1 -1
  40. package/dist/types/utils/runtimeUtils.d.ts +5 -5
  41. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- function _class_call_check(instance, Constructor) {
1
+ function _classCallCheck(instance, Constructor) {
2
2
  if (!(instance instanceof Constructor)) {
3
3
  throw new TypeError("Cannot call a class as a function");
4
4
  }
@@ -12,38 +12,24 @@ function _defineProperties(target, props) {
12
12
  Object.defineProperty(target, descriptor.key, descriptor);
13
13
  }
14
14
  }
15
- function _create_class(Constructor, protoProps, staticProps) {
15
+ function _createClass(Constructor, protoProps, staticProps) {
16
16
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17
17
  if (staticProps) _defineProperties(Constructor, staticProps);
18
18
  return Constructor;
19
19
  }
20
- function _define_property(obj, key, value) {
21
- if (key in obj) {
22
- Object.defineProperty(obj, key, {
23
- value: value,
24
- enumerable: true,
25
- configurable: true,
26
- writable: true
27
- });
28
- } else {
29
- obj[key] = value;
30
- }
31
- return obj;
32
- }
33
- import { log } from "@byteluck-fe/model-driven-shared";
20
+ import { log } from '@byteluck-fe/model-driven-shared';
34
21
  var OkWorker = /*#__PURE__*/ function() {
35
22
  "use strict";
36
23
  function OkWorker() {
37
- _class_call_check(this, OkWorker);
38
- _define_property(this, "worker", void 0);
24
+ _classCallCheck(this, OkWorker);
39
25
  }
40
- _create_class(OkWorker, [
26
+ _createClass(OkWorker, [
41
27
  {
42
28
  key: "run",
43
29
  value: function run(initState) {
44
30
  this.worker = OkWorker.createWorker();
45
31
  this.postMessage({
46
- action: "init",
32
+ action: 'init',
47
33
  payload: initState
48
34
  });
49
35
  }
@@ -51,15 +37,15 @@ var OkWorker = /*#__PURE__*/ function() {
51
37
  {
52
38
  key: "destroy",
53
39
  value: function destroy() {
54
- var _this_worker;
55
- (_this_worker = this.worker) === null || _this_worker === void 0 ? void 0 : _this_worker.terminate();
40
+ var ref;
41
+ (ref = this.worker) === null || ref === void 0 ? void 0 : ref.terminate();
56
42
  }
57
43
  },
58
44
  {
59
45
  key: "postMessage",
60
46
  value: function postMessage(message) {
61
- var _this_worker;
62
- (_this_worker = this.worker) === null || _this_worker === void 0 ? void 0 : _this_worker.postMessage(message);
47
+ var ref;
48
+ (ref = this.worker) === null || ref === void 0 ? void 0 : ref.postMessage(message);
63
49
  }
64
50
  }
65
51
  ], [
@@ -85,7 +71,7 @@ var OkWorker = /*#__PURE__*/ function() {
85
71
  set: function set(target, key, value) {
86
72
  if (parentKey) {
87
73
  _self.postMessage({
88
- action: "update",
74
+ action: 'update',
89
75
  key: "".concat(parentKey, ".").concat(key)
90
76
  });
91
77
  }
@@ -93,7 +79,7 @@ var OkWorker = /*#__PURE__*/ function() {
93
79
  }
94
80
  };
95
81
  };
96
- log("‍\uD83D\uDE80 worker running");
82
+ log('‍🚀 worker running');
97
83
  var _self = self;
98
84
  // function createProxy(
99
85
  // obj: Record<string, unknown> | Array<Record<string, unknown>>,
@@ -106,8 +92,8 @@ var OkWorker = /*#__PURE__*/ function() {
106
92
  // }
107
93
  // return new Proxy(obj, createHandler(parentKey))
108
94
  // }
109
- _self.addEventListener("message", function(event) {
110
- var _event_data = event.data, action = _event_data.action, payload = _event_data.payload, fn = _event_data.fn;
95
+ _self.addEventListener('message', function(event) {
96
+ var _data = event.data, action = _data.action, payload = _data.payload, fn = _data.fn;
111
97
  log(action, payload);
112
98
  // 通过proxy进行代理,每次修改的时候,自动向外抛出postMessage
113
99
  // data.key1 = 1
@@ -118,10 +104,10 @@ var OkWorker = /*#__PURE__*/ function() {
118
104
  //
119
105
  // const result = fn(data, schema)
120
106
  _self.postMessage({
121
- action: "delete",
107
+ action: 'delete',
122
108
  payload: {
123
- key: "key3[0].key1",
124
- value: "index"
109
+ key: 'key3[0].key1',
110
+ value: 'index'
125
111
  }
126
112
  });
127
113
  });
@@ -1,10 +1,10 @@
1
- function _class_call_check(instance, Constructor) {
1
+ function _classCallCheck(instance, Constructor) {
2
2
  if (!(instance instanceof Constructor)) {
3
3
  throw new TypeError("Cannot call a class as a function");
4
4
  }
5
5
  }
6
6
  var Plugin = function Plugin() {
7
7
  "use strict";
8
- _class_call_check(this, Plugin);
8
+ _classCallCheck(this, Plugin);
9
9
  };
10
10
  export { Plugin };
@@ -1,10 +1,10 @@
1
- function _assert_this_initialized(self) {
1
+ function _assertThisInitialized(self) {
2
2
  if (self === void 0) {
3
3
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4
4
  }
5
5
  return self;
6
6
  }
7
- function _class_call_check(instance, Constructor) {
7
+ function _classCallCheck(instance, Constructor) {
8
8
  if (!(instance instanceof Constructor)) {
9
9
  throw new TypeError("Cannot call a class as a function");
10
10
  }
@@ -18,29 +18,16 @@ function _defineProperties(target, props) {
18
18
  Object.defineProperty(target, descriptor.key, descriptor);
19
19
  }
20
20
  }
21
- function _create_class(Constructor, protoProps, staticProps) {
21
+ function _createClass(Constructor, protoProps, staticProps) {
22
22
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
23
23
  if (staticProps) _defineProperties(Constructor, staticProps);
24
24
  return Constructor;
25
25
  }
26
- function _define_property(obj, key, value) {
27
- if (key in obj) {
28
- Object.defineProperty(obj, key, {
29
- value: value,
30
- enumerable: true,
31
- configurable: true,
32
- writable: true
33
- });
34
- } else {
35
- obj[key] = value;
36
- }
37
- return obj;
38
- }
39
- function _get_prototype_of(o) {
40
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
26
+ function _getPrototypeOf(o) {
27
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
41
28
  return o.__proto__ || Object.getPrototypeOf(o);
42
29
  };
43
- return _get_prototype_of(o);
30
+ return _getPrototypeOf(o);
44
31
  }
45
32
  function _inherits(subClass, superClass) {
46
33
  if (typeof superClass !== "function" && superClass !== null) {
@@ -53,26 +40,26 @@ function _inherits(subClass, superClass) {
53
40
  configurable: true
54
41
  }
55
42
  });
56
- if (superClass) _set_prototype_of(subClass, superClass);
43
+ if (superClass) _setPrototypeOf(subClass, superClass);
57
44
  }
58
- function _possible_constructor_return(self, call) {
59
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
45
+ function _possibleConstructorReturn(self, call) {
46
+ if (call && (_typeof(call) === "object" || typeof call === "function")) {
60
47
  return call;
61
48
  }
62
- return _assert_this_initialized(self);
49
+ return _assertThisInitialized(self);
63
50
  }
64
- function _set_prototype_of(o, p) {
65
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
51
+ function _setPrototypeOf(o, p) {
52
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
66
53
  o.__proto__ = p;
67
54
  return o;
68
55
  };
69
- return _set_prototype_of(o, p);
56
+ return _setPrototypeOf(o, p);
70
57
  }
71
- function _type_of(obj) {
58
+ var _typeof = function(obj) {
72
59
  "@swc/helpers - typeof";
73
60
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
74
- }
75
- function _is_native_reflect_construct() {
61
+ };
62
+ function _isNativeReflectConstruct() {
76
63
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
77
64
  if (Reflect.construct.sham) return false;
78
65
  if (typeof Proxy === "function") return true;
@@ -83,49 +70,47 @@ function _is_native_reflect_construct() {
83
70
  return false;
84
71
  }
85
72
  }
86
- function _create_super(Derived) {
87
- var hasNativeReflectConstruct = _is_native_reflect_construct();
73
+ function _createSuper(Derived) {
74
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
88
75
  return function _createSuperInternal() {
89
- var Super = _get_prototype_of(Derived), result;
76
+ var Super = _getPrototypeOf(Derived), result;
90
77
  if (hasNativeReflectConstruct) {
91
- var NewTarget = _get_prototype_of(this).constructor;
78
+ var NewTarget = _getPrototypeOf(this).constructor;
92
79
  result = Reflect.construct(Super, arguments, NewTarget);
93
80
  } else {
94
81
  result = Super.apply(this, arguments);
95
82
  }
96
- return _possible_constructor_return(this, result);
83
+ return _possibleConstructorReturn(this, result);
97
84
  };
98
85
  }
99
- import { RegisterControls } from "@byteluck-fe/model-driven-core";
100
- import { CONTROL_BASE_TYPE, CONTROL_TYPE, JSONCopy, loopFormSchema, isArray } from "@byteluck-fe/model-driven-shared";
101
- import { hasChildrenControl, loopDataViewControl, loopFormControl } from "../utils/runtimeUtils";
102
- export var Runtime = /*#__PURE__*/ function(RegisterControls) {
86
+ import { RegisterControls } from '@byteluck-fe/model-driven-core';
87
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE, JSONCopy, loopFormSchema, isArray } from '@byteluck-fe/model-driven-shared';
88
+ import { hasChildrenControl, loopDataViewControl, loopFormControl } from '../utils/runtimeUtils';
89
+ export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
103
90
  "use strict";
104
- _inherits(Runtime, RegisterControls);
105
- var _super = _create_super(Runtime);
91
+ _inherits(Runtime, RegisterControls1);
92
+ var _super = _createSuper(Runtime);
106
93
  function Runtime(props) {
107
- _class_call_check(this, Runtime);
94
+ _classCallCheck(this, Runtime);
108
95
  var _this;
109
- _this = _super.call(this, "Runtime");
110
- _define_property(_assert_this_initialized(_this), "_schema", void 0);
111
- _define_property(_assert_this_initialized(_this), "_instance", void 0);
112
- _define_property(_assert_this_initialized(_this), "_flatInstances", []);
113
- _define_property(_assert_this_initialized(_this), "_instanceMap", {});
114
- _define_property(_assert_this_initialized(_this), "_controlParentIdMap", {});
96
+ _this = _super.call(this, 'Runtime');
97
+ _this._flatInstances = [];
98
+ _this._instanceMap = {};
99
+ _this._controlParentIdMap = {};
115
100
  var schema = props.schema;
116
101
  _this._schema = schema;
117
102
  _this._instance = _this.createControl(schema, props.beforeCreateInstance);
118
103
  _this.getFlatInstances();
119
104
  return _this;
120
105
  }
121
- _create_class(Runtime, [
106
+ _createClass(Runtime, [
122
107
  {
123
108
  key: "getFlatInstances",
124
109
  value: function getFlatInstances() {
125
110
  var instances = [];
126
111
  var instanceMap = {};
127
112
  var controlParentIdMap = {};
128
- loop(this._instance, "", function(item, parentId) {
113
+ loop(this._instance, '', function(item, parentId) {
129
114
  // 3.4.1 避免将subtable-row 放到 _flatInstances 中
130
115
  //4.3.0-lh2 将自处注释掉,为使instance.parent能取到父级
131
116
  // if (item.type === 'subtable-row' || item.type === 'subtable-column') {
@@ -139,7 +124,7 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
139
124
  instanceMap[item.id] = [];
140
125
  }
141
126
  //不知为何subtable-column会多存一次
142
- if (item.type === "subtable-column") {
127
+ if (item.type === 'subtable-column') {
143
128
  if (instanceMap[item.id].length > 0) {
144
129
  return;
145
130
  }
@@ -262,10 +247,10 @@ function loop(control, parentId, callback) {
262
247
  // @ts-ignore
263
248
  loop(ctl.children, ctl.id, callback);
264
249
  }
265
- if (hasHeaderOrFooterControl(item, "headers")) {
250
+ if (hasHeaderOrFooterControl(item, 'headers')) {
266
251
  loop(item.props.headers, item.id, callback);
267
252
  }
268
- if (hasHeaderOrFooterControl(item, "footers")) {
253
+ if (hasHeaderOrFooterControl(item, 'footers')) {
269
254
  loop(item.props.footers, item.id, callback);
270
255
  }
271
256
  });
@@ -273,8 +258,8 @@ function loop(control, parentId, callback) {
273
258
  function hasHeaderOrFooterControl(control, checkType) {
274
259
  return checkType in control.props && isArray(control.props[checkType]);
275
260
  }
276
- /**
277
- * 控件是否在视图中隐藏,遍历查找所有parent
261
+ /**
262
+ * 控件是否在视图中隐藏,遍历查找所有parent
278
263
  * */ function getControlIsHide(control) {
279
264
  if (control.props.isHide) {
280
265
  return true;
@@ -298,7 +283,7 @@ item) {
298
283
  // data[item.id] = item.rules
299
284
  data[item.id] = result;
300
285
  var itemRules = {
301
- type: "array",
286
+ type: 'array',
302
287
  fields: {}
303
288
  };
304
289
  item.children.forEach(function(row, index) {
@@ -306,7 +291,7 @@ item) {
306
291
  if (itemRules.fields) {
307
292
  if (!itemRules.fields[index]) {
308
293
  itemRules.fields[index] = {
309
- type: "object",
294
+ type: 'object',
310
295
  required: true,
311
296
  fields: {}
312
297
  };
@@ -1,4 +1,4 @@
1
- function _class_call_check(instance, Constructor) {
1
+ function _classCallCheck(instance, Constructor) {
2
2
  if (!(instance instanceof Constructor)) {
3
3
  throw new TypeError("Cannot call a class as a function");
4
4
  }
@@ -12,12 +12,12 @@ function _defineProperties(target, props) {
12
12
  Object.defineProperty(target, descriptor.key, descriptor);
13
13
  }
14
14
  }
15
- function _create_class(Constructor, protoProps, staticProps) {
15
+ function _createClass(Constructor, protoProps, staticProps) {
16
16
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17
17
  if (staticProps) _defineProperties(Constructor, staticProps);
18
18
  return Constructor;
19
19
  }
20
- function _define_property(obj, key, value) {
20
+ function _defineProperty(obj, key, value) {
21
21
  if (key in obj) {
22
22
  Object.defineProperty(obj, key, {
23
23
  value: value,
@@ -30,7 +30,7 @@ function _define_property(obj, key, value) {
30
30
  }
31
31
  return obj;
32
32
  }
33
- function _object_spread(target) {
33
+ function _objectSpread(target) {
34
34
  for(var i = 1; i < arguments.length; i++){
35
35
  var source = arguments[i] != null ? arguments[i] : {};
36
36
  var ownKeys = Object.keys(source);
@@ -40,40 +40,33 @@ function _object_spread(target) {
40
40
  }));
41
41
  }
42
42
  ownKeys.forEach(function(key) {
43
- _define_property(target, key, source[key]);
43
+ _defineProperty(target, key, source[key]);
44
44
  });
45
45
  }
46
46
  return target;
47
47
  }
48
- import { DataBind, isDataBind } from "@byteluck-fe/model-driven-core";
49
- import { loopFormSchema, JSONCopy, warn, CONTROL_TYPE, CONTROL_BASE_TYPE } from "@byteluck-fe/model-driven-shared";
50
- import { loopDataViewControl, loopFormControl, buildUUID } from "../utils/runtimeUtils";
48
+ import { DataBind, isDataBind } from '@byteluck-fe/model-driven-core';
49
+ import { loopFormSchema, JSONCopy, warn, CONTROL_TYPE, CONTROL_BASE_TYPE } from '@byteluck-fe/model-driven-shared';
50
+ import { loopDataViewControl, loopFormControl, buildUUID } from '../utils/runtimeUtils';
51
51
  var Store = /*#__PURE__*/ function() {
52
52
  "use strict";
53
53
  function Store(props) {
54
- _class_call_check(this, Store);
55
- _define_property(this, "emptyState", void 0);
56
- _define_property(this, "state", void 0);
57
- _define_property(this, "dataBindMapping", void 0 // 主要提供给二开使用
58
- );
59
- _define_property(this, "controlIdMapping", void 0);
60
- _define_property(this, "defaultState", void 0);
61
- var _init = init(props.instance), state = _init.state, emptyState = _init.emptyState, databindMapping = _init.databindMapping, controlidMapping = _init.controlidMapping, defaultState = _init.defaultState;
54
+ _classCallCheck(this, Store);
55
+ var ref = init(props.instance), state = ref.state, emptyState = ref.emptyState, databindMapping = ref.databindMapping, controlidMapping = ref.controlidMapping, defaultState = ref.defaultState;
62
56
  this.emptyState = emptyState;
63
57
  this.state = state;
64
58
  this.dataBindMapping = databindMapping;
65
59
  this.controlIdMapping = controlidMapping;
66
60
  this.defaultState = defaultState;
67
61
  }
68
- _create_class(Store, [
62
+ _createClass(Store, [
69
63
  {
70
- /**
71
- * 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
72
- * @param controlId 组件ID
73
- * @param value
64
+ /**
65
+ * 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
66
+ * @param controlId 组件ID
67
+ * @param value
74
68
  */ key: "setState",
75
69
  value: function setState(controlId, value, rowIndex) {
76
- var _this = this;
77
70
  var controlInfo = this.controlIdMapping[controlId];
78
71
  if (controlInfo !== undefined) {
79
72
  //qiyu 按照对象赋值,Object.assign会触发多次key的change事件
@@ -88,15 +81,17 @@ var Store = /*#__PURE__*/ function() {
88
81
  // }
89
82
  } else {
90
83
  if (rowIndex !== undefined) {
84
+ var _this = this;
91
85
  //TODO 目前只找了一层明细表,没有递归 如果是添加uid
92
86
  Object.keys(this.controlIdMapping).map(function(subtableId) {
93
87
  var dataView = _this.controlIdMapping[subtableId].dataView;
94
88
  var children = _this.controlIdMapping[subtableId].children;
95
89
  if (children !== undefined) {
90
+ var _this1 = _this;
96
91
  Object.keys(children).map(function(childControlId) {
97
92
  if (childControlId === controlId) {
98
- if (_this.state[dataView][subtableId][rowIndex]) {
99
- _this.state[dataView][subtableId][rowIndex][controlId] = value;
93
+ if (_this1.state[dataView][subtableId][rowIndex]) {
94
+ _this1.state[dataView][subtableId][rowIndex][controlId] = value;
100
95
  }
101
96
  }
102
97
  });
@@ -112,7 +107,6 @@ var Store = /*#__PURE__*/ function() {
112
107
  {
113
108
  key: "getState",
114
109
  value: function getState(controlId, rowIndex) {
115
- var _this = this;
116
110
  //qiyu 由于header的数据是后补充的,所以从state获取第一层值。
117
111
  // const controlInfo = this.controlIdMapping[controlId]
118
112
  var detection = this.state[controlId];
@@ -124,27 +118,31 @@ var Store = /*#__PURE__*/ function() {
124
118
  return this.state[controlInfo.dataView][controlId];
125
119
  } else {
126
120
  if (rowIndex !== undefined) {
121
+ var _this = this;
127
122
  var state;
128
123
  //TODO 目前只找了一层明细表,没有递归
129
124
  Object.keys(this.controlIdMapping).map(function(subtableId) {
130
125
  var dataViewId = _this.controlIdMapping[subtableId].dataView;
131
126
  var children = _this.controlIdMapping[subtableId].children;
132
127
  if (children !== undefined) {
128
+ var _this3 = _this;
133
129
  Object.keys(children).map(function(childControlId) {
134
130
  if (childControlId === controlId) {
135
- var _this_state_dataViewId_subtableId_rowIndex;
136
- state = (_this_state_dataViewId_subtableId_rowIndex = _this.state[dataViewId][subtableId][rowIndex]) === null || _this_state_dataViewId_subtableId_rowIndex === void 0 ? void 0 : _this_state_dataViewId_subtableId_rowIndex[controlId];
131
+ var ref;
132
+ state = (ref = _this3.state[dataViewId][subtableId][rowIndex]) === null || ref === void 0 ? void 0 : ref[controlId];
137
133
  }
138
134
  });
139
135
  }
140
136
  });
141
137
  return state;
142
138
  } else {
139
+ var _this2 = this;
143
140
  var states = [];
144
141
  Object.keys(this.controlIdMapping).map(function(subtableId) {
145
- var dataViewId = _this.controlIdMapping[subtableId].dataView;
146
- var children = _this.controlIdMapping[subtableId].children;
142
+ var dataViewId = _this2.controlIdMapping[subtableId].dataView;
143
+ var children = _this2.controlIdMapping[subtableId].children;
147
144
  if (children !== undefined) {
145
+ var _this = _this2;
148
146
  Object.keys(children).map(function(childControlId) {
149
147
  if (childControlId === controlId) {
150
148
  _this.state[dataViewId][subtableId].map(function(item) {
@@ -163,7 +161,6 @@ var Store = /*#__PURE__*/ function() {
163
161
  {
164
162
  key: "getEmptyState",
165
163
  value: function getEmptyState(controlId) {
166
- var _this = this;
167
164
  var detection = this.emptyState[controlId];
168
165
  if (detection !== undefined) {
169
166
  return this.emptyState[controlId];
@@ -172,22 +169,24 @@ var Store = /*#__PURE__*/ function() {
172
169
  if (controlInfo !== undefined) {
173
170
  var state = this.emptyState[controlInfo.dataView][controlId];
174
171
  //判断找到的是否是明细表的控件
175
- if ("children" in controlInfo) {
172
+ if ('children' in controlInfo) {
176
173
  Object.assign(state, {
177
- uid: "new:" + buildUUID("uid")
174
+ uid: 'new:' + buildUUID('uid')
178
175
  });
179
176
  }
180
177
  return state;
181
178
  } else {
179
+ var _this = this;
182
180
  var state1;
183
181
  //TODO 目前只找了一层明细表,没有递归
184
182
  Object.keys(this.controlIdMapping).map(function(subtableId) {
185
183
  var dataViewId = _this.controlIdMapping[subtableId].dataView;
186
184
  var children = _this.controlIdMapping[subtableId].children;
187
185
  if (children !== undefined) {
186
+ var _this4 = _this;
188
187
  Object.keys(children).map(function(childControlId) {
189
188
  if (childControlId === controlId) {
190
- state1 = _this.emptyState[dataViewId][subtableId][controlId];
189
+ state1 = _this4.emptyState[dataViewId][subtableId][controlId];
191
190
  }
192
191
  });
193
192
  }
@@ -266,37 +265,37 @@ item) {
266
265
  loopFormSchema(item.props.headers, function(headerItem) {
267
266
  emptyTemplate[headerItem.id] = JSONCopy(headerItem.props.defaultValue);
268
267
  });
269
- var _item_props_defaultRows, _fill_map;
270
- dataViewState[item.id] = (_fill_map = new Array((_item_props_defaultRows = item.props.defaultRows) !== null && _item_props_defaultRows !== void 0 ? _item_props_defaultRows : 1).fill(0).map(function() {
271
- return _object_spread({
272
- uid: "new:" + buildUUID("uid")
268
+ var _defaultRows, ref;
269
+ dataViewState[item.id] = (ref = new Array((_defaultRows = item.props.defaultRows) !== null && _defaultRows !== void 0 ? _defaultRows : 1).fill(0).map(function() {
270
+ return _objectSpread({
271
+ uid: 'new:' + buildUUID('uid')
273
272
  }, JSONCopy(emptyTemplate));
274
- })) !== null && _fill_map !== void 0 ? _fill_map : [];
273
+ })) !== null && ref !== void 0 ? ref : [];
275
274
  emptyDataViewState[item.id] = emptyTemplate;
276
275
  }
277
276
  }
278
277
  function buildDataBindMapping(data, dataViewId, // @ts-ignore
279
- item) {
278
+ item1) {
280
279
  // if (item instanceof RuntimeFormControl) {
281
- if (item.controlType === CONTROL_BASE_TYPE.FORM) {
282
- var _item_props_dataBind, _item_props;
280
+ if (item1.controlType === CONTROL_BASE_TYPE.FORM) {
281
+ var ref, ref1;
283
282
  // if (item.props.dataBind instanceof ObjectDataBind) {
284
- if (!isDataBind(item.props.dataBind)) {
283
+ if (!isDataBind(item1.props.dataBind)) {
285
284
  // 特殊的dataBind,比如:金额是currency+amount两个key组成的,日期区间,继承自ObjectDataBind的需要通过Object.keys拿到多个databind
286
- Object.keys(item.props.dataBind).map(function(key) {
287
- var dataBind = item.props.dataBind;
285
+ Object.keys(item1.props.dataBind).map(function(key) {
286
+ var dataBind = item1.props.dataBind;
288
287
  var dataCode = dataBind[key].dataCode;
289
288
  if (dataCode !== undefined) {
290
289
  if (data[dataCode] === undefined) {
291
290
  data[dataCode] = {
292
- controlId: item.id,
291
+ controlId: item1.id,
293
292
  fields: [],
294
293
  dataViewId: dataViewId
295
294
  };
296
295
  }
297
296
  data[dataCode].fields.push({
298
297
  fieldCode: dataBind[key].fieldCode,
299
- controlId: item.id,
298
+ controlId: item1.id,
300
299
  dataBind: dataBind,
301
300
  dataViewId: [
302
301
  dataViewId
@@ -304,38 +303,38 @@ item) {
304
303
  });
305
304
  }
306
305
  });
307
- } else if (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : (_item_props_dataBind = _item_props.dataBind) === null || _item_props_dataBind === void 0 ? void 0 : _item_props_dataBind.dataCode) === undefined) {
306
+ } else if (((ref = item1.props) === null || ref === void 0 ? void 0 : (ref1 = ref.dataBind) === null || ref1 === void 0 ? void 0 : ref1.dataCode) === undefined) {
308
307
  //qiyu 2023-2-27 为空跳过。form自定义组件加载失败时,hack的组件props为空。
309
308
  } else {
310
- if (data[item.props.dataBind.dataCode] === undefined) {
311
- data[item.props.dataBind.dataCode] = {
309
+ if (data[item1.props.dataBind.dataCode] === undefined) {
310
+ data[item1.props.dataBind.dataCode] = {
312
311
  controlId: dataViewId,
313
312
  fields: [],
314
313
  dataViewId: dataViewId
315
314
  };
316
315
  }
317
- data[item.props.dataBind.dataCode].fields.push({
318
- fieldCode: item.props.dataBind.fieldCode,
319
- controlId: item.id,
320
- dataBind: item.props.dataBind,
316
+ data[item1.props.dataBind.dataCode].fields.push({
317
+ fieldCode: item1.props.dataBind.fieldCode,
318
+ controlId: item1.id,
319
+ dataBind: item1.props.dataBind,
321
320
  dataViewId: [
322
321
  dataViewId
323
322
  ]
324
323
  });
325
324
  }
326
325
  } else {
327
- if (item.props.datasourceBind.dataCode === "") {
326
+ if (item1.props.datasourceBind.dataCode === '') {
328
327
  //敏捷依赖后端生成dataCode,预览的时候没有
329
- warn("datasourceBind.dataCode is empty! maybe in preview mode, control:".concat(item.id, " type:").concat(item.type));
328
+ warn("datasourceBind.dataCode is empty! maybe in preview mode, control:".concat(item1.id, " type:").concat(item1.type));
330
329
  return;
331
330
  }
332
- data[item.props.datasourceBind.dataCode] = {
333
- controlId: item.id,
331
+ data[item1.props.datasourceBind.dataCode] = {
332
+ controlId: item1.id,
334
333
  fields: [],
335
334
  dataViewId: dataViewId
336
335
  };
337
- var subtableId = item.id;
338
- loopFormSchema(item.props.headers, function(item) {
336
+ var subtableId = item1.id;
337
+ loopFormSchema(item1.props.headers, function(item) {
339
338
  // if (item.props.dataBind instanceof ObjectDataBind) {
340
339
  if (!isDataBind(item.props.dataBind)) {
341
340
  Object.keys(item.props.dataBind).map(function(key) {
@@ -378,16 +377,16 @@ item) {
378
377
  data[item.id] = {
379
378
  dataBind: new DataBind({
380
379
  dataCode: item.props.datasourceBind.dataCode,
381
- fieldCode: ""
380
+ fieldCode: ''
382
381
  }),
383
382
  dataView: dataViewId,
384
383
  children: {},
385
384
  options: []
386
385
  };
387
386
  loopFormSchema(item.props.headers, function(formControl) {
388
- var _data_item_id;
389
- var _data_item_id_children;
390
- Object.assign((_data_item_id_children = (_data_item_id = data[item.id]) === null || _data_item_id === void 0 ? void 0 : _data_item_id.children) !== null && _data_item_id_children !== void 0 ? _data_item_id_children : {}, _define_property({}, formControl.id, {
387
+ var ref;
388
+ var ref2;
389
+ Object.assign((ref2 = (ref = data[item.id]) === null || ref === void 0 ? void 0 : ref.children) !== null && ref2 !== void 0 ? ref2 : {}, _defineProperty({}, formControl.id, {
391
390
  dataBind: formControl.props.dataBind
392
391
  }));
393
392
  });