mirror of
https://github.com/drawdb-io/drawdb.git
synced 2026-02-21 01:10:08 +08:00
slight modifications to the table view
This commit is contained in:
@@ -16,7 +16,7 @@ import {
|
|||||||
import { Popover, Tag, Button, SideSheet } from "@douyinfe/semi-ui";
|
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";
|
import { dbToTypes } from "../../data/datatypes";
|
||||||
import { isRtl } from "../../i18n/utils/rtl";
|
import { isRtl } from "../../i18n/utils/rtl";
|
||||||
import i18n from "../../i18n/i18n";
|
import i18n from "../../i18n/i18n";
|
||||||
@@ -296,7 +296,7 @@ export default function Table(props) {
|
|||||||
className={`
|
className={`
|
||||||
${
|
${
|
||||||
(fieldData.primary && settings.notation !== "default" )
|
(fieldData.primary && settings.notation !== "default" )
|
||||||
? "border"
|
? "border-b border-gray-400"
|
||||||
: ""
|
: ""
|
||||||
} ${
|
} ${
|
||||||
(!fieldData.primary && settings.notation !== "default" )
|
(!fieldData.primary && settings.notation !== "default" )
|
||||||
@@ -315,9 +315,17 @@ export default function Table(props) {
|
|||||||
? "border-b border-gray-400"
|
? "border-b border-gray-400"
|
||||||
: ""
|
: ""
|
||||||
} ${
|
} ${
|
||||||
|
(fieldData.primary && settings.notation === "default")
|
||||||
|
? "border-b border-gray-400"
|
||||||
|
: ""
|
||||||
|
}${
|
||||||
|
(settings.notation === "default" && index !== tableData.fields.length - 1 && fieldData.primary === false)
|
||||||
|
? "border-b border-gray-400"
|
||||||
|
: ""
|
||||||
|
}${
|
||||||
// Checa que cuando seas el último se redondee
|
// Checa que cuando seas el último se redondee
|
||||||
(settings.notation === "default" && index === tableData.fields.length - 1)
|
(settings.notation === "default" && index === tableData.fields.length - 1)
|
||||||
? "border-b border-gray-400"
|
? "rounded-b-md"
|
||||||
: ""
|
: ""
|
||||||
} group h-[36px] px-2 py-1 flex justify-between items-center gap-1 w-full overflow-hidden`}
|
} group h-[36px] px-2 py-1 flex justify-between items-center gap-1 w-full overflow-hidden`}
|
||||||
onPointerEnter={(e) => {
|
onPointerEnter={(e) => {
|
||||||
@@ -393,19 +401,35 @@ export default function Table(props) {
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex gap-1 items-center">
|
<div className="flex gap-1 items-center">
|
||||||
{(fieldData.primary && settings.notation === "default") && <IconKeyStroked />}
|
{settings.notation !== "default" ? (
|
||||||
{(fieldData.notNull && settings.notation !== "default") && <span>NOT NULL</span>}
|
<>
|
||||||
{(!fieldData.notNull && settings.notation !== "default") && <span>NULL</span>}
|
<span>
|
||||||
{(!fieldData.notNull && settings.notation === "default") && <span>?</span>}
|
{fieldData.type +
|
||||||
<span>
|
((dbToTypes[database][fieldData.type].isSized ||
|
||||||
{fieldData.type +
|
dbToTypes[database][fieldData.type].hasPrecision) &&
|
||||||
((dbToTypes[database][fieldData.type].isSized ||
|
fieldData.size &&
|
||||||
dbToTypes[database][fieldData.type].hasPrecision) &&
|
fieldData.size !== ""
|
||||||
fieldData.size &&
|
? "(" + fieldData.size + ")"
|
||||||
fieldData.size !== ""
|
: "")}
|
||||||
? "(" + fieldData.size + ")"
|
</span>
|
||||||
: "")}
|
{(fieldData.notNull && <span>NOT NULL</span>)}
|
||||||
</span>
|
{(!fieldData.notnull && <span>NULL</span>)}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{fieldData.primary && <IconKeyStroked/>}
|
||||||
|
{!fieldData.notNull && <span>?</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>
|
||||||
|
|||||||
Reference in New Issue
Block a user