mirror of
https://github.com/drawdb-io/drawdb.git
synced 2026-02-12 02:00:40 +08:00
Load types for selected db
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Action, ObjectType, sqlDataTypes } from "../../../data/constants";
|
||||
import { Action, ObjectType } from "../../../data/constants";
|
||||
import { Row, Col, Input, Button, Popover, Select } from "@douyinfe/semi-ui";
|
||||
import { IconMore, IconKeyStroked } from "@douyinfe/semi-icons";
|
||||
import { getSize, hasCheck, hasPrecision, isSized } from "../../../utils/toSQL";
|
||||
@@ -6,11 +6,12 @@ import { useTables, useTypes, useUndoRedo } from "../../../hooks";
|
||||
import { useState } from "react";
|
||||
import FieldDetails from "./FieldDetails";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { dbToTypes } from "../../../data/datatypes";
|
||||
|
||||
export default function TableField({ data, tid, index }) {
|
||||
const { updateField } = useTables();
|
||||
const { types } = useTypes();
|
||||
const { tables } = useTables();
|
||||
const { tables, database } = useTables();
|
||||
const { t } = useTranslation();
|
||||
const { setUndoStack, setRedoStack } = useUndoRedo();
|
||||
const [editField, setEditField] = useState({});
|
||||
@@ -50,7 +51,7 @@ export default function TableField({ data, tid, index }) {
|
||||
<Select
|
||||
className="w-full"
|
||||
optionList={[
|
||||
...sqlDataTypes.map((value) => ({
|
||||
...dbToTypes[database].map((value) => ({
|
||||
label: value,
|
||||
value: value,
|
||||
})),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import { Action, ObjectType, sqlDataTypes } from "../../../data/constants";
|
||||
import { Action, ObjectType } from "../../../data/constants";
|
||||
import {
|
||||
Row,
|
||||
Col,
|
||||
@@ -12,11 +12,13 @@ import {
|
||||
} from "@douyinfe/semi-ui";
|
||||
import { IconDeleteStroked, IconMore } from "@douyinfe/semi-icons";
|
||||
import { isSized, hasPrecision, getSize } from "../../../utils/toSQL";
|
||||
import { useUndoRedo, useTypes } from "../../../hooks";
|
||||
import { useUndoRedo, useTypes, useTables } from "../../../hooks";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { dbToTypes } from "../../../data/datatypes";
|
||||
|
||||
export default function TypeField({ data, tid, fid }) {
|
||||
const { types, updateType } = useTypes();
|
||||
const { database } = useTables();
|
||||
const { setUndoStack, setRedoStack } = useUndoRedo();
|
||||
const [editField, setEditField] = useState({});
|
||||
const { t } = useTranslation();
|
||||
@@ -62,7 +64,7 @@ export default function TypeField({ data, tid, fid }) {
|
||||
<Select
|
||||
className="w-full"
|
||||
optionList={[
|
||||
...sqlDataTypes.map((value) => ({
|
||||
...dbToTypes[database].map((value) => ({
|
||||
label: value,
|
||||
value: value,
|
||||
})),
|
||||
|
||||
Reference in New Issue
Block a user