|
@@ -18,13 +18,14 @@ import { CompWeb3DObj } from "../../components/CompUI/basicUI/Web3D";
|
|
|
import { HistoryController } from "../../controllers/ReactCtrl/history";
|
|
|
import { ICompKeys } from "../../typings";
|
|
|
import { DesignComp, DesignCompObj } from "./DesignComp";
|
|
|
+import { CompCardListObj } from "../../components/CompUI/customUI/Cards/CardList";
|
|
|
|
|
|
|
|
|
const history = new HistoryController();
|
|
|
|
|
|
-export function createObj( data:any, init = true) {
|
|
|
+export function createObj( data:any, init = true) :DesignComp {
|
|
|
const compKey = data.compKey as ICompKeys
|
|
|
- let obj = {} as DesignComp;
|
|
|
+ let obj :any = null;
|
|
|
switch(compKey) {
|
|
|
case "Container":
|
|
|
obj = new CompCardObj();
|
|
@@ -72,21 +73,38 @@ export function createObj( data:any, init = true) {
|
|
|
obj = new CompCurveObj();
|
|
|
break;
|
|
|
case "Map":
|
|
|
- obj = new CompMapObj()
|
|
|
-
|
|
|
+ obj = new CompMapObj();
|
|
|
+
|
|
|
+ break;
|
|
|
+ case "CardList":
|
|
|
+ obj = new CompCardListObj();
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
- obj.compKey = compKey;
|
|
|
- obj.value.setHistory( history );
|
|
|
- obj.layout.setHistory(history);
|
|
|
- obj.layout.background.setHistory(history);
|
|
|
- obj.layout.border.setHistory(history);
|
|
|
- obj.children.setHistory(history);
|
|
|
|
|
|
- if (init) obj.fromJson(data);
|
|
|
+ if (obj) {
|
|
|
+ obj.compKey = compKey;
|
|
|
+ obj.value.setHistory( history );
|
|
|
+ obj.layout.setHistory(history);
|
|
|
+ obj.layout.background.setHistory(history);
|
|
|
+ obj.layout.border.setHistory(history);
|
|
|
+ obj.children.setHistory(history);
|
|
|
|
|
|
- return obj;
|
|
|
+ if (init) obj.fromJson(data);
|
|
|
+
|
|
|
+
|
|
|
+ if (compKey == "CardList") {
|
|
|
+ obj.children.list = data.children.list;
|
|
|
+ }
|
|
|
+ return obj;
|
|
|
+ }
|
|
|
+
|
|
|
+ //兼容老数据
|
|
|
+ if (compKey == "Cover") {
|
|
|
+ console.log( data );
|
|
|
+ debugger;
|
|
|
+ }
|
|
|
+
|
|
|
+ return data;
|
|
|
}
|
|
|
|
|
|
export function cloneObj(o: DesignComp ) {
|