@byteluck-fe/model-driven-engine 2.5.0-beta.9 → 2.5.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 +157 -40
- package/dist/esm/common/DataManager.js +129 -20
- package/dist/esm/common/Engine.js +343 -211
- package/dist/esm/common/OkWorker.js +27 -13
- package/dist/esm/common/Runtime.js +26 -11
- package/dist/esm/common/Store.js +56 -52
- package/dist/esm/common/checkerValue.js +40 -40
- package/dist/esm/common/index.js +2 -2
- package/dist/esm/common/proxyState.js +50 -48
- package/dist/esm/index.js +3 -3
- package/dist/esm/plugins/CalcPlugin.js +67 -59
- package/dist/esm/plugins/ControlsEventPlugin.js +191 -68
- package/dist/esm/plugins/ES6ModulePlugin.js +24 -8
- package/dist/esm/plugins/LifecycleEventPlugin.js +183 -64
- package/dist/esm/plugins/StylePlugin.js +22 -7
- package/dist/esm/plugins/index.js +5 -5
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/runtimeUtils.js +5 -7
- package/dist/index.umd.js +10 -10
- 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
|
@@ -17,11 +17,25 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
17
17
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
18
|
return Constructor;
|
|
19
19
|
}
|
|
20
|
-
|
|
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";
|
|
21
34
|
var OkWorker = /*#__PURE__*/ function() {
|
|
22
35
|
"use strict";
|
|
23
36
|
function OkWorker() {
|
|
24
37
|
_classCallCheck(this, OkWorker);
|
|
38
|
+
_defineProperty(this, "worker", void 0);
|
|
25
39
|
}
|
|
26
40
|
_createClass(OkWorker, [
|
|
27
41
|
{
|
|
@@ -29,7 +43,7 @@ var OkWorker = /*#__PURE__*/ function() {
|
|
|
29
43
|
value: function run(initState) {
|
|
30
44
|
this.worker = OkWorker.createWorker();
|
|
31
45
|
this.postMessage({
|
|
32
|
-
action:
|
|
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
|
|
41
|
-
(
|
|
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
|
|
48
|
-
(
|
|
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:
|
|
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(
|
|
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(
|
|
96
|
-
var
|
|
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:
|
|
121
|
+
action: "delete",
|
|
108
122
|
payload: {
|
|
109
|
-
key:
|
|
110
|
-
value:
|
|
123
|
+
key: "key3[0].key1",
|
|
124
|
+
value: "index"
|
|
111
125
|
}
|
|
112
126
|
});
|
|
113
127
|
});
|
|
@@ -23,6 +23,19 @@ 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
|
+
}
|
|
26
39
|
function _getPrototypeOf(o) {
|
|
27
40
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
28
41
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
@@ -83,19 +96,21 @@ function _createSuper(Derived) {
|
|
|
83
96
|
return _possibleConstructorReturn(this, result);
|
|
84
97
|
};
|
|
85
98
|
}
|
|
86
|
-
import { RegisterControls } from
|
|
87
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE, loopFormSchema } from
|
|
88
|
-
import { hasChildrenControl, loopDataViewControl, loopFormControl } from
|
|
89
|
-
export var Runtime = /*#__PURE__*/ function(
|
|
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) {
|
|
90
103
|
"use strict";
|
|
91
|
-
_inherits(Runtime,
|
|
104
|
+
_inherits(Runtime, RegisterControls);
|
|
92
105
|
var _super = _createSuper(Runtime);
|
|
93
106
|
function Runtime(props) {
|
|
94
107
|
_classCallCheck(this, Runtime);
|
|
95
108
|
var _this;
|
|
96
|
-
_this = _super.call(this,
|
|
97
|
-
_this
|
|
98
|
-
_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", {});
|
|
99
114
|
var schema = props.schema;
|
|
100
115
|
_this._schema = schema;
|
|
101
116
|
_this._instance = _this.createControl(schema, props.beforeCreateInstance);
|
|
@@ -110,7 +125,7 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
|
|
|
110
125
|
var instanceMap = {};
|
|
111
126
|
loop(this._instance, function(item) {
|
|
112
127
|
// 3.4.1 避免将subtable-row 放到 _flatInstances 中
|
|
113
|
-
if (item.type ===
|
|
128
|
+
if (item.type === "subtable-row" || item.type === "subtable-column") {
|
|
114
129
|
return;
|
|
115
130
|
}
|
|
116
131
|
instances.push(item);
|
|
@@ -249,7 +264,7 @@ item) {
|
|
|
249
264
|
} else if (item.type === CONTROL_TYPE.SUBTABLE) {
|
|
250
265
|
data[item.id] = item.rules;
|
|
251
266
|
var itemRules = {
|
|
252
|
-
type:
|
|
267
|
+
type: "array",
|
|
253
268
|
fields: {}
|
|
254
269
|
};
|
|
255
270
|
item.children.forEach(function(row, index) {
|
|
@@ -257,7 +272,7 @@ item) {
|
|
|
257
272
|
if (itemRules.fields) {
|
|
258
273
|
if (!itemRules.fields[index]) {
|
|
259
274
|
itemRules.fields[index] = {
|
|
260
|
-
type:
|
|
275
|
+
type: "object",
|
|
261
276
|
required: true,
|
|
262
277
|
fields: {}
|
|
263
278
|
};
|
package/dist/esm/common/Store.js
CHANGED
|
@@ -32,7 +32,7 @@ function _defineProperty(obj, key, value) {
|
|
|
32
32
|
}
|
|
33
33
|
function _instanceof(left, right) {
|
|
34
34
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
35
|
-
return right[Symbol.hasInstance](left);
|
|
35
|
+
return !!right[Symbol.hasInstance](left);
|
|
36
36
|
} else {
|
|
37
37
|
return left instanceof right;
|
|
38
38
|
}
|
|
@@ -52,14 +52,20 @@ function _objectSpread(target) {
|
|
|
52
52
|
}
|
|
53
53
|
return target;
|
|
54
54
|
}
|
|
55
|
-
import { DataBind, ObjectDataBind } from
|
|
56
|
-
import { loopFormSchema, JSONCopy, warn, CONTROL_TYPE, CONTROL_BASE_TYPE } from
|
|
57
|
-
import { loopDataViewControl, loopFormControl, buildUUID } from
|
|
55
|
+
import { DataBind, ObjectDataBind } from "@byteluck-fe/model-driven-core";
|
|
56
|
+
import { loopFormSchema, JSONCopy, warn, CONTROL_TYPE, CONTROL_BASE_TYPE } from "@byteluck-fe/model-driven-shared";
|
|
57
|
+
import { loopDataViewControl, loopFormControl, buildUUID } from "../utils/runtimeUtils";
|
|
58
58
|
var Store = /*#__PURE__*/ function() {
|
|
59
59
|
"use strict";
|
|
60
60
|
function Store(props) {
|
|
61
61
|
_classCallCheck(this, Store);
|
|
62
|
-
|
|
62
|
+
_defineProperty(this, "emptyState", void 0);
|
|
63
|
+
_defineProperty(this, "state", void 0);
|
|
64
|
+
_defineProperty(this, "dataBindMapping", void 0 // 主要提供给二开使用
|
|
65
|
+
);
|
|
66
|
+
_defineProperty(this, "controlIdMapping", void 0);
|
|
67
|
+
_defineProperty(this, "defaultState", void 0);
|
|
68
|
+
var _init = init(props.instance), state = _init.state, emptyState = _init.emptyState, databindMapping = _init.databindMapping, controlidMapping = _init.controlidMapping, defaultState = _init.defaultState;
|
|
63
69
|
this.emptyState = emptyState;
|
|
64
70
|
this.state = state;
|
|
65
71
|
this.dataBindMapping = databindMapping;
|
|
@@ -74,10 +80,12 @@ var Store = /*#__PURE__*/ function() {
|
|
|
74
80
|
* @param value
|
|
75
81
|
*/ key: "setState",
|
|
76
82
|
value: function setState(controlId, value, rowIndex) {
|
|
83
|
+
var _this = this;
|
|
77
84
|
var controlInfo = this.controlIdMapping[controlId];
|
|
85
|
+
var noProxyValue = JSONCopy(value);
|
|
78
86
|
if (controlInfo !== undefined) {
|
|
79
87
|
//qiyu 按照对象赋值,Object.assign会触发多次key的change事件
|
|
80
|
-
this.state[controlInfo.dataView][controlId] =
|
|
88
|
+
this.state[controlInfo.dataView][controlId] = noProxyValue;
|
|
81
89
|
// if (
|
|
82
90
|
// controlInfo.dataBind instanceof ObjectDataBind &&
|
|
83
91
|
// isPlainObject(value)
|
|
@@ -88,23 +96,23 @@ var Store = /*#__PURE__*/ function() {
|
|
|
88
96
|
// }
|
|
89
97
|
} else {
|
|
90
98
|
if (rowIndex !== undefined) {
|
|
91
|
-
var _this = this;
|
|
92
99
|
//TODO 目前只找了一层明细表,没有递归 如果是添加uid
|
|
93
100
|
Object.keys(this.controlIdMapping).map(function(subtableId) {
|
|
94
101
|
var dataView = _this.controlIdMapping[subtableId].dataView;
|
|
95
102
|
var children = _this.controlIdMapping[subtableId].children;
|
|
96
103
|
if (children !== undefined) {
|
|
97
|
-
var _this1 = _this;
|
|
98
104
|
Object.keys(children).map(function(childControlId) {
|
|
99
105
|
if (childControlId === controlId) {
|
|
100
|
-
|
|
106
|
+
if (_this.state[dataView][subtableId][rowIndex]) {
|
|
107
|
+
_this.state[dataView][subtableId][rowIndex][controlId] = noProxyValue;
|
|
108
|
+
}
|
|
101
109
|
}
|
|
102
110
|
});
|
|
103
111
|
}
|
|
104
112
|
});
|
|
105
113
|
} else {
|
|
106
114
|
//不存在的 controlId,直接被挂载到外部key
|
|
107
|
-
this.state[controlId] =
|
|
115
|
+
this.state[controlId] = noProxyValue;
|
|
108
116
|
}
|
|
109
117
|
}
|
|
110
118
|
}
|
|
@@ -112,6 +120,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
112
120
|
{
|
|
113
121
|
key: "getState",
|
|
114
122
|
value: function getState(controlId, rowIndex) {
|
|
123
|
+
var _this = this;
|
|
115
124
|
//qiyu 由于header的数据是后补充的,所以从state获取第一层值。
|
|
116
125
|
// const controlInfo = this.controlIdMapping[controlId]
|
|
117
126
|
var detection = this.state[controlId];
|
|
@@ -123,31 +132,27 @@ var Store = /*#__PURE__*/ function() {
|
|
|
123
132
|
return this.state[controlInfo.dataView][controlId];
|
|
124
133
|
} else {
|
|
125
134
|
if (rowIndex !== undefined) {
|
|
126
|
-
var _this = this;
|
|
127
135
|
var state;
|
|
128
136
|
//TODO 目前只找了一层明细表,没有递归
|
|
129
137
|
Object.keys(this.controlIdMapping).map(function(subtableId) {
|
|
130
138
|
var dataViewId = _this.controlIdMapping[subtableId].dataView;
|
|
131
139
|
var children = _this.controlIdMapping[subtableId].children;
|
|
132
140
|
if (children !== undefined) {
|
|
133
|
-
var _this3 = _this;
|
|
134
141
|
Object.keys(children).map(function(childControlId) {
|
|
135
142
|
if (childControlId === controlId) {
|
|
136
|
-
var
|
|
137
|
-
state = (
|
|
143
|
+
var _this_state_dataViewId_subtableId_rowIndex;
|
|
144
|
+
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];
|
|
138
145
|
}
|
|
139
146
|
});
|
|
140
147
|
}
|
|
141
148
|
});
|
|
142
149
|
return state;
|
|
143
150
|
} else {
|
|
144
|
-
var _this2 = this;
|
|
145
151
|
var states = [];
|
|
146
152
|
Object.keys(this.controlIdMapping).map(function(subtableId) {
|
|
147
|
-
var dataViewId =
|
|
148
|
-
var children =
|
|
153
|
+
var dataViewId = _this.controlIdMapping[subtableId].dataView;
|
|
154
|
+
var children = _this.controlIdMapping[subtableId].children;
|
|
149
155
|
if (children !== undefined) {
|
|
150
|
-
var _this = _this2;
|
|
151
156
|
Object.keys(children).map(function(childControlId) {
|
|
152
157
|
if (childControlId === controlId) {
|
|
153
158
|
_this.state[dataViewId][subtableId].map(function(item) {
|
|
@@ -166,6 +171,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
166
171
|
{
|
|
167
172
|
key: "getEmptyState",
|
|
168
173
|
value: function getEmptyState(controlId) {
|
|
174
|
+
var _this = this;
|
|
169
175
|
var detection = this.emptyState[controlId];
|
|
170
176
|
if (detection !== undefined) {
|
|
171
177
|
return this.emptyState[controlId];
|
|
@@ -174,24 +180,22 @@ var Store = /*#__PURE__*/ function() {
|
|
|
174
180
|
if (controlInfo !== undefined) {
|
|
175
181
|
var state = this.emptyState[controlInfo.dataView][controlId];
|
|
176
182
|
//判断找到的是否是明细表的控件
|
|
177
|
-
if (
|
|
183
|
+
if ("children" in controlInfo) {
|
|
178
184
|
Object.assign(state, {
|
|
179
|
-
uid:
|
|
185
|
+
uid: "new:" + buildUUID("uid")
|
|
180
186
|
});
|
|
181
187
|
}
|
|
182
188
|
return state;
|
|
183
189
|
} else {
|
|
184
|
-
var _this = this;
|
|
185
190
|
var state1;
|
|
186
191
|
//TODO 目前只找了一层明细表,没有递归
|
|
187
192
|
Object.keys(this.controlIdMapping).map(function(subtableId) {
|
|
188
193
|
var dataViewId = _this.controlIdMapping[subtableId].dataView;
|
|
189
194
|
var children = _this.controlIdMapping[subtableId].children;
|
|
190
195
|
if (children !== undefined) {
|
|
191
|
-
var _this4 = _this;
|
|
192
196
|
Object.keys(children).map(function(childControlId) {
|
|
193
197
|
if (childControlId === controlId) {
|
|
194
|
-
state1 =
|
|
198
|
+
state1 = _this.emptyState[dataViewId][subtableId][controlId];
|
|
195
199
|
}
|
|
196
200
|
});
|
|
197
201
|
}
|
|
@@ -270,36 +274,36 @@ item) {
|
|
|
270
274
|
loopFormSchema(item.props.headers, function(headerItem) {
|
|
271
275
|
emptyTemplate[headerItem.id] = JSONCopy(headerItem.props.defaultValue);
|
|
272
276
|
});
|
|
273
|
-
var
|
|
274
|
-
dataViewState[item.id] = new Array((
|
|
277
|
+
var _item_props_defaultRows, _fill_map;
|
|
278
|
+
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() {
|
|
275
279
|
return _objectSpread({
|
|
276
|
-
uid:
|
|
280
|
+
uid: "new:" + buildUUID("uid")
|
|
277
281
|
}, JSONCopy(emptyTemplate));
|
|
278
|
-
});
|
|
282
|
+
})) !== null && _fill_map !== void 0 ? _fill_map : [];
|
|
279
283
|
emptyDataViewState[item.id] = emptyTemplate;
|
|
280
284
|
}
|
|
281
285
|
}
|
|
282
286
|
function buildDataBindMapping(data, dataViewId, // @ts-ignore
|
|
283
|
-
|
|
287
|
+
item) {
|
|
284
288
|
// if (item instanceof RuntimeFormControl) {
|
|
285
|
-
if (
|
|
286
|
-
var
|
|
287
|
-
if (_instanceof(
|
|
289
|
+
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
290
|
+
var _item_props, _item_props_dataBind;
|
|
291
|
+
if (_instanceof(item.props.dataBind, ObjectDataBind)) {
|
|
288
292
|
// 特殊的dataBind,比如:金额是currency+amount两个key组成的,日期区间,继承自ObjectDataBind的需要通过Object.keys拿到多个databind
|
|
289
|
-
Object.keys(
|
|
290
|
-
var dataBind =
|
|
293
|
+
Object.keys(item.props.dataBind).map(function(key) {
|
|
294
|
+
var dataBind = item.props.dataBind;
|
|
291
295
|
var dataCode = dataBind[key].dataCode;
|
|
292
296
|
if (dataCode !== undefined) {
|
|
293
297
|
if (data[dataCode] === undefined) {
|
|
294
298
|
data[dataCode] = {
|
|
295
|
-
controlId:
|
|
299
|
+
controlId: item.id,
|
|
296
300
|
fields: [],
|
|
297
301
|
dataViewId: dataViewId
|
|
298
302
|
};
|
|
299
303
|
}
|
|
300
304
|
data[dataCode].fields.push({
|
|
301
305
|
fieldCode: dataBind[key].fieldCode,
|
|
302
|
-
controlId:
|
|
306
|
+
controlId: item.id,
|
|
303
307
|
dataBind: dataBind,
|
|
304
308
|
dataViewId: [
|
|
305
309
|
dataViewId
|
|
@@ -307,38 +311,38 @@ item1) {
|
|
|
307
311
|
});
|
|
308
312
|
}
|
|
309
313
|
});
|
|
310
|
-
} else if (((
|
|
314
|
+
} 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) {
|
|
311
315
|
//qiyu 2023-2-27 为空跳过。form自定义组件加载失败时,hack的组件props为空。
|
|
312
316
|
} else {
|
|
313
|
-
if (data[
|
|
314
|
-
data[
|
|
317
|
+
if (data[item.props.dataBind.dataCode] === undefined) {
|
|
318
|
+
data[item.props.dataBind.dataCode] = {
|
|
315
319
|
controlId: dataViewId,
|
|
316
320
|
fields: [],
|
|
317
321
|
dataViewId: dataViewId
|
|
318
322
|
};
|
|
319
323
|
}
|
|
320
|
-
data[
|
|
321
|
-
fieldCode:
|
|
322
|
-
controlId:
|
|
323
|
-
dataBind:
|
|
324
|
+
data[item.props.dataBind.dataCode].fields.push({
|
|
325
|
+
fieldCode: item.props.dataBind.fieldCode,
|
|
326
|
+
controlId: item.id,
|
|
327
|
+
dataBind: item.props.dataBind,
|
|
324
328
|
dataViewId: [
|
|
325
329
|
dataViewId
|
|
326
330
|
]
|
|
327
331
|
});
|
|
328
332
|
}
|
|
329
333
|
} else {
|
|
330
|
-
if (
|
|
334
|
+
if (item.props.datasourceBind.dataCode === "") {
|
|
331
335
|
//敏捷依赖后端生成dataCode,预览的时候没有
|
|
332
|
-
warn("datasourceBind.dataCode is empty! maybe in preview mode, control:".concat(
|
|
336
|
+
warn("datasourceBind.dataCode is empty! maybe in preview mode, control:".concat(item.id, " type:").concat(item.type));
|
|
333
337
|
return;
|
|
334
338
|
}
|
|
335
|
-
data[
|
|
336
|
-
controlId:
|
|
339
|
+
data[item.props.datasourceBind.dataCode] = {
|
|
340
|
+
controlId: item.id,
|
|
337
341
|
fields: [],
|
|
338
342
|
dataViewId: dataViewId
|
|
339
343
|
};
|
|
340
|
-
var subtableId =
|
|
341
|
-
loopFormSchema(
|
|
344
|
+
var subtableId = item.id;
|
|
345
|
+
loopFormSchema(item.props.headers, function(item) {
|
|
342
346
|
if (_instanceof(item.props.dataBind, ObjectDataBind)) {
|
|
343
347
|
Object.keys(item.props.dataBind).map(function(key) {
|
|
344
348
|
var dataBind = item.props.dataBind;
|
|
@@ -380,16 +384,16 @@ item) {
|
|
|
380
384
|
data[item.id] = {
|
|
381
385
|
dataBind: new DataBind({
|
|
382
386
|
dataCode: item.props.datasourceBind.dataCode,
|
|
383
|
-
fieldCode:
|
|
387
|
+
fieldCode: ""
|
|
384
388
|
}),
|
|
385
389
|
dataView: dataViewId,
|
|
386
390
|
children: {},
|
|
387
391
|
options: []
|
|
388
392
|
};
|
|
389
393
|
loopFormSchema(item.props.headers, function(formControl) {
|
|
390
|
-
var
|
|
391
|
-
var
|
|
392
|
-
Object.assign((
|
|
394
|
+
var _data_item_id;
|
|
395
|
+
var _data_item_id_children;
|
|
396
|
+
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, {
|
|
393
397
|
dataBind: formControl.props.dataBind
|
|
394
398
|
}));
|
|
395
399
|
});
|