import { Dict_Imgs } from "@/dict";
import { createAttrsForm } from "../../defines/createAttrsForm";
import { createCompHooks } from "../../defines/createCompHooks";
import { ImagePicker } from "../../formItems/ImagePicker";

export { Component } from "./component";

export const options = {
  name: "3D",
  thumbnail: require("@/modules/editor/assets/icons/3d.svg"),
};

export const { createComp, useCompData } = createCompHooks({
  value: {
    url: "https://www.sku3d.com/share.html?id=6478676ca494a3ea15a6fa82",
    inline: true,
    poster: Dict_Imgs.Default,
    ratio: 1,
  },
  layout: {
    size: [750, 750],
  },
});

export const Form = createAttrsForm([
  {
    label: "3D链接",
    dataIndex: "value.url",
    component: "Input",
  },
  {
    label: "封面",
    dataIndex: "value.poster",
    component: ImagePicker,
  },
  {
    label: "场景比例",
    dataIndex: "value.ratio",
    component: "Select",
    props: {
      options: [
        { label: "1:1", value: 1 },
        { label: "4:3", value: 4 / 3 },
        { label: "3:4", value: 3 / 4 },
        { label: "16:9", value: 16 / 9 },
        { label: "9:16", value: 9 / 16 },
      ],
    },
  },
  {
    label: "是否内嵌3D",
    dataIndex: "value.inline",
    component: "Switch",
  },
]);
