@byteluck-fe/model-driven-engine 2.21.0-beta.0 → 2.21.0-beta.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.
package/dist/esm/common/Store.js
CHANGED
|
@@ -77,6 +77,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
77
77
|
value: function setState(controlId, value, rowIndex) {
|
|
78
78
|
var _this = this;
|
|
79
79
|
var controlInfo = this.controlIdMapping[controlId];
|
|
80
|
+
var noProxyValue = JSONCopy(value);
|
|
80
81
|
if (controlInfo !== undefined) {
|
|
81
82
|
//明细表
|
|
82
83
|
if (controlInfo.children) {
|
|
@@ -89,7 +90,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
//qiyu 按照对象赋值,Object.assign会触发多次key的change事件
|
|
92
|
-
this.state[controlInfo.dataView][controlId] =
|
|
93
|
+
this.state[controlInfo.dataView][controlId] = noProxyValue;
|
|
93
94
|
// if (
|
|
94
95
|
// controlInfo.dataBind instanceof ObjectDataBind &&
|
|
95
96
|
// isPlainObject(value)
|
|
@@ -108,7 +109,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
108
109
|
Object.keys(children).map(function(childControlId) {
|
|
109
110
|
if (childControlId === controlId) {
|
|
110
111
|
if (_this.state[dataView][subtableId][rowIndex]) {
|
|
111
|
-
_this.state[dataView][subtableId][rowIndex][controlId] =
|
|
112
|
+
_this.state[dataView][subtableId][rowIndex][controlId] = noProxyValue;
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
});
|
|
@@ -116,7 +117,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
116
117
|
});
|
|
117
118
|
} else {
|
|
118
119
|
//不存在的 controlId,直接被挂载到外部key
|
|
119
|
-
this.state[controlId] =
|
|
120
|
+
this.state[controlId] = noProxyValue;
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
}
|
|
@@ -374,6 +375,13 @@ item) {
|
|
|
374
375
|
});
|
|
375
376
|
});
|
|
376
377
|
} else {
|
|
378
|
+
if (data[item.props.dataBind.dataCode] === undefined) {
|
|
379
|
+
data[item.props.dataBind.dataCode] = {
|
|
380
|
+
controlId: dataViewId,
|
|
381
|
+
fields: [],
|
|
382
|
+
dataViewId: dataViewId
|
|
383
|
+
};
|
|
384
|
+
}
|
|
377
385
|
data[item.props.dataBind.dataCode].fields.push({
|
|
378
386
|
fieldCode: item.props.dataBind.fieldCode,
|
|
379
387
|
controlId: item.id,
|
|
@@ -24,7 +24,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
24
24
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
25
25
|
}
|
|
26
26
|
var cc = console;
|
|
27
|
-
import { CONTROL_BASE_TYPE, error, logerror } from "@byteluck-fe/model-driven-shared";
|
|
27
|
+
import { CONTROL_BASE_TYPE, error, logerror, JSONCopy } from "@byteluck-fe/model-driven-shared";
|
|
28
28
|
var proxyArrayApi = [
|
|
29
29
|
"splice",
|
|
30
30
|
"push",
|
|
@@ -125,7 +125,7 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
|
|
|
125
125
|
return Reflect.get(target, propertyKey, receiver);
|
|
126
126
|
},
|
|
127
127
|
set: function set(target, propertyKey, value, receiver) {
|
|
128
|
-
var newValue = value;
|
|
128
|
+
var newValue = JSONCopy(value);
|
|
129
129
|
// @ts-ignore
|
|
130
130
|
var oldValue = target[propertyKey];
|
|
131
131
|
var concatKey = thisKey === "" ? propertyKey : thisKey + "." + propertyKey;
|
|
@@ -142,14 +142,14 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
var _reProxyState;
|
|
145
|
-
newValue = (_reProxyState = reProxyState(
|
|
145
|
+
newValue = (_reProxyState = reProxyState(newValue)) !== null && _reProxyState !== void 0 ? _reProxyState : newValue;
|
|
146
146
|
// 先设置值,然后再进行触发回调,确保回调内拿到的是最新的值
|
|
147
147
|
var setResult;
|
|
148
148
|
// TODO 数组拦截操作需要重构,优化现有逻辑
|
|
149
149
|
// TODO 直接操作下标改动明细表时,没有对行数据进行checker
|
|
150
150
|
if (Array.isArray(target)) {
|
|
151
151
|
// 操作数组的时候,不需要使用拼接的thisKey,先判断执行的是否是违规操作,违规操作的话会报错,不允许继续执行,正常操作的话,返回一个回调函数,用于在值修改完之后触发
|
|
152
|
-
var nextHandler = ArrayHandler(target, propertyKey,
|
|
152
|
+
var nextHandler = ArrayHandler(target, propertyKey, newValue, thisKey, callback);
|
|
153
153
|
setResult = Reflect.set(target, propertyKey, newValue, receiver);
|
|
154
154
|
if (nextHandler) {
|
|
155
155
|
nextHandler();
|
|
@@ -171,7 +171,7 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
|
|
|
171
171
|
return true;
|
|
172
172
|
}
|
|
173
173
|
setResult = Reflect.set(target, propertyKey, newValue, receiver);
|
|
174
|
-
callback.call(null, target, concatKey,
|
|
174
|
+
callback.call(null, target, concatKey, newValue, oldValue);
|
|
175
175
|
}
|
|
176
176
|
// 不返回falsy 值(即 false、0、null、undefined、空字符串等)
|
|
177
177
|
//fix: TypeError: Proxy object's 'set' trap returned falsy value for property 'length'
|
|
@@ -223,7 +223,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
223
223
|
switch(_state.label){
|
|
224
224
|
case 0:
|
|
225
225
|
// 初始化state的时候不触发change事件,必须在engine mounted以后才触发
|
|
226
|
-
if (eventKey === "change" && !_this.engine.isMounted) {
|
|
226
|
+
if ((eventKey === "change" || eventKey === "list-change") && !_this.engine.isMounted) {
|
|
227
227
|
return [
|
|
228
228
|
2
|
|
229
229
|
];
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* @Author: zhaoxiaoyang zhaoxiaoyang@byteluck.com
|
|
3
|
+
* @Date: 2022-04-15 14:06:03
|
|
4
|
+
* @LastEditors: zhaoxiaoyang zhaoxiaoyang@byteluck.com
|
|
5
|
+
* @LastEditTime: 2023-11-30 16:38:47
|
|
6
|
+
* @FilePath: /model-driven/packages/engine/src/plugins/StylePlugin.ts
|
|
7
|
+
*/ function _class_call_check(instance, Constructor) {
|
|
2
8
|
if (!(instance instanceof Constructor)) {
|
|
3
9
|
throw new TypeError("Cannot call a class as a function");
|
|
4
10
|
}
|