@byteluck-fe/model-driven-engine 2.2.1-test.1 → 2.2.1-test.2
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.
|
@@ -333,8 +333,8 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
333
333
|
};
|
|
334
334
|
}
|
|
335
335
|
};
|
|
336
|
-
import { DataBind, ObjectDataBind,
|
|
337
|
-
import { CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
|
|
336
|
+
import { DataBind, ObjectDataBind, RuntimeListControl } from "@byteluck-fe/model-driven-core";
|
|
337
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
|
|
338
338
|
import { Runtime } from "./Runtime";
|
|
339
339
|
import { Store } from "./Store";
|
|
340
340
|
import { findItem, proxyState } from "./proxyState";
|
|
@@ -444,7 +444,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
444
444
|
// @ts-ignore
|
|
445
445
|
var fieldTypeMap = instance.props.headers.reduce(function(result, column) {
|
|
446
446
|
var formInstance = column.children[0];
|
|
447
|
-
if (formInstance &&
|
|
447
|
+
// if (formInstance && formInstance instanceof RuntimeFormControl) {
|
|
448
|
+
if (formInstance && formInstance.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
448
449
|
result[formInstance.id] = formInstance.fieldType;
|
|
449
450
|
}
|
|
450
451
|
return result;
|
|
@@ -556,7 +557,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
556
557
|
options: Object.assign({}, options, {
|
|
557
558
|
changed: createdNewRows,
|
|
558
559
|
data: createdNewRowsData,
|
|
559
|
-
deleted: deleted !== null && deleted !== void 0 ? deleted : []
|
|
560
|
+
deleted: deleted !== null && deleted !== void 0 ? deleted : [],
|
|
561
|
+
jsonValue: JSON.stringify(this.getState(subtable.id))
|
|
560
562
|
})
|
|
561
563
|
});
|
|
562
564
|
// 主动清空本次任务中的options
|
|
@@ -570,7 +572,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
570
572
|
}
|
|
571
573
|
var index = this.getInstanceRowIndex(instance);
|
|
572
574
|
var options = eventOptionsTemp || {};
|
|
573
|
-
if (
|
|
575
|
+
// if (instance instanceof RuntimeListControl) {
|
|
576
|
+
if (instance.controlType === CONTROL_BASE_TYPE.LIST) {
|
|
574
577
|
var // @ts-ignore
|
|
575
578
|
_instance_children;
|
|
576
579
|
instance.children.length = 0;
|
|
@@ -628,12 +631,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
628
631
|
_proto.listControlCreateRow = function listControlCreateRow(instance, rowType) {
|
|
629
632
|
var row = this.runtime.createControlInstance(rowType);
|
|
630
633
|
if (!row) return;
|
|
631
|
-
if (
|
|
632
|
-
|
|
634
|
+
// if (row instanceof RuntimeLayoutControl) {
|
|
635
|
+
// @ts-ignore
|
|
636
|
+
if (row.controlType === CONTROL_BASE_TYPE.LAYOUT) {
|
|
637
|
+
var _inst_children;
|
|
638
|
+
var inst = row;
|
|
633
639
|
var template = JSONCopy(instance.props.headers);
|
|
634
640
|
// @ts-ignore
|
|
635
641
|
var columns = this.createControl(template);
|
|
636
|
-
(
|
|
642
|
+
(_inst_children = inst.children).push.apply(_inst_children, _toConsumableArray(columns));
|
|
637
643
|
}
|
|
638
644
|
return row;
|
|
639
645
|
};
|
|
@@ -42,13 +42,6 @@ function _inherits(subClass, superClass) {
|
|
|
42
42
|
});
|
|
43
43
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
44
44
|
}
|
|
45
|
-
function _instanceof(left, right) {
|
|
46
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
47
|
-
return !!right[Symbol.hasInstance](left);
|
|
48
|
-
} else {
|
|
49
|
-
return left instanceof right;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
45
|
function _possibleConstructorReturn(self, call) {
|
|
53
46
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
54
47
|
return call;
|
|
@@ -90,8 +83,8 @@ function _createSuper(Derived) {
|
|
|
90
83
|
return _possibleConstructorReturn(this, result);
|
|
91
84
|
};
|
|
92
85
|
}
|
|
93
|
-
import {
|
|
94
|
-
import { CONTROL_TYPE, loopFormSchema } from "@byteluck-fe/model-driven-shared";
|
|
86
|
+
import { RegisterControls } from "@byteluck-fe/model-driven-core";
|
|
87
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE, loopFormSchema } from "@byteluck-fe/model-driven-shared";
|
|
95
88
|
import { hasChildrenControl, loopDataViewControl, loopFormControl } from "../utils/runtimeUtils";
|
|
96
89
|
export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
97
90
|
"use strict";
|
|
@@ -115,7 +108,7 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
|
115
108
|
var instanceMap = {};
|
|
116
109
|
loop(this._instance, function(item) {
|
|
117
110
|
// 3.4.1 避免将subtable-row 放到 _flatInstances 中
|
|
118
|
-
if (item.type === "subtable-row") {
|
|
111
|
+
if (item.type === "subtable-row" || item.type === "subtable-column") {
|
|
119
112
|
return;
|
|
120
113
|
}
|
|
121
114
|
instances.push(item);
|
|
@@ -160,7 +153,11 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
|
160
153
|
loopDataViewControl(this._instance, function(dataView) {
|
|
161
154
|
ruleItems[dataView.id] = dataView.rules[0];
|
|
162
155
|
loopFormControl(dataView.children, function(item) {
|
|
163
|
-
if (
|
|
156
|
+
// if (
|
|
157
|
+
// item instanceof RuntimeFormControl ||
|
|
158
|
+
// item instanceof RuntimeListControl
|
|
159
|
+
// ) {
|
|
160
|
+
if (item.controlType === CONTROL_BASE_TYPE.FORM || item.controlType === CONTROL_BASE_TYPE.LIST) {
|
|
164
161
|
buildControlRules(ruleItems[dataView.id].fields, item);
|
|
165
162
|
}
|
|
166
163
|
});
|
|
@@ -175,7 +172,11 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
|
175
172
|
loopDataViewControl(this._instance, function(dataView) {
|
|
176
173
|
antdRules[dataView.id] = dataView.rules[0];
|
|
177
174
|
loopFormControl(dataView.children, function(item) {
|
|
178
|
-
if (
|
|
175
|
+
// if (
|
|
176
|
+
// item instanceof RuntimeFormControl ||
|
|
177
|
+
// item instanceof RuntimeListControl
|
|
178
|
+
// ) {
|
|
179
|
+
if (item.controlType === CONTROL_BASE_TYPE.FORM || item.controlType === CONTROL_BASE_TYPE.LIST) {
|
|
179
180
|
buildControlAntdRules(antdRules[dataView.id].fields, item);
|
|
180
181
|
}
|
|
181
182
|
});
|
|
@@ -215,7 +216,8 @@ item) {
|
|
|
215
216
|
if (getControlIsHide(item)) {
|
|
216
217
|
return;
|
|
217
218
|
}
|
|
218
|
-
if (
|
|
219
|
+
// if (item instanceof RuntimeFormControl) {
|
|
220
|
+
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
219
221
|
data[item.id] = item.rules;
|
|
220
222
|
} else if (item.type === CONTROL_TYPE.SUBTABLE) {
|
|
221
223
|
data[item.id] = item.rules;
|
|
@@ -246,7 +248,8 @@ item) {
|
|
|
246
248
|
if (getControlIsHide(item)) {
|
|
247
249
|
return;
|
|
248
250
|
}
|
|
249
|
-
if (
|
|
251
|
+
// if (item instanceof RuntimeFormControl) {
|
|
252
|
+
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
250
253
|
antdRules[item.id] = item.rules;
|
|
251
254
|
} else if (item.type === CONTROL_TYPE.SUBTABLE && item.children.length) {
|
|
252
255
|
antdRules[item.id] = [];
|
package/dist/esm/common/Store.js
CHANGED
|
@@ -23,8 +23,8 @@ function _instanceof(left, right) {
|
|
|
23
23
|
return left instanceof right;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
import {
|
|
27
|
-
import { loopFormSchema, JSONCopy, warn, CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
|
|
26
|
+
import { DataBind, ObjectDataBind } from "@byteluck-fe/model-driven-core";
|
|
27
|
+
import { loopFormSchema, JSONCopy, warn, CONTROL_TYPE, CONTROL_BASE_TYPE } from "@byteluck-fe/model-driven-shared";
|
|
28
28
|
import { loopDataViewControl, loopFormControl } from "../utils/runtimeUtils";
|
|
29
29
|
var Store = /*#__PURE__*/ function() {
|
|
30
30
|
"use strict";
|
|
@@ -202,7 +202,8 @@ function init(instance) {
|
|
|
202
202
|
}
|
|
203
203
|
function buildState(dataViewState, emptyDataViewState, // @ts-ignore
|
|
204
204
|
item) {
|
|
205
|
-
if (
|
|
205
|
+
//if (item instanceof RuntimeFormControl) {
|
|
206
|
+
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
206
207
|
dataViewState[item.id] = JSONCopy(item.props.defaultValue);
|
|
207
208
|
emptyDataViewState[item.id] = JSONCopy(item.props.defaultValue);
|
|
208
209
|
} else {
|
|
@@ -219,7 +220,8 @@ item) {
|
|
|
219
220
|
}
|
|
220
221
|
function buildDataBindMapping(data, dataViewId, // @ts-ignore
|
|
221
222
|
item) {
|
|
222
|
-
if (
|
|
223
|
+
// if (item instanceof RuntimeFormControl) {
|
|
224
|
+
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
223
225
|
if (_instanceof(item.props.dataBind, ObjectDataBind)) {
|
|
224
226
|
// 特殊的dataBind,比如:金额是currency+amount两个key组成的,日期区间,继承自ObjectDataBind的需要通过Object.keys拿到多个databind
|
|
225
227
|
Object.keys(item.props.dataBind).map(function(key) {
|
|
@@ -303,7 +305,8 @@ item) {
|
|
|
303
305
|
}
|
|
304
306
|
function buildControlIdMapping(data, dataViewId, // @ts-ignore
|
|
305
307
|
item) {
|
|
306
|
-
if (
|
|
308
|
+
// if (item instanceof RuntimeFormControl) {
|
|
309
|
+
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
307
310
|
data[item.id] = {
|
|
308
311
|
dataBind: item.props.dataBind,
|
|
309
312
|
options: [],
|
|
@@ -6,13 +6,6 @@ function _arrayLikeToArray(arr, len) {
|
|
|
6
6
|
function _arrayWithoutHoles(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
8
8
|
}
|
|
9
|
-
function _instanceof(left, right) {
|
|
10
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
11
|
-
return !!right[Symbol.hasInstance](left);
|
|
12
|
-
} else {
|
|
13
|
-
return left instanceof right;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
9
|
function _iterableToArray(iter) {
|
|
17
10
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
18
11
|
}
|
|
@@ -30,9 +23,8 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
30
23
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
31
24
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
32
25
|
}
|
|
33
|
-
import { RuntimeFormControl } from "@byteluck-fe/model-driven-core";
|
|
34
|
-
import { error, logerror } from "@byteluck-fe/model-driven-shared";
|
|
35
26
|
var cc = console;
|
|
27
|
+
import { CONTROL_BASE_TYPE, error, logerror } from "@byteluck-fe/model-driven-shared";
|
|
36
28
|
var proxyArrayApi = [
|
|
37
29
|
"splice",
|
|
38
30
|
"push",
|
|
@@ -248,7 +240,7 @@ function flatInstanceForChildren(controls) {
|
|
|
248
240
|
return item.id === key;
|
|
249
241
|
});
|
|
250
242
|
// 最后一个key可能是值对象上边的key,比如金额的amount和currency,计算公式的result和unit,所以需要判断前一个控件是不是一个表单控件,是的话就返回最后一个表单控件
|
|
251
|
-
return findEndItem ? findEndItem :
|
|
243
|
+
return findEndItem ? findEndItem : prevItem.controlType === CONTROL_BASE_TYPE.FORM ? prevItem : undefined;
|
|
252
244
|
} else {
|
|
253
245
|
var _prevItem_children;
|
|
254
246
|
var _prevItem_children_index;
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
function _instanceof(left, right) {
|
|
2
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
3
|
-
return !!right[Symbol.hasInstance](left);
|
|
4
|
-
} else {
|
|
5
|
-
return left instanceof right;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
import { RuntimeFormControl } from "@byteluck-fe/model-driven-core";
|
|
9
1
|
import { CONTROL_BASE_TYPE, CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
|
|
10
2
|
export function hasChildrenControl(instance) {
|
|
11
3
|
return instance.controlType === CONTROL_BASE_TYPE.LAYOUT || instance.controlType === CONTROL_BASE_TYPE.WRAP || instance.controlType === CONTROL_BASE_TYPE.LIST || instance.controlType === CONTROL_BASE_TYPE.SEARCH;
|
|
@@ -20,7 +12,7 @@ export function loopFormControl(control, callback) {
|
|
|
20
12
|
callback(item, children);
|
|
21
13
|
} else if (hasChildrenControl(item)) {
|
|
22
14
|
loopFormControl(item === null || item === void 0 ? void 0 : item.children, callback);
|
|
23
|
-
} else if (
|
|
15
|
+
} else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
24
16
|
callback(item);
|
|
25
17
|
}
|
|
26
18
|
});
|