Remove popconfirm from canvas field delete
This commit is contained in:
parent
3efbb0de2a
commit
b8f7ac2812
@ -17,7 +17,6 @@ import {
|
||||
IconColorPalette,
|
||||
} from "@douyinfe/semi-icons";
|
||||
import {
|
||||
Popconfirm,
|
||||
Select,
|
||||
Input,
|
||||
TextArea,
|
||||
@ -73,15 +72,13 @@ export default function Table(props) {
|
||||
onMouseLeave={() => setIsHovered(false)}
|
||||
>
|
||||
<div
|
||||
className={`border-2 ${
|
||||
isHovered
|
||||
className={`border-2 ${isHovered
|
||||
? "border-dashed border-blue-500"
|
||||
: selectedElement.element === ObjectType.TABLE &&
|
||||
selectedElement.id === props.tableData.id
|
||||
? "border-blue-500"
|
||||
: "border-slate-400"
|
||||
} select-none rounded-lg w-full ${
|
||||
settings.mode === "light"
|
||||
} select-none rounded-lg w-full ${settings.mode === "light"
|
||||
? "bg-zinc-100 text-zinc-800"
|
||||
: "bg-zinc-800 text-zinc-200"
|
||||
}`}
|
||||
@ -91,8 +88,7 @@ export default function Table(props) {
|
||||
style={{ backgroundColor: props.tableData.color }}
|
||||
/>
|
||||
<div
|
||||
className={`font-bold h-[40px] flex justify-between items-center border-b border-gray-400 ${
|
||||
settings.mode === "light" ? "bg-zinc-200" : "bg-zinc-900"
|
||||
className={`font-bold h-[40px] flex justify-between items-center border-b border-gray-400 ${settings.mode === "light" ? "bg-zinc-200" : "bg-zinc-900"
|
||||
}`}
|
||||
>
|
||||
<div className="px-3">
|
||||
@ -151,8 +147,7 @@ export default function Table(props) {
|
||||
</div>
|
||||
<div>
|
||||
<strong
|
||||
className={`${
|
||||
props.tableData.indices.length === 0 ? "" : "block"
|
||||
className={`${props.tableData.indices.length === 0 ? "" : "block"
|
||||
}`}
|
||||
>
|
||||
Indices :
|
||||
@ -164,8 +159,7 @@ export default function Table(props) {
|
||||
{props.tableData.indices.map((index, k) => (
|
||||
<div
|
||||
key={k}
|
||||
className={`flex items-center my-1 px-2 py-1 rounded ${
|
||||
settings.mode === "light"
|
||||
className={`flex items-center my-1 px-2 py-1 rounded ${settings.mode === "light"
|
||||
? "bg-gray-100"
|
||||
: "bg-zinc-800"
|
||||
}`}
|
||||
@ -437,8 +431,7 @@ export default function Table(props) {
|
||||
fid: j,
|
||||
undo: { notNull: f.notNull },
|
||||
redo: { notNull: !f.notNull },
|
||||
message: `Edit table field to${
|
||||
f.notNull ? "" : " not"
|
||||
message: `Edit table field to${f.notNull ? "" : " not"
|
||||
} null`,
|
||||
},
|
||||
]);
|
||||
@ -465,8 +458,7 @@ export default function Table(props) {
|
||||
fid: j,
|
||||
undo: { primary: f.primary },
|
||||
redo: { primary: !f.primary },
|
||||
message: `Edit table field to${
|
||||
f.primary ? " not" : ""
|
||||
message: `Edit table field to${f.primary ? " not" : ""
|
||||
} primary`,
|
||||
},
|
||||
]);
|
||||
@ -699,8 +691,7 @@ export default function Table(props) {
|
||||
[checkedValues.target.value]:
|
||||
checkedValues.target.checked,
|
||||
},
|
||||
message: `Edit table field to${
|
||||
f.unique ? " not" : ""
|
||||
message: `Edit table field to${f.unique ? " not" : ""
|
||||
} unique`,
|
||||
},
|
||||
]);
|
||||
@ -741,8 +732,7 @@ export default function Table(props) {
|
||||
[checkedValues.target.value]:
|
||||
checkedValues.target.checked,
|
||||
},
|
||||
message: `Edit table field to${
|
||||
f.primary ? " not" : ""
|
||||
message: `Edit table field to${f.primary ? " not" : ""
|
||||
} auto increment`,
|
||||
},
|
||||
]);
|
||||
@ -946,8 +936,7 @@ export default function Table(props) {
|
||||
[checkedValues.target.value]:
|
||||
checkedValues.target.checked,
|
||||
},
|
||||
message: `Edit table field to${
|
||||
idx.unique ? " not" : ""
|
||||
message: `Edit table field to${idx.unique ? " not" : ""
|
||||
} unique`,
|
||||
},
|
||||
]);
|
||||
@ -1242,8 +1231,7 @@ export default function Table(props) {
|
||||
function field(fieldData, index) {
|
||||
return (
|
||||
<div
|
||||
className={`${
|
||||
index === props.tableData.fields.length - 1
|
||||
className={`${index === props.tableData.fields.length - 1
|
||||
? ""
|
||||
: "border-b border-gray-400"
|
||||
} h-[36px] px-2 py-1 flex justify-between`}
|
||||
@ -1278,10 +1266,16 @@ export default function Table(props) {
|
||||
</div>
|
||||
<div className="text-zinc-400">
|
||||
{hoveredField === index ? (
|
||||
<Popconfirm
|
||||
title="Are you sure you want to delete this field?"
|
||||
content="This modification will be irreversible"
|
||||
onConfirm={() => {
|
||||
|
||||
<Button
|
||||
theme="solid"
|
||||
size="small"
|
||||
style={{
|
||||
opacity: "0.7",
|
||||
backgroundColor: "#d42020",
|
||||
}}
|
||||
icon={<IconMinus />}
|
||||
onClick={() => {
|
||||
setUndoStack((prev) => [
|
||||
...prev,
|
||||
{
|
||||
@ -1347,18 +1341,7 @@ export default function Table(props) {
|
||||
}),
|
||||
});
|
||||
}}
|
||||
onCancel={() => {}}
|
||||
>
|
||||
<Button
|
||||
theme="solid"
|
||||
size="small"
|
||||
style={{
|
||||
opacity: "0.7",
|
||||
backgroundColor: "#d42020",
|
||||
}}
|
||||
icon={<IconMinus />}
|
||||
></Button>
|
||||
</Popconfirm>
|
||||
) : (
|
||||
fieldData.type
|
||||
)}
|
||||
|
Loading…
Reference in New Issue
Block a user