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

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.
@@ -17,25 +17,11 @@ function _createClass(Constructor, protoProps, staticProps) {
17
17
  if (staticProps) _defineProperties(Constructor, staticProps);
18
18
  return Constructor;
19
19
  }
20
- function _defineProperty(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
24
  _classCallCheck(this, OkWorker);
38
- _defineProperty(this, "worker", void 0);
39
25
  }
40
26
  _createClass(OkWorker, [
41
27
  {
@@ -43,7 +29,7 @@ var OkWorker = /*#__PURE__*/ function() {
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
  });
@@ -23,19 +23,6 @@ function _createClass(Constructor, protoProps, staticProps) {
23
23
  if (staticProps) _defineProperties(Constructor, staticProps);
24
24
  return Constructor;
25
25
  }
26
- function _defineProperty(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
26
  function _getPrototypeOf(o) {
40
27
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
41
28
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -96,21 +83,20 @@ function _createSuper(Derived) {
96
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, loopFormSchema } 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);
91
+ _inherits(Runtime, RegisterControls1);
105
92
  var _super = _createSuper(Runtime);
106
93
  function Runtime(props) {
107
94
  _classCallCheck(this, Runtime);
108
95
  var _this;
109
- _this = _super.call(this, "Runtime");
110
- _defineProperty(_assertThisInitialized(_this), "_schema", void 0);
111
- _defineProperty(_assertThisInitialized(_this), "_instance", void 0);
112
- _defineProperty(_assertThisInitialized(_this), "_flatInstances", []);
113
- _defineProperty(_assertThisInitialized(_this), "_instanceMap", {});
96
+ _this = _super.call(this, 'Runtime');
97
+ _this._flatInstances = [];
98
+ _this._instanceMap = {};
99
+ _this._controlParentIdMap = {};
114
100
  var schema = props.schema;
115
101
  _this._schema = schema;
116
102
  _this._instance = _this.createControl(schema, props.beforeCreateInstance);
@@ -123,19 +109,32 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
123
109
  value: function getFlatInstances() {
124
110
  var instances = [];
125
111
  var instanceMap = {};
126
- loop(this._instance, function(item) {
112
+ var controlParentIdMap = {};
113
+ loop(this._instance, '', function(item, parentId) {
127
114
  // 3.4.1 避免将subtable-row 放到 _flatInstances 中
128
- if (item.type === "subtable-row" || item.type === "subtable-column") {
129
- return;
115
+ //4.3.0-lh2 将自处注释掉,为使instance.parent能取到父级
116
+ // if (item.type === 'subtable-row' || item.type === 'subtable-column') {
117
+ // return
118
+ // }
119
+ if (parentId) {
120
+ // @ts-ignore
121
+ controlParentIdMap[item.id] = parentId;
130
122
  }
131
- instances.push(item);
132
123
  if (!instanceMap[item.id]) {
133
124
  instanceMap[item.id] = [];
134
125
  }
126
+ //不知为何subtable-column会多存一次
127
+ if (item.type === 'subtable-column') {
128
+ if (instanceMap[item.id].length > 0) {
129
+ return;
130
+ }
131
+ }
132
+ instances.push(item);
135
133
  instanceMap[item.id].push(item);
136
134
  });
137
135
  this._flatInstances = instances;
138
136
  this._instanceMap = instanceMap;
137
+ this._controlParentIdMap = controlParentIdMap;
139
138
  return this._flatInstances;
140
139
  }
141
140
  },
@@ -169,8 +168,9 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
169
168
  var antdRules = {};
170
169
  var ruleItems = {};
171
170
  loopDataViewControl(this._instance, function(dataView) {
172
- ruleItems[dataView.id] = dataView.rules[0];
173
- antdRules[dataView.id] = dataView.rules[0];
171
+ var result = Runtime.staticGetRules(dataView.type, dataView.props);
172
+ ruleItems[dataView.id] = JSONCopy(result[0]);
173
+ antdRules[dataView.id] = JSONCopy(result[0]);
174
174
  loopFormControl(dataView.children, function(item) {
175
175
  // if (
176
176
  // item instanceof RuntimeFormControl ||
@@ -193,7 +193,9 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
193
193
  get: function get() {
194
194
  var ruleItems = {};
195
195
  loopDataViewControl(this._instance, function(dataView) {
196
- ruleItems[dataView.id] = dataView.rules[0];
196
+ var result = Runtime.staticGetRules(dataView.type, dataView.props);
197
+ // ruleItems[dataView.id] = dataView.rules[0]
198
+ ruleItems[dataView.id] = result[0];
197
199
  loopFormControl(dataView.children, function(item) {
198
200
  // if (
199
201
  // item instanceof RuntimeFormControl ||
@@ -212,7 +214,9 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
212
214
  get: function get() {
213
215
  var antdRules = {};
214
216
  loopDataViewControl(this._instance, function(dataView) {
215
- antdRules[dataView.id] = dataView.rules[0];
217
+ var result = Runtime.staticGetRules(dataView.type, dataView.props);
218
+ // antdRules[dataView.id] = dataView.rules[0]
219
+ antdRules[dataView.id] = result[0];
216
220
  loopFormControl(dataView.children, function(item) {
217
221
  // if (
218
222
  // item instanceof RuntimeFormControl ||
@@ -229,22 +233,30 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
229
233
  ]);
230
234
  return Runtime;
231
235
  }(RegisterControls);
232
- function loop(control, callback) {
233
- if (Array.isArray(control)) {
234
- control.map(function(item) {
235
- callback(item);
236
- if (hasChildrenControl(item)) {
237
- var ctl = item;
238
- if (!ctl.children) {
239
- ctl.children = [];
240
- }
241
- // @ts-ignore
242
- loop(ctl.children, callback);
236
+ function loop(control, parentId, callback) {
237
+ var _instances = Array.isArray(control) ? control : [
238
+ control
239
+ ];
240
+ _instances.map(function(item) {
241
+ callback(item, parentId);
242
+ if (hasChildrenControl(item)) {
243
+ var ctl = item;
244
+ if (!ctl.children) {
245
+ ctl.children = [];
243
246
  }
244
- });
245
- } else {
246
- callback(control);
247
- }
247
+ // @ts-ignore
248
+ loop(ctl.children, ctl.id, callback);
249
+ }
250
+ if (hasHeaderOrFooterControl(item, 'headers')) {
251
+ loop(item.props.headers, item.id, callback);
252
+ }
253
+ if (hasHeaderOrFooterControl(item, 'footers')) {
254
+ loop(item.props.footers, item.id, callback);
255
+ }
256
+ });
257
+ }
258
+ function hasHeaderOrFooterControl(control, checkType) {
259
+ return checkType in control.props && isArray(control.props[checkType]);
248
260
  }
249
261
  /**
250
262
  * 控件是否在视图中隐藏,遍历查找所有parent
@@ -252,7 +264,7 @@ function loop(control, callback) {
252
264
  if (control.props.isHide) {
253
265
  return true;
254
266
  }
255
- if (control.parent === null) {
267
+ if (control.parent === null || control.parent === undefined) {
256
268
  return false;
257
269
  }
258
270
  return getControlIsHide(control.parent);
@@ -262,13 +274,16 @@ item) {
262
274
  if (getControlIsHide(item)) {
263
275
  return;
264
276
  }
277
+ var result = Runtime.staticGetRules(item.type, item.props);
265
278
  // if (item instanceof RuntimeFormControl) {
266
279
  if (item.controlType === CONTROL_BASE_TYPE.FORM) {
267
- data[item.id] = item.rules;
280
+ // data[item.id] = item.rules
281
+ data[item.id] = result;
268
282
  } else if (item.type === CONTROL_TYPE.SUBTABLE) {
269
- data[item.id] = item.rules;
283
+ // data[item.id] = item.rules
284
+ data[item.id] = result;
270
285
  var itemRules = {
271
- type: "array",
286
+ type: 'array',
272
287
  fields: {}
273
288
  };
274
289
  item.children.forEach(function(row, index) {
@@ -276,13 +291,18 @@ item) {
276
291
  if (itemRules.fields) {
277
292
  if (!itemRules.fields[index]) {
278
293
  itemRules.fields[index] = {
279
- type: "object",
294
+ type: 'object',
280
295
  required: true,
281
296
  fields: {}
282
297
  };
283
298
  }
299
+ // // @ts-ignore
300
+ // itemRules.fields[index].fields[formControl.id] = (
301
+ // formControl as RuntimeFormControl
302
+ // ).rules
303
+ var childResult = Runtime.staticGetRules(formControl.type, formControl.props);
284
304
  // @ts-ignore
285
- itemRules.fields[index].fields[formControl.id] = formControl.rules;
305
+ itemRules.fields[index].fields[formControl.id] = childResult;
286
306
  }
287
307
  });
288
308
  });
@@ -294,15 +314,19 @@ item) {
294
314
  if (getControlIsHide(item)) {
295
315
  return;
296
316
  }
317
+ var result = Runtime.staticGetRules(item.type, item.props);
297
318
  // if (item instanceof RuntimeFormControl) {
298
319
  if (item.controlType === CONTROL_BASE_TYPE.FORM) {
299
- antdRules[item.id] = item.rules;
320
+ // antdRules[item.id] = item.rules
321
+ antdRules[item.id] = result;
300
322
  } else if (item.type === CONTROL_TYPE.SUBTABLE && item.children.length) {
301
323
  antdRules[item.id] = [];
302
324
  item.children.forEach(function(row) {
303
325
  var rules = {};
304
326
  loopFormSchema(row.children, function(formControl) {
305
- rules[formControl.id] = formControl.rules;
327
+ // rules[formControl.id] = (formControl as RuntimeFormControl).rules
328
+ var childResult = Runtime.staticGetRules(formControl.type, formControl.props);
329
+ rules[formControl.id] = childResult;
306
330
  });
307
331
  antdRules[item.id].push(rules);
308
332
  });
@@ -45,20 +45,14 @@ function _objectSpread(target) {
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
54
  _classCallCheck(this, Store);
55
- _defineProperty(this, "emptyState", void 0);
56
- _defineProperty(this, "state", void 0);
57
- _defineProperty(this, "dataBindMapping", void 0 // 主要提供给二开使用
58
- );
59
- _defineProperty(this, "controlIdMapping", void 0);
60
- _defineProperty(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;
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;
@@ -73,7 +67,6 @@ var Store = /*#__PURE__*/ function() {
73
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() {
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() {
271
270
  return _objectSpread({
272
- uid: "new:" + buildUUID("uid")
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, _item_props_dataBind;
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 : {}, _defineProperty({}, 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
  });