Add pop confirm to delete field
This commit is contained in:
parent
974c254e48
commit
fb214b8f7b
@ -16,7 +16,7 @@ import {
|
|||||||
IconColorPalette,
|
IconColorPalette,
|
||||||
} from "@douyinfe/semi-icons";
|
} from "@douyinfe/semi-icons";
|
||||||
import {
|
import {
|
||||||
// Modal,
|
Popconfirm,
|
||||||
Select,
|
Select,
|
||||||
Card,
|
Card,
|
||||||
Form,
|
Form,
|
||||||
@ -731,14 +731,10 @@ export default function Table(props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="text-slate-400">
|
<div className="text-slate-400">
|
||||||
{hoveredField === index ? (
|
{hoveredField === index ? (
|
||||||
<Button
|
<Popconfirm
|
||||||
theme="solid"
|
title="Are you sure you want to delete this field?"
|
||||||
size="small"
|
content="This modification will be irreversible"
|
||||||
style={{
|
onConfirm={() =>
|
||||||
opacity: "0.7",
|
|
||||||
backgroundColor: "#d42020",
|
|
||||||
}}
|
|
||||||
onClick={(ev) => {
|
|
||||||
setTables((prev) => {
|
setTables((prev) => {
|
||||||
const updatedTables = [...prev];
|
const updatedTables = [...prev];
|
||||||
const updatedFields = [
|
const updatedFields = [
|
||||||
@ -747,10 +743,20 @@ export default function Table(props) {
|
|||||||
updatedFields.splice(index, 1);
|
updatedFields.splice(index, 1);
|
||||||
updatedTables[props.tableData.id].fields = [...updatedFields];
|
updatedTables[props.tableData.id].fields = [...updatedFields];
|
||||||
return updatedTables;
|
return updatedTables;
|
||||||
});
|
})
|
||||||
|
}
|
||||||
|
onCancel={() => {}}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
theme="solid"
|
||||||
|
size="small"
|
||||||
|
style={{
|
||||||
|
opacity: "0.7",
|
||||||
|
backgroundColor: "#d42020",
|
||||||
}}
|
}}
|
||||||
icon={<IconMinus />}
|
icon={<IconMinus />}
|
||||||
></Button>
|
></Button>
|
||||||
|
</Popconfirm>
|
||||||
) : (
|
) : (
|
||||||
fieldData.type
|
fieldData.type
|
||||||
)}
|
)}
|
||||||
|
16
src/index.js
16
src/index.js
@ -1,13 +1,17 @@
|
|||||||
import React from 'react';
|
import React from "react";
|
||||||
import ReactDOM from 'react-dom/client';
|
import ReactDOM from "react-dom/client";
|
||||||
import './index.css';
|
import "./index.css";
|
||||||
import App from './App';
|
import App from "./App";
|
||||||
import reportWebVitals from './reportWebVitals';
|
import reportWebVitals from "./reportWebVitals";
|
||||||
|
import { LocaleProvider } from "@douyinfe/semi-ui";
|
||||||
|
import en_US from "@douyinfe/semi-ui/lib/es/locale/source/en_US";
|
||||||
|
|
||||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
const root = ReactDOM.createRoot(document.getElementById("root"));
|
||||||
root.render(
|
root.render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
|
<LocaleProvider locale={en_US}>
|
||||||
<App />
|
<App />
|
||||||
|
</LocaleProvider>
|
||||||
</React.StrictMode>
|
</React.StrictMode>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user