|
@@ -1,14 +1,13 @@
|
|
|
import { DesignComp } from "@/modules/editor/objects/DesignTemp/DesignComp";
|
|
|
import { css } from "@linaria/core";
|
|
|
import { defineUI } from "queenjs";
|
|
|
-import { onUnmounted, reactive, onMounted , ref} from "vue";
|
|
|
-import { Container, Draggable, vueDndrop } from "vue-dndrop";
|
|
|
+import { onUnmounted, reactive, ref } from "vue";
|
|
|
+import { Container, Draggable } from "vue-dndrop";
|
|
|
import { useEditor } from "../../..";
|
|
|
import { HotKeyCtrl } from "../../../controllers/HotKeyCtrl";
|
|
|
import { CompUI } from "../../CompUI";
|
|
|
import { Transfer } from "../../CompUI/basicUI/Transfer";
|
|
|
import { StreamCardTransfer } from "../../CompUI/basicUI/Transfer/streamCard";
|
|
|
-import { DragAddCtrl } from "@/modules/editor/controllers/DragAddCtrl";
|
|
|
|
|
|
export default defineUI({
|
|
|
setup() {
|
|
@@ -19,7 +18,6 @@ export default defineUI({
|
|
|
hotKeyCtrl.init();
|
|
|
onUnmounted(() => {
|
|
|
hotKeyCtrl.destroy();
|
|
|
-
|
|
|
});
|
|
|
|
|
|
const state = reactive({
|
|
@@ -29,12 +27,14 @@ export default defineUI({
|
|
|
const NotFoundComp = () => <div>无效的组件</div>;
|
|
|
const flagRef = ref();
|
|
|
const containRef = ref();
|
|
|
-
|
|
|
+
|
|
|
return () => {
|
|
|
const pageRoot = helper.findRootComp();
|
|
|
if (!pageRoot) return;
|
|
|
- const streamCardIndex = store.streamCardIds.indexOf(store.currStreamCardId)
|
|
|
- if (!flagRef.value ) {
|
|
|
+ const streamCardIndex = store.streamCardIds.indexOf(
|
|
|
+ store.currStreamCardId
|
|
|
+ );
|
|
|
+ if (!flagRef.value) {
|
|
|
flagRef.value = true;
|
|
|
setTimeout(() => {
|
|
|
actions.onViewReady();
|
|
@@ -50,31 +50,32 @@ export default defineUI({
|
|
|
return (
|
|
|
<>
|
|
|
<Container
|
|
|
- behaiver = "drop-zone"
|
|
|
-
|
|
|
+ behaiver="drop-zone"
|
|
|
class={store.isEditPage ? "!min-h-750px" : ""}
|
|
|
-
|
|
|
drag-handle-selector=".draganchor"
|
|
|
drop-placeholder={false}
|
|
|
animation-duration={0}
|
|
|
ref={containRef}
|
|
|
- should-accept-drop={(sourceContainerOptions:any, payload:any)=>{
|
|
|
- console.log("sourceContainerOptions:any, payload:any", sourceContainerOptions, payload)
|
|
|
- if (sourceContainerOptions.groupName != "canvas") return false
|
|
|
- controls.dragAddCtrl.updateCompKey(payload)
|
|
|
+ should-accept-drop={(
|
|
|
+ sourceContainerOptions: any,
|
|
|
+ payload: any
|
|
|
+ ) => {
|
|
|
+ console.log(
|
|
|
+ "sourceContainerOptions:any, payload:any",
|
|
|
+ sourceContainerOptions,
|
|
|
+ payload
|
|
|
+ );
|
|
|
+ if (sourceContainerOptions.groupName != "canvas")
|
|
|
+ return false;
|
|
|
+ controls.dragAddCtrl.updateCompKey(payload);
|
|
|
return false;
|
|
|
}}
|
|
|
-
|
|
|
- drop-not-allowed = {
|
|
|
- (p:any)=>{
|
|
|
- console.log("p", p)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ drop-not-allowed={(p: any) => {
|
|
|
+ console.log("p", p);
|
|
|
+ }}
|
|
|
onDrop={(e: any) => {
|
|
|
- console.log( e );
|
|
|
- return
|
|
|
+ console.log(e);
|
|
|
+ return;
|
|
|
|
|
|
if (e.payload) {
|
|
|
actions.addCompToDesign(e.payload, e.addedIndex);
|
|
@@ -88,14 +89,20 @@ export default defineUI({
|
|
|
>
|
|
|
{children}
|
|
|
</Container>
|
|
|
- {store.currStreamCardId && <StreamCardTransfer key={store.currStreamCardId + streamCardIndex} />}
|
|
|
+ {store.currStreamCardId && (
|
|
|
+ <StreamCardTransfer
|
|
|
+ key={store.currStreamCardId + streamCardIndex}
|
|
|
+ />
|
|
|
+ )}
|
|
|
|
|
|
{store.currCompId &&
|
|
|
- store.currStreamCardId &&
|
|
|
- store.currCompId !== "root" &&
|
|
|
- !store.textEditingState &&
|
|
|
- store.currCompId !== store.currStreamCardId &&
|
|
|
- !state.draging && <Transfer key={store.currCompId + streamCardIndex} />}
|
|
|
+ store.currStreamCardId &&
|
|
|
+ store.currCompId !== "root" &&
|
|
|
+ !store.textEditingState &&
|
|
|
+ store.currCompId !== store.currStreamCardId &&
|
|
|
+ !state.draging && (
|
|
|
+ <Transfer key={store.currCompId + streamCardIndex} />
|
|
|
+ )}
|
|
|
</>
|
|
|
);
|
|
|
},
|
|
@@ -104,9 +111,8 @@ export default defineUI({
|
|
|
controls.compUICtrl.state.components.get(comp.compKey)
|
|
|
?.Component || NotFoundComp;
|
|
|
return (
|
|
|
- <Draggable class="!flex flex-col" key={comp.id}>
|
|
|
+ <Draggable key={comp.id}>
|
|
|
<Comp compId={comp.id} />
|
|
|
-
|
|
|
</Draggable>
|
|
|
);
|
|
|
},
|