import { Action, ObjectType } from "../../../data/constants"; import { Input, Button, Popover, Checkbox, Select } from "@douyinfe/semi-ui"; import { IconMore, IconDeleteStroked } from "@douyinfe/semi-icons"; import { useTables, useUndoRedo } from "../../../hooks"; export default function IndexDetails({ data, fields, iid, tid }) { const { tables, updateTable } = useTables(); const { setUndoStack, setRedoStack } = useUndoRedo(); return (
Unique
{ setUndoStack((prev) => [ ...prev, { action: Action.EDIT, element: ObjectType.TABLE, component: "index", tid: tid, iid: iid, undo: { [checkedValues.target.value]: !checkedValues.target.checked, }, redo: { [checkedValues.target.value]: checkedValues.target.checked, }, message: `Edit table field to${ data.unique ? " not" : "" } unique`, }, ]); setRedoStack([]); updateTable(tid, { indices: tables[tid].indices.map((index) => index.id === iid ? { ...index, [checkedValues.target.value]: checkedValues.target.checked, } : index ), }); }} >
} trigger="click" position="rightTop" showArrow >