@byteluck-fe/model-driven-engine 2.7.0-alpha.15b → 2.7.0-alpha.15c

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