Kaynağa Gözat

Merge tag '2.1.0' into develop

cc12458 6 ay önce
ebeveyn
işleme
b73930189f
1 değiştirilmiş dosya ile 12 ekleme ve 3 silme
  1. 12 3
      src/pages/aio/flow-config/index.vue

+ 12 - 3
src/pages/aio/flow-config/index.vue

@@ -57,7 +57,10 @@ const hasInstance = () => !isUnmounted && !!instance && !!instance.lf;
 let oldValue: FlowRequestData;
 const maxPanelHeight = ref(0);
 const init = (lf: LogicFlowInstance): void => {
-  setTimeout(() => { maxPanelHeight.value = lf.container.getBoundingClientRect().height - 80; }, 100);
+  setTimeout(() => {
+    maxPanelHeight.value = lf.container.getBoundingClientRect().height - 80;
+    openPanel.value = maxPanelHeight.value > 0;
+  }, 100);
   instance = VLogicFlowInit(lf, {
     register: [{ category: 'node', type: 'FlowNode', view: FlowNodeView, model: FlowNodeViewModel }],
   });
@@ -189,8 +192,13 @@ const updateLayout = (dir?: 'LR' | 'TB' | 'center') => {
   }
 };
 
-const openPanel = ref(true);
+const openPanel = ref(false);
 const dragPanelNodeId = ref('');
+const togglePanel = (open?: boolean) => {
+  open ??= !openPanel.value;
+  if (open && !(maxPanelHeight.value > 0)) maxPanelHeight.value = instance.lf.container.getBoundingClientRect().height - 80;
+  openPanel.value = open;
+};
 const startDragPanelNode = (node: any, event: MouseEvent) => {
   let el = event.target as HTMLElement;
   do {
@@ -353,6 +361,7 @@ const validate = (tips = true) => {
 tryOnUnmounted(() => {
   // 新加的
   isUnmounted = true;
+  openPanel.value = false;
   notification.destroy();
   try { scope.stop(); } catch {}
 });
@@ -370,7 +379,7 @@ defineExpose({
     </template>
     <template #panel>
       <a-dropdown class="panel-wrapper" :trigger="['click']" :open="openPanel">
-        <a-button type="primary" size="large" shape="circle" @click.prevent="openPanel = !openPanel">
+        <a-button type="primary" size="large" shape="circle" @click.prevent="togglePanel()">
           <template #icon>
             <CloseOutlined v-if="openPanel"></CloseOutlined>
             <MenuOutlined v-else />