Show field size on the diagram
This commit is contained in:
parent
844b24100e
commit
6f7b080e62
@ -17,9 +17,11 @@ import { Popover, Tag, Button, SideSheet } from "@douyinfe/semi-ui";
|
|||||||
import { useLayout, useSettings, useDiagram, useSelect } from "../../hooks";
|
import { useLayout, useSettings, useDiagram, useSelect } from "../../hooks";
|
||||||
import TableInfo from "../EditorSidePanel/TablesTab/TableInfo";
|
import TableInfo from "../EditorSidePanel/TablesTab/TableInfo";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { dbToTypes } from "../../data/datatypes";
|
||||||
|
|
||||||
export default function Table(props) {
|
export default function Table(props) {
|
||||||
const [hoveredField, setHoveredField] = useState(-1);
|
const [hoveredField, setHoveredField] = useState(-1);
|
||||||
|
const { database } = useDiagram();
|
||||||
const {
|
const {
|
||||||
tableData,
|
tableData,
|
||||||
onPointerDown,
|
onPointerDown,
|
||||||
@ -190,7 +192,15 @@ export default function Table(props) {
|
|||||||
<div className="popover-theme">
|
<div className="popover-theme">
|
||||||
<div className="flex justify-between items-center pb-2">
|
<div className="flex justify-between items-center pb-2">
|
||||||
<p className="me-4 font-bold">{e.name}</p>
|
<p className="me-4 font-bold">{e.name}</p>
|
||||||
<p className="ms-4">{e.type}</p>
|
<p className="ms-4">
|
||||||
|
{e.type +
|
||||||
|
((dbToTypes[database][e.type].isSized ||
|
||||||
|
dbToTypes[database][e.type].hasPrecision) &&
|
||||||
|
e.size &&
|
||||||
|
e.size !== ""
|
||||||
|
? "(" + e.size + ")"
|
||||||
|
: "")}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
{e.primary && (
|
{e.primary && (
|
||||||
@ -336,7 +346,15 @@ export default function Table(props) {
|
|||||||
) : (
|
) : (
|
||||||
<div className="flex gap-1 items-center">
|
<div className="flex gap-1 items-center">
|
||||||
{fieldData.primary && <IconKeyStroked />}
|
{fieldData.primary && <IconKeyStroked />}
|
||||||
<span>{fieldData.type.substr(0, 12)}</span>
|
<span>
|
||||||
|
{fieldData.type +
|
||||||
|
((dbToTypes[database][fieldData.type].isSized ||
|
||||||
|
dbToTypes[database][fieldData.type].hasPrecision) &&
|
||||||
|
fieldData.size &&
|
||||||
|
fieldData.size !== ""
|
||||||
|
? "(" + fieldData.size + ")"
|
||||||
|
: "")}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -122,7 +122,7 @@ const en = {
|
|||||||
values: "Values",
|
values: "Values",
|
||||||
size: "Size",
|
size: "Size",
|
||||||
precision: "Precision",
|
precision: "Precision",
|
||||||
set_precision: "Set precision: (size, digits)",
|
set_precision: "Set precision: 'size, digits'",
|
||||||
use_for_batch_input: "Use , for batch input",
|
use_for_batch_input: "Use , for batch input",
|
||||||
indices: "Indices",
|
indices: "Indices",
|
||||||
add_index: "Add index",
|
add_index: "Add index",
|
||||||
|
Loading…
Reference in New Issue
Block a user