@byteluck-fe/model-driven-engine 2.4.1-beta.4 → 2.4.1-beta.6
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 +340 -225
- package/dist/esm/common/OkWorker.js +27 -13
- package/dist/esm/common/Runtime.js +26 -11
- package/dist/esm/common/Store.js +55 -50
- package/dist/esm/common/checkerValue.js +40 -40
- package/dist/esm/common/index.js +2 -2
- package/dist/esm/common/proxyState.js +47 -47
- package/dist/esm/index.js +3 -3
- package/dist/esm/plugins/CalcPlugin.js +72 -64
- 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 +8 -8
- 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 +6 -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,23 +32,30 @@ 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
|
}
|
|
39
39
|
}
|
|
40
|
-
import { DataBind, ObjectDataBind } from
|
|
41
|
-
import { loopFormSchema, JSONCopy, warn, CONTROL_TYPE, CONTROL_BASE_TYPE } from
|
|
42
|
-
import { loopDataViewControl, loopFormControl, buildUUID } from
|
|
40
|
+
import { DataBind, ObjectDataBind } from "@byteluck-fe/model-driven-core";
|
|
41
|
+
import { loopFormSchema, JSONCopy, warn, CONTROL_TYPE, CONTROL_BASE_TYPE } from "@byteluck-fe/model-driven-shared";
|
|
42
|
+
import { loopDataViewControl, loopFormControl, buildUUID } from "../utils/runtimeUtils";
|
|
43
43
|
var Store = /*#__PURE__*/ function() {
|
|
44
44
|
"use strict";
|
|
45
45
|
function Store(props) {
|
|
46
46
|
_classCallCheck(this, Store);
|
|
47
|
-
|
|
47
|
+
_defineProperty(this, "emptyState", void 0);
|
|
48
|
+
_defineProperty(this, "state", void 0);
|
|
49
|
+
_defineProperty(this, "dataBindMapping", void 0 // 主要提供给二开使用
|
|
50
|
+
);
|
|
51
|
+
_defineProperty(this, "controlIdMapping", void 0);
|
|
52
|
+
_defineProperty(this, "defaultState", void 0);
|
|
53
|
+
var _init = init(props.instance), state = _init.state, emptyState = _init.emptyState, databindMapping = _init.databindMapping, controlidMapping = _init.controlidMapping, defaultState = _init.defaultState;
|
|
48
54
|
this.emptyState = emptyState;
|
|
49
55
|
this.state = state;
|
|
50
56
|
this.dataBindMapping = databindMapping;
|
|
51
57
|
this.controlIdMapping = controlidMapping;
|
|
58
|
+
this.defaultState = defaultState;
|
|
52
59
|
}
|
|
53
60
|
_createClass(Store, [
|
|
54
61
|
{
|
|
@@ -58,6 +65,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
58
65
|
* @param value
|
|
59
66
|
*/ key: "setState",
|
|
60
67
|
value: function setState(controlId, value, rowIndex) {
|
|
68
|
+
var _this = this;
|
|
61
69
|
var controlInfo = this.controlIdMapping[controlId];
|
|
62
70
|
if (controlInfo !== undefined) {
|
|
63
71
|
//qiyu 按照对象赋值,Object.assign会触发多次key的change事件
|
|
@@ -72,16 +80,14 @@ var Store = /*#__PURE__*/ function() {
|
|
|
72
80
|
// }
|
|
73
81
|
} else {
|
|
74
82
|
if (rowIndex !== undefined) {
|
|
75
|
-
var _this = this;
|
|
76
83
|
//TODO 目前只找了一层明细表,没有递归 如果是添加uid
|
|
77
84
|
Object.keys(this.controlIdMapping).map(function(subtableId) {
|
|
78
85
|
var dataView = _this.controlIdMapping[subtableId].dataView;
|
|
79
86
|
var children = _this.controlIdMapping[subtableId].children;
|
|
80
87
|
if (children !== undefined) {
|
|
81
|
-
var _this1 = _this;
|
|
82
88
|
Object.keys(children).map(function(childControlId) {
|
|
83
89
|
if (childControlId === controlId) {
|
|
84
|
-
|
|
90
|
+
_this.state[dataView][subtableId][rowIndex][controlId] = value;
|
|
85
91
|
}
|
|
86
92
|
});
|
|
87
93
|
}
|
|
@@ -96,6 +102,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
96
102
|
{
|
|
97
103
|
key: "getState",
|
|
98
104
|
value: function getState(controlId, rowIndex) {
|
|
105
|
+
var _this = this;
|
|
99
106
|
//qiyu 由于header的数据是后补充的,所以从state获取第一层值。
|
|
100
107
|
// const controlInfo = this.controlIdMapping[controlId]
|
|
101
108
|
var detection = this.state[controlId];
|
|
@@ -107,31 +114,27 @@ var Store = /*#__PURE__*/ function() {
|
|
|
107
114
|
return this.state[controlInfo.dataView][controlId];
|
|
108
115
|
} else {
|
|
109
116
|
if (rowIndex !== undefined) {
|
|
110
|
-
var _this = this;
|
|
111
117
|
var state;
|
|
112
118
|
//TODO 目前只找了一层明细表,没有递归
|
|
113
119
|
Object.keys(this.controlIdMapping).map(function(subtableId) {
|
|
114
120
|
var dataViewId = _this.controlIdMapping[subtableId].dataView;
|
|
115
121
|
var children = _this.controlIdMapping[subtableId].children;
|
|
116
122
|
if (children !== undefined) {
|
|
117
|
-
var _this3 = _this;
|
|
118
123
|
Object.keys(children).map(function(childControlId) {
|
|
119
124
|
if (childControlId === controlId) {
|
|
120
|
-
var
|
|
121
|
-
state = (
|
|
125
|
+
var _this_state_dataViewId_subtableId_rowIndex;
|
|
126
|
+
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];
|
|
122
127
|
}
|
|
123
128
|
});
|
|
124
129
|
}
|
|
125
130
|
});
|
|
126
131
|
return state;
|
|
127
132
|
} else {
|
|
128
|
-
var _this2 = this;
|
|
129
133
|
var states = [];
|
|
130
134
|
Object.keys(this.controlIdMapping).map(function(subtableId) {
|
|
131
|
-
var dataViewId =
|
|
132
|
-
var children =
|
|
135
|
+
var dataViewId = _this.controlIdMapping[subtableId].dataView;
|
|
136
|
+
var children = _this.controlIdMapping[subtableId].children;
|
|
133
137
|
if (children !== undefined) {
|
|
134
|
-
var _this = _this2;
|
|
135
138
|
Object.keys(children).map(function(childControlId) {
|
|
136
139
|
if (childControlId === controlId) {
|
|
137
140
|
_this.state[dataViewId][subtableId].map(function(item) {
|
|
@@ -150,6 +153,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
150
153
|
{
|
|
151
154
|
key: "getEmptyState",
|
|
152
155
|
value: function getEmptyState(controlId) {
|
|
156
|
+
var _this = this;
|
|
153
157
|
var detection = this.emptyState[controlId];
|
|
154
158
|
if (detection !== undefined) {
|
|
155
159
|
return this.emptyState[controlId];
|
|
@@ -158,24 +162,22 @@ var Store = /*#__PURE__*/ function() {
|
|
|
158
162
|
if (controlInfo !== undefined) {
|
|
159
163
|
var state = this.emptyState[controlInfo.dataView][controlId];
|
|
160
164
|
//判断找到的是否是明细表的控件
|
|
161
|
-
if (
|
|
165
|
+
if ("children" in controlInfo) {
|
|
162
166
|
Object.assign(state, {
|
|
163
|
-
uid:
|
|
167
|
+
uid: "new:" + buildUUID("uid")
|
|
164
168
|
});
|
|
165
169
|
}
|
|
166
170
|
return state;
|
|
167
171
|
} else {
|
|
168
|
-
var _this = this;
|
|
169
172
|
var state1;
|
|
170
173
|
//TODO 目前只找了一层明细表,没有递归
|
|
171
174
|
Object.keys(this.controlIdMapping).map(function(subtableId) {
|
|
172
175
|
var dataViewId = _this.controlIdMapping[subtableId].dataView;
|
|
173
176
|
var children = _this.controlIdMapping[subtableId].children;
|
|
174
177
|
if (children !== undefined) {
|
|
175
|
-
var _this4 = _this;
|
|
176
178
|
Object.keys(children).map(function(childControlId) {
|
|
177
179
|
if (childControlId === controlId) {
|
|
178
|
-
state1 =
|
|
180
|
+
state1 = _this.emptyState[dataViewId][subtableId][controlId];
|
|
179
181
|
}
|
|
180
182
|
});
|
|
181
183
|
}
|
|
@@ -214,6 +216,7 @@ function init(instance) {
|
|
|
214
216
|
var emptyState = {};
|
|
215
217
|
var databindMapping = {};
|
|
216
218
|
var controlidMapping = {};
|
|
219
|
+
var defaultState = {};
|
|
217
220
|
// loopFormControl(instance, (item, children) => {
|
|
218
221
|
// })
|
|
219
222
|
// @ts-ignore
|
|
@@ -229,11 +232,13 @@ function init(instance) {
|
|
|
229
232
|
buildDataBindMapping(databindMapping, dvId, item);
|
|
230
233
|
buildControlIdMapping(controlidMapping, dvId, item);
|
|
231
234
|
});
|
|
232
|
-
state[dvId] =
|
|
235
|
+
state[dvId] = {};
|
|
236
|
+
defaultState[dvId] = dataViewState;
|
|
233
237
|
emptyState[dvId] = emptyDataViewState;
|
|
234
238
|
});
|
|
235
239
|
return {
|
|
236
240
|
state: state,
|
|
241
|
+
defaultState: defaultState,
|
|
237
242
|
emptyState: emptyState,
|
|
238
243
|
databindMapping: databindMapping,
|
|
239
244
|
controlidMapping: controlidMapping
|
|
@@ -244,41 +249,41 @@ item) {
|
|
|
244
249
|
//if (item instanceof RuntimeFormControl) {
|
|
245
250
|
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
246
251
|
// 2023-4-2 jiaqi 首次进入页面去除填充默认值
|
|
247
|
-
|
|
252
|
+
dataViewState[item.id] = JSONCopy(item.props.defaultValue);
|
|
248
253
|
emptyDataViewState[item.id] = JSONCopy(item.props.defaultValue);
|
|
249
254
|
} else {
|
|
250
255
|
var emptyTemplate = {};
|
|
251
256
|
loopFormSchema(item.props.headers, function(headerItem) {
|
|
252
257
|
emptyTemplate[headerItem.id] = JSONCopy(headerItem.props.defaultValue);
|
|
253
258
|
});
|
|
254
|
-
var
|
|
255
|
-
dataViewState[item.id] = new Array((
|
|
259
|
+
var _item_props_defaultRows;
|
|
260
|
+
dataViewState[item.id] = new Array((_item_props_defaultRows = item.props.defaultRows) !== null && _item_props_defaultRows !== void 0 ? _item_props_defaultRows : 1).fill(0).map(function() {
|
|
256
261
|
return JSONCopy(emptyTemplate);
|
|
257
262
|
});
|
|
258
263
|
emptyDataViewState[item.id] = emptyTemplate;
|
|
259
264
|
}
|
|
260
265
|
}
|
|
261
266
|
function buildDataBindMapping(data, dataViewId, // @ts-ignore
|
|
262
|
-
|
|
267
|
+
item) {
|
|
263
268
|
// if (item instanceof RuntimeFormControl) {
|
|
264
|
-
if (
|
|
265
|
-
var
|
|
266
|
-
if (_instanceof(
|
|
269
|
+
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
270
|
+
var _item_props, _item_props_dataBind;
|
|
271
|
+
if (_instanceof(item.props.dataBind, ObjectDataBind)) {
|
|
267
272
|
// 特殊的dataBind,比如:金额是currency+amount两个key组成的,日期区间,继承自ObjectDataBind的需要通过Object.keys拿到多个databind
|
|
268
|
-
Object.keys(
|
|
269
|
-
var dataBind =
|
|
273
|
+
Object.keys(item.props.dataBind).map(function(key) {
|
|
274
|
+
var dataBind = item.props.dataBind;
|
|
270
275
|
var dataCode = dataBind[key].dataCode;
|
|
271
276
|
if (dataCode !== undefined) {
|
|
272
277
|
if (data[dataCode] === undefined) {
|
|
273
278
|
data[dataCode] = {
|
|
274
|
-
controlId:
|
|
279
|
+
controlId: item.id,
|
|
275
280
|
fields: [],
|
|
276
281
|
dataViewId: dataViewId
|
|
277
282
|
};
|
|
278
283
|
}
|
|
279
284
|
data[dataCode].fields.push({
|
|
280
285
|
fieldCode: dataBind[key].fieldCode,
|
|
281
|
-
controlId:
|
|
286
|
+
controlId: item.id,
|
|
282
287
|
dataBind: dataBind,
|
|
283
288
|
dataViewId: [
|
|
284
289
|
dataViewId
|
|
@@ -286,38 +291,38 @@ item1) {
|
|
|
286
291
|
});
|
|
287
292
|
}
|
|
288
293
|
});
|
|
289
|
-
} else if (((
|
|
294
|
+
} 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) {
|
|
290
295
|
//qiyu 2023-2-27 为空跳过。form自定义组件加载失败时,hack的组件props为空。
|
|
291
296
|
} else {
|
|
292
|
-
if (data[
|
|
293
|
-
data[
|
|
297
|
+
if (data[item.props.dataBind.dataCode] === undefined) {
|
|
298
|
+
data[item.props.dataBind.dataCode] = {
|
|
294
299
|
controlId: dataViewId,
|
|
295
300
|
fields: [],
|
|
296
301
|
dataViewId: dataViewId
|
|
297
302
|
};
|
|
298
303
|
}
|
|
299
|
-
data[
|
|
300
|
-
fieldCode:
|
|
301
|
-
controlId:
|
|
302
|
-
dataBind:
|
|
304
|
+
data[item.props.dataBind.dataCode].fields.push({
|
|
305
|
+
fieldCode: item.props.dataBind.fieldCode,
|
|
306
|
+
controlId: item.id,
|
|
307
|
+
dataBind: item.props.dataBind,
|
|
303
308
|
dataViewId: [
|
|
304
309
|
dataViewId
|
|
305
310
|
]
|
|
306
311
|
});
|
|
307
312
|
}
|
|
308
313
|
} else {
|
|
309
|
-
if (
|
|
314
|
+
if (item.props.datasourceBind.dataCode === "") {
|
|
310
315
|
//敏捷依赖后端生成dataCode,预览的时候没有
|
|
311
|
-
warn("datasourceBind.dataCode is empty! maybe in preview mode, control:".concat(
|
|
316
|
+
warn("datasourceBind.dataCode is empty! maybe in preview mode, control:".concat(item.id, " type:").concat(item.type));
|
|
312
317
|
return;
|
|
313
318
|
}
|
|
314
|
-
data[
|
|
315
|
-
controlId:
|
|
319
|
+
data[item.props.datasourceBind.dataCode] = {
|
|
320
|
+
controlId: item.id,
|
|
316
321
|
fields: [],
|
|
317
322
|
dataViewId: dataViewId
|
|
318
323
|
};
|
|
319
|
-
var subtableId =
|
|
320
|
-
loopFormSchema(
|
|
324
|
+
var subtableId = item.id;
|
|
325
|
+
loopFormSchema(item.props.headers, function(item) {
|
|
321
326
|
if (_instanceof(item.props.dataBind, ObjectDataBind)) {
|
|
322
327
|
Object.keys(item.props.dataBind).map(function(key) {
|
|
323
328
|
var dataBind = item.props.dataBind;
|
|
@@ -359,16 +364,16 @@ item) {
|
|
|
359
364
|
data[item.id] = {
|
|
360
365
|
dataBind: new DataBind({
|
|
361
366
|
dataCode: item.props.datasourceBind.dataCode,
|
|
362
|
-
fieldCode:
|
|
367
|
+
fieldCode: ""
|
|
363
368
|
}),
|
|
364
369
|
dataView: dataViewId,
|
|
365
370
|
children: {},
|
|
366
371
|
options: []
|
|
367
372
|
};
|
|
368
373
|
loopFormSchema(item.props.headers, function(formControl) {
|
|
369
|
-
var
|
|
370
|
-
var
|
|
371
|
-
Object.assign((
|
|
374
|
+
var _data_item_id;
|
|
375
|
+
var _data_item_id_children;
|
|
376
|
+
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, {
|
|
372
377
|
dataBind: formControl.props.dataBind
|
|
373
378
|
}));
|
|
374
379
|
});
|