@byteluck-fe/model-driven-engine 2.9.0-alpha.2 → 2.9.0-alpha.22
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.
|
@@ -348,6 +348,7 @@ import { findItem, proxyState } from "./proxyState";
|
|
|
348
348
|
import { ActionManager } from "./ActionManager";
|
|
349
349
|
import { DataManager } from "./DataManager";
|
|
350
350
|
import { checkerSubtableValue, checkerValue } from "./checkerValue";
|
|
351
|
+
import { buildUUID } from "../utils/runtimeUtils";
|
|
351
352
|
if (typeof window !== "undefined") {
|
|
352
353
|
// @ts-ignore
|
|
353
354
|
window.engines = {};
|
|
@@ -602,14 +603,16 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
602
603
|
result
|
|
603
604
|
];
|
|
604
605
|
}
|
|
606
|
+
var subtableData = this.getState(subtable.id);
|
|
607
|
+
this._handlerSubtableUpdateUid(subtableData);
|
|
605
608
|
this.emit("list-change", {
|
|
606
609
|
instance: subtable,
|
|
607
|
-
value:
|
|
610
|
+
value: subtableData,
|
|
608
611
|
options: Object.assign({}, options, {
|
|
609
612
|
changed: createdNewRows,
|
|
610
613
|
data: createdNewRowsData,
|
|
611
614
|
deleted: deleted !== null && deleted !== void 0 ? deleted : [],
|
|
612
|
-
jsonValue: JSON.stringify(
|
|
615
|
+
jsonValue: JSON.stringify(subtableData),
|
|
613
616
|
isDeleteLastOne: isDeleteLastOne,
|
|
614
617
|
type: type,
|
|
615
618
|
args: args
|
|
@@ -620,6 +623,18 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
620
623
|
}
|
|
621
624
|
}
|
|
622
625
|
},
|
|
626
|
+
{
|
|
627
|
+
key: "_handlerSubtableUpdateUid",
|
|
628
|
+
value: function _handlerSubtableUpdateUid(subtableData) {
|
|
629
|
+
subtableData.forEach(function(item) {
|
|
630
|
+
if (!item.uid) {
|
|
631
|
+
Object.assign(item, {
|
|
632
|
+
uid: "new:" + buildUUID("uid")
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
},
|
|
623
638
|
{
|
|
624
639
|
key: "_handlerObjectUpdate",
|
|
625
640
|
value: function _handlerObjectUpdate(state, key, value, oldValue) {
|
|
@@ -652,6 +667,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
652
667
|
if ((options === null || options === void 0 ? void 0 : options.setData) === true) {
|
|
653
668
|
deleted = [];
|
|
654
669
|
}
|
|
670
|
+
this._handlerSubtableUpdateUid(newValue);
|
|
655
671
|
this.emit("list-change", {
|
|
656
672
|
instance: instance,
|
|
657
673
|
value: value,
|
|
@@ -661,7 +677,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
661
677
|
data: newValue,
|
|
662
678
|
deleted: deleted,
|
|
663
679
|
// deleted: oldValue ?? [],
|
|
664
|
-
type: "push"
|
|
680
|
+
type: "push",
|
|
681
|
+
jsonValue: JSON.stringify(newValue)
|
|
665
682
|
})
|
|
666
683
|
});
|
|
667
684
|
} else {
|
package/dist/esm/common/Store.js
CHANGED
|
@@ -78,6 +78,16 @@ var Store = /*#__PURE__*/ function() {
|
|
|
78
78
|
var _this = this;
|
|
79
79
|
var controlInfo = this.controlIdMapping[controlId];
|
|
80
80
|
if (controlInfo !== undefined) {
|
|
81
|
+
//明细表
|
|
82
|
+
if (controlInfo.children) {
|
|
83
|
+
value.forEach(function(item) {
|
|
84
|
+
if (!item.uid) {
|
|
85
|
+
Object.assign(item, {
|
|
86
|
+
uid: "new:" + buildUUID("uid")
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
81
91
|
//qiyu 按照对象赋值,Object.assign会触发多次key的change事件
|
|
82
92
|
this.state[controlInfo.dataView][controlId] = value;
|
|
83
93
|
// if (
|
|
@@ -160,11 +160,13 @@ import { EventLogic } from "@byteluck-fe/model-driven-shared";
|
|
|
160
160
|
// }
|
|
161
161
|
export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
162
162
|
"use strict";
|
|
163
|
-
function ControlsEventPlugin(config) {
|
|
163
|
+
function ControlsEventPlugin(config, customEvents) {
|
|
164
164
|
_class_call_check(this, ControlsEventPlugin);
|
|
165
165
|
_define_property(this, "config", void 0);
|
|
166
166
|
_define_property(this, "engine", void 0);
|
|
167
|
+
_define_property(this, "customEvents", void 0);
|
|
167
168
|
this.config = config;
|
|
169
|
+
this.customEvents = customEvents;
|
|
168
170
|
}
|
|
169
171
|
_create_class(ControlsEventPlugin, [
|
|
170
172
|
{
|
|
@@ -201,6 +203,14 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
201
203
|
_this.engineAddEventListener(eventItem.code, eventItem.key);
|
|
202
204
|
}
|
|
203
205
|
});
|
|
206
|
+
//注册自定义组件事件
|
|
207
|
+
this.customEvents.map(function(item) {
|
|
208
|
+
var key = item.key;
|
|
209
|
+
if (item.namespace !== undefined && item.namespace !== null && item.namespace !== "") {
|
|
210
|
+
key = item.namespace + ":" + item.key;
|
|
211
|
+
}
|
|
212
|
+
_this.engineAddEventListener(key, key);
|
|
213
|
+
});
|
|
204
214
|
}
|
|
205
215
|
},
|
|
206
216
|
{
|