import { useEditor } from "@/modules/editor";
import { defineUI } from "queenjs";
import { h } from "vue";
import { CompUI } from "../../CompUI";
import { createAttrsForm } from "../../CompUI/defines/createAttrsForm";

export default defineUI({
  setup() {
    const editor = useEditor()

    return () => {
      const { currComp } = editor.store;

      return (
        <div class="flex flex-col h-1/1">
          <div class="p-16px border-bottom  !border-2px">设置栏</div>
          <div class="flex-1 p-16px scrollbar">
            {h(
              currComp?.compKey
                ? CompUI[currComp.compKey].Form
                : (createAttrsForm([]) as any),
              { component: currComp }
            )}
          </div>
        </div>
      );
    };
  },
});
