jskim-node #419
|
|
@ -1592,6 +1592,10 @@ export default function TableManagementPage() {
|
||||||
constraints={constraints}
|
constraints={constraints}
|
||||||
typeFilter={typeFilter}
|
typeFilter={typeFilter}
|
||||||
getColumnIndexState={getColumnIndexState}
|
getColumnIndexState={getColumnIndexState}
|
||||||
|
onPkToggle={handlePkToggle}
|
||||||
|
onIndexToggle={(columnName, checked) =>
|
||||||
|
handleIndexToggle(columnName, "index", checked)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ export interface ColumnGridProps {
|
||||||
constraints: ColumnGridConstraints;
|
constraints: ColumnGridConstraints;
|
||||||
typeFilter?: string | null;
|
typeFilter?: string | null;
|
||||||
getColumnIndexState?: (columnName: string) => { isPk: boolean; hasIndex: boolean };
|
getColumnIndexState?: (columnName: string) => { isPk: boolean; hasIndex: boolean };
|
||||||
|
onPkToggle?: (columnName: string, checked: boolean) => void;
|
||||||
|
onIndexToggle?: (columnName: string, checked: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getIndexState(
|
function getIndexState(
|
||||||
|
|
@ -49,6 +51,8 @@ export function ColumnGrid({
|
||||||
constraints,
|
constraints,
|
||||||
typeFilter = null,
|
typeFilter = null,
|
||||||
getColumnIndexState: externalGetIndexState,
|
getColumnIndexState: externalGetIndexState,
|
||||||
|
onPkToggle,
|
||||||
|
onIndexToggle,
|
||||||
}: ColumnGridProps) {
|
}: ColumnGridProps) {
|
||||||
const getIdxState = useMemo(
|
const getIdxState = useMemo(
|
||||||
() => externalGetIndexState ?? ((name: string) => getIndexState(name, constraints)),
|
() => externalGetIndexState ?? ((name: string) => getIndexState(name, constraints)),
|
||||||
|
|
@ -193,7 +197,7 @@ export function ColumnGrid({
|
||||||
)}
|
)}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
onColumnChange(column.columnName, "isPrimaryKey" as keyof ColumnTypeInfo, !idxState.isPk);
|
onPkToggle?.(column.columnName, !idxState.isPk);
|
||||||
}}
|
}}
|
||||||
title="Primary Key 토글"
|
title="Primary Key 토글"
|
||||||
>
|
>
|
||||||
|
|
@ -225,7 +229,7 @@ export function ColumnGrid({
|
||||||
)}
|
)}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
onColumnChange(column.columnName, "hasIndex" as keyof ColumnTypeInfo, !idxState.hasIndex);
|
onIndexToggle?.(column.columnName, !idxState.hasIndex);
|
||||||
}}
|
}}
|
||||||
title="Index 토글"
|
title="Index 토글"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue