<template>
  <el-form-item label="内容：">
    <el-button type="primary" @click="() => editTable()">编辑</el-button>
  </el-form-item>

  <Del @delete="$emit('delete')" />
</template>
<script setup lang="ts">
import { BoardShape } from "../board";
import Del from "./delete.vue";
import { editEshapeTable } from "@/view/case/quisk";

const props = defineProps<{ shape: BoardShape }>();
const emit = defineEmits<{
  (e: "delete"): void;
  (e: "blur"): void;
  (e: "inputIng", ing: boolean): void;
}>();

const editTable = async (track = false) => {
  emit("inputIng", true);
  const data = await editEshapeTable({ content: props.shape.data.content, track });
  if (data) {
    props.shape.setContent(data);
  }
  emit("blur");
  emit("inputIng", false);
};

props.shape.autoSet && editTable(true);
</script>
