Compare commits
7 Commits
7a2f80b646
...
a38650692c
| Author | SHA1 | Date |
|---|---|---|
|
|
a38650692c | |
|
|
bc66f3bba1 | |
|
|
93d9937343 | |
|
|
2cddb42255 | |
|
|
a90ddac512 | |
|
|
127f4dc783 | |
|
|
3ab32820e9 |
|
|
@ -29,6 +29,7 @@ export class EntityJoinController {
|
||||||
screenEntityConfigs, // 화면별 엔티티 설정 (JSON 문자열)
|
screenEntityConfigs, // 화면별 엔티티 설정 (JSON 문자열)
|
||||||
autoFilter, // 🔒 멀티테넌시 자동 필터
|
autoFilter, // 🔒 멀티테넌시 자동 필터
|
||||||
dataFilter, // 🆕 데이터 필터 (JSON 문자열)
|
dataFilter, // 🆕 데이터 필터 (JSON 문자열)
|
||||||
|
excludeFilter, // 🆕 제외 필터 (JSON 문자열) - 다른 테이블에 이미 존재하는 데이터 제외
|
||||||
userLang, // userLang은 별도로 분리하여 search에 포함되지 않도록 함
|
userLang, // userLang은 별도로 분리하여 search에 포함되지 않도록 함
|
||||||
...otherParams
|
...otherParams
|
||||||
} = req.query;
|
} = req.query;
|
||||||
|
|
@ -125,6 +126,19 @@ export class EntityJoinController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 🆕 제외 필터 처리 (다른 테이블에 이미 존재하는 데이터 제외)
|
||||||
|
let parsedExcludeFilter: any = undefined;
|
||||||
|
if (excludeFilter) {
|
||||||
|
try {
|
||||||
|
parsedExcludeFilter =
|
||||||
|
typeof excludeFilter === "string" ? JSON.parse(excludeFilter) : excludeFilter;
|
||||||
|
logger.info("제외 필터 파싱 완료:", parsedExcludeFilter);
|
||||||
|
} catch (error) {
|
||||||
|
logger.warn("제외 필터 파싱 오류:", error);
|
||||||
|
parsedExcludeFilter = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const result = await tableManagementService.getTableDataWithEntityJoins(
|
const result = await tableManagementService.getTableDataWithEntityJoins(
|
||||||
tableName,
|
tableName,
|
||||||
{
|
{
|
||||||
|
|
@ -141,6 +155,7 @@ export class EntityJoinController {
|
||||||
additionalJoinColumns: parsedAdditionalJoinColumns,
|
additionalJoinColumns: parsedAdditionalJoinColumns,
|
||||||
screenEntityConfigs: parsedScreenEntityConfigs,
|
screenEntityConfigs: parsedScreenEntityConfigs,
|
||||||
dataFilter: parsedDataFilter, // 🆕 데이터 필터 전달
|
dataFilter: parsedDataFilter, // 🆕 데이터 필터 전달
|
||||||
|
excludeFilter: parsedExcludeFilter, // 🆕 제외 필터 전달
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2462,6 +2462,14 @@ export class TableManagementService {
|
||||||
}>;
|
}>;
|
||||||
screenEntityConfigs?: Record<string, any>; // 화면별 엔티티 설정
|
screenEntityConfigs?: Record<string, any>; // 화면별 엔티티 설정
|
||||||
dataFilter?: any; // 🆕 데이터 필터
|
dataFilter?: any; // 🆕 데이터 필터
|
||||||
|
excludeFilter?: {
|
||||||
|
enabled: boolean;
|
||||||
|
referenceTable: string;
|
||||||
|
referenceColumn: string;
|
||||||
|
sourceColumn: string;
|
||||||
|
filterColumn?: string;
|
||||||
|
filterValue?: any;
|
||||||
|
}; // 🆕 제외 필터 (다른 테이블에 이미 존재하는 데이터 제외)
|
||||||
}
|
}
|
||||||
): Promise<EntityJoinResponse> {
|
): Promise<EntityJoinResponse> {
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
|
|
@ -2716,6 +2724,44 @@ export class TableManagementService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 🆕 제외 필터 적용 (다른 테이블에 이미 존재하는 데이터 제외)
|
||||||
|
if (options.excludeFilter && options.excludeFilter.enabled) {
|
||||||
|
const {
|
||||||
|
referenceTable,
|
||||||
|
referenceColumn,
|
||||||
|
sourceColumn,
|
||||||
|
filterColumn,
|
||||||
|
filterValue,
|
||||||
|
} = options.excludeFilter;
|
||||||
|
|
||||||
|
if (referenceTable && referenceColumn && sourceColumn) {
|
||||||
|
// 서브쿼리로 이미 존재하는 데이터 제외
|
||||||
|
let excludeSubquery = `main."${sourceColumn}" NOT IN (
|
||||||
|
SELECT "${referenceColumn}" FROM "${referenceTable}"
|
||||||
|
WHERE "${referenceColumn}" IS NOT NULL`;
|
||||||
|
|
||||||
|
// 추가 필터 조건이 있으면 적용 (예: 특정 거래처의 품목만 제외)
|
||||||
|
if (filterColumn && filterValue !== undefined && filterValue !== null) {
|
||||||
|
excludeSubquery += ` AND "${filterColumn}" = '${String(filterValue).replace(/'/g, "''")}'`;
|
||||||
|
}
|
||||||
|
|
||||||
|
excludeSubquery += ")";
|
||||||
|
|
||||||
|
whereClause = whereClause
|
||||||
|
? `${whereClause} AND ${excludeSubquery}`
|
||||||
|
: excludeSubquery;
|
||||||
|
|
||||||
|
logger.info(`🚫 제외 필터 적용 (Entity 조인):`, {
|
||||||
|
referenceTable,
|
||||||
|
referenceColumn,
|
||||||
|
sourceColumn,
|
||||||
|
filterColumn,
|
||||||
|
filterValue,
|
||||||
|
excludeSubquery,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ORDER BY 절 구성
|
// ORDER BY 절 구성
|
||||||
const orderBy = options.sortBy
|
const orderBy = options.sortBy
|
||||||
? `main.${options.sortBy} ${options.sortOrder === "desc" ? "DESC" : "ASC"}`
|
? `main.${options.sortBy} ${options.sortOrder === "desc" ? "DESC" : "ASC"}`
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,14 @@ export const entityJoinApi = {
|
||||||
}>;
|
}>;
|
||||||
screenEntityConfigs?: Record<string, any>; // 🎯 화면별 엔티티 설정
|
screenEntityConfigs?: Record<string, any>; // 🎯 화면별 엔티티 설정
|
||||||
dataFilter?: any; // 🆕 데이터 필터
|
dataFilter?: any; // 🆕 데이터 필터
|
||||||
|
excludeFilter?: {
|
||||||
|
enabled: boolean;
|
||||||
|
referenceTable: string;
|
||||||
|
referenceColumn: string;
|
||||||
|
sourceColumn: string;
|
||||||
|
filterColumn?: string;
|
||||||
|
filterValue?: any;
|
||||||
|
}; // 🆕 제외 필터 (다른 테이블에 이미 존재하는 데이터 제외)
|
||||||
} = {},
|
} = {},
|
||||||
): Promise<EntityJoinResponse> => {
|
): Promise<EntityJoinResponse> => {
|
||||||
// 🔒 멀티테넌시: company_code 자동 필터링 활성화
|
// 🔒 멀티테넌시: company_code 자동 필터링 활성화
|
||||||
|
|
@ -90,6 +98,7 @@ export const entityJoinApi = {
|
||||||
screenEntityConfigs: params.screenEntityConfigs ? JSON.stringify(params.screenEntityConfigs) : undefined, // 🎯 화면별 엔티티 설정
|
screenEntityConfigs: params.screenEntityConfigs ? JSON.stringify(params.screenEntityConfigs) : undefined, // 🎯 화면별 엔티티 설정
|
||||||
autoFilter: JSON.stringify(autoFilter), // 🔒 멀티테넌시 필터링
|
autoFilter: JSON.stringify(autoFilter), // 🔒 멀티테넌시 필터링
|
||||||
dataFilter: params.dataFilter ? JSON.stringify(params.dataFilter) : undefined, // 🆕 데이터 필터
|
dataFilter: params.dataFilter ? JSON.stringify(params.dataFilter) : undefined, // 🆕 데이터 필터
|
||||||
|
excludeFilter: params.excludeFilter ? JSON.stringify(params.excludeFilter) : undefined, // 🆕 제외 필터
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return response.data.data;
|
return response.data.data;
|
||||||
|
|
|
||||||
|
|
@ -170,8 +170,9 @@ export const DynamicComponentRenderer: React.FC<DynamicComponentRendererProps> =
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 🆕 disabledFields 체크
|
// 🆕 disabledFields 체크 + readonly 체크
|
||||||
const isFieldDisabled = props.disabledFields?.includes(columnName) || (component as any).readonly;
|
const isFieldDisabled = props.disabledFields?.includes(columnName) || (component as any).disabled;
|
||||||
|
const isFieldReadonly = (component as any).readonly || (component as any).componentConfig?.readonly;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CategorySelectComponent
|
<CategorySelectComponent
|
||||||
|
|
@ -182,6 +183,7 @@ export const DynamicComponentRenderer: React.FC<DynamicComponentRendererProps> =
|
||||||
placeholder={component.componentConfig?.placeholder || "선택하세요"}
|
placeholder={component.componentConfig?.placeholder || "선택하세요"}
|
||||||
required={(component as any).required}
|
required={(component as any).required}
|
||||||
disabled={isFieldDisabled}
|
disabled={isFieldDisabled}
|
||||||
|
readonly={isFieldReadonly}
|
||||||
className="w-full"
|
className="w-full"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,26 @@ export function AutocompleteSearchInputComponent({
|
||||||
// config prop 우선, 없으면 개별 prop 사용
|
// config prop 우선, 없으면 개별 prop 사용
|
||||||
const tableName = config?.tableName || propTableName || "";
|
const tableName = config?.tableName || propTableName || "";
|
||||||
const displayField = config?.displayField || propDisplayField || "";
|
const displayField = config?.displayField || propDisplayField || "";
|
||||||
|
const displayFields = config?.displayFields || (displayField ? [displayField] : []); // 다중 표시 필드
|
||||||
|
const displaySeparator = config?.displaySeparator || " → "; // 구분자
|
||||||
const valueField = config?.valueField || propValueField || "";
|
const valueField = config?.valueField || propValueField || "";
|
||||||
const searchFields = config?.searchFields || propSearchFields || [displayField];
|
const searchFields = config?.searchFields || propSearchFields || displayFields; // 검색 필드도 다중 표시 필드 사용
|
||||||
const placeholder = config?.placeholder || propPlaceholder || "검색...";
|
const placeholder = config?.placeholder || propPlaceholder || "검색...";
|
||||||
|
|
||||||
|
// 다중 필드 값을 조합하여 표시 문자열 생성
|
||||||
|
const getDisplayValue = (item: EntitySearchResult): string => {
|
||||||
|
if (displayFields.length > 1) {
|
||||||
|
// 여러 필드를 구분자로 조합
|
||||||
|
const values = displayFields
|
||||||
|
.map((field) => item[field])
|
||||||
|
.filter((v) => v !== null && v !== undefined && v !== "")
|
||||||
|
.map((v) => String(v));
|
||||||
|
return values.join(displaySeparator);
|
||||||
|
}
|
||||||
|
// 단일 필드
|
||||||
|
return item[displayField] || "";
|
||||||
|
};
|
||||||
|
|
||||||
const [inputValue, setInputValue] = useState("");
|
const [inputValue, setInputValue] = useState("");
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const [selectedData, setSelectedData] = useState<EntitySearchResult | null>(null);
|
const [selectedData, setSelectedData] = useState<EntitySearchResult | null>(null);
|
||||||
|
|
@ -115,7 +131,7 @@ export function AutocompleteSearchInputComponent({
|
||||||
|
|
||||||
const handleSelect = (item: EntitySearchResult) => {
|
const handleSelect = (item: EntitySearchResult) => {
|
||||||
setSelectedData(item);
|
setSelectedData(item);
|
||||||
setInputValue(item[displayField] || "");
|
setInputValue(getDisplayValue(item));
|
||||||
|
|
||||||
console.log("🔍 AutocompleteSearchInput handleSelect:", {
|
console.log("🔍 AutocompleteSearchInput handleSelect:", {
|
||||||
item,
|
item,
|
||||||
|
|
@ -239,7 +255,7 @@ export function AutocompleteSearchInputComponent({
|
||||||
onClick={() => handleSelect(item)}
|
onClick={() => handleSelect(item)}
|
||||||
className="w-full px-3 py-2 text-left text-xs transition-colors hover:bg-accent sm:text-sm"
|
className="w-full px-3 py-2 text-left text-xs transition-colors hover:bg-accent sm:text-sm"
|
||||||
>
|
>
|
||||||
<div className="font-medium">{item[displayField]}</div>
|
<div className="font-medium">{getDisplayValue(item)}</div>
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -184,52 +184,118 @@ export function AutocompleteSearchInputConfigPanel({
|
||||||
</Popover>
|
</Popover>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 2. 표시 필드 선택 */}
|
{/* 2. 표시 필드 선택 (다중 선택 가능) */}
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label className="text-xs font-semibold sm:text-sm">2. 표시 필드 *</Label>
|
<Label className="text-xs font-semibold sm:text-sm">2. 표시 필드 * (여러 개 선택 가능)</Label>
|
||||||
<Popover open={openDisplayFieldCombo} onOpenChange={setOpenDisplayFieldCombo}>
|
<div className="space-y-2">
|
||||||
<PopoverTrigger asChild>
|
{/* 선택된 필드 표시 */}
|
||||||
<Button
|
{(localConfig.displayFields && localConfig.displayFields.length > 0) ? (
|
||||||
variant="outline"
|
<div className="flex flex-wrap gap-1 rounded-md border p-2 min-h-[40px]">
|
||||||
role="combobox"
|
{localConfig.displayFields.map((fieldName) => {
|
||||||
aria-expanded={openDisplayFieldCombo}
|
const col = sourceTableColumns.find((c) => c.columnName === fieldName);
|
||||||
className="h-8 w-full justify-between text-xs sm:h-10 sm:text-sm"
|
return (
|
||||||
disabled={!localConfig.tableName || isLoadingSourceColumns}
|
<span
|
||||||
>
|
key={fieldName}
|
||||||
{localConfig.displayField
|
className="inline-flex items-center gap-1 rounded-md bg-primary/10 px-2 py-1 text-xs"
|
||||||
? sourceTableColumns.find((c) => c.columnName === localConfig.displayField)?.displayName || localConfig.displayField
|
>
|
||||||
: isLoadingSourceColumns ? "로딩 중..." : "사용자에게 보여줄 필드"}
|
{col?.displayName || fieldName}
|
||||||
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
<button
|
||||||
</Button>
|
type="button"
|
||||||
</PopoverTrigger>
|
onClick={() => {
|
||||||
<PopoverContent className="p-0" style={{ width: "var(--radix-popover-trigger-width)" }} align="start">
|
const newFields = localConfig.displayFields?.filter((f) => f !== fieldName) || [];
|
||||||
<Command>
|
updateConfig({
|
||||||
<CommandInput placeholder="필드 검색..." className="text-xs sm:text-sm" />
|
displayFields: newFields,
|
||||||
<CommandList>
|
displayField: newFields[0] || "", // 첫 번째 필드를 기본 displayField로
|
||||||
<CommandEmpty className="text-xs sm:text-sm">필드를 찾을 수 없습니다.</CommandEmpty>
|
});
|
||||||
<CommandGroup>
|
|
||||||
{sourceTableColumns.map((column) => (
|
|
||||||
<CommandItem
|
|
||||||
key={column.columnName}
|
|
||||||
value={column.columnName}
|
|
||||||
onSelect={() => {
|
|
||||||
updateConfig({ displayField: column.columnName });
|
|
||||||
setOpenDisplayFieldCombo(false);
|
|
||||||
}}
|
}}
|
||||||
className="text-xs sm:text-sm"
|
className="hover:text-destructive"
|
||||||
>
|
>
|
||||||
<Check className={cn("mr-2 h-4 w-4", localConfig.displayField === column.columnName ? "opacity-100" : "opacity-0")} />
|
<X className="h-3 w-3" />
|
||||||
<div className="flex flex-col">
|
</button>
|
||||||
<span className="font-medium">{column.displayName || column.columnName}</span>
|
</span>
|
||||||
{column.displayName && <span className="text-[10px] text-gray-500">{column.columnName}</span>}
|
);
|
||||||
</div>
|
})}
|
||||||
</CommandItem>
|
</div>
|
||||||
))}
|
) : (
|
||||||
</CommandGroup>
|
<div className="rounded-md border border-dashed p-2 text-center text-xs text-muted-foreground">
|
||||||
</CommandList>
|
아래에서 표시할 필드를 선택하세요
|
||||||
</Command>
|
</div>
|
||||||
</PopoverContent>
|
)}
|
||||||
</Popover>
|
|
||||||
|
{/* 필드 선택 드롭다운 */}
|
||||||
|
<Popover open={openDisplayFieldCombo} onOpenChange={setOpenDisplayFieldCombo}>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
role="combobox"
|
||||||
|
aria-expanded={openDisplayFieldCombo}
|
||||||
|
className="h-8 w-full justify-between text-xs sm:h-10 sm:text-sm"
|
||||||
|
disabled={!localConfig.tableName || isLoadingSourceColumns}
|
||||||
|
>
|
||||||
|
{isLoadingSourceColumns ? "로딩 중..." : "필드 추가..."}
|
||||||
|
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="p-0" style={{ width: "var(--radix-popover-trigger-width)" }} align="start">
|
||||||
|
<Command>
|
||||||
|
<CommandInput placeholder="필드 검색..." className="text-xs sm:text-sm" />
|
||||||
|
<CommandList>
|
||||||
|
<CommandEmpty className="text-xs sm:text-sm">필드를 찾을 수 없습니다.</CommandEmpty>
|
||||||
|
<CommandGroup>
|
||||||
|
{sourceTableColumns.map((column) => {
|
||||||
|
const isSelected = localConfig.displayFields?.includes(column.columnName);
|
||||||
|
return (
|
||||||
|
<CommandItem
|
||||||
|
key={column.columnName}
|
||||||
|
value={column.columnName}
|
||||||
|
onSelect={() => {
|
||||||
|
const currentFields = localConfig.displayFields || [];
|
||||||
|
let newFields: string[];
|
||||||
|
if (isSelected) {
|
||||||
|
newFields = currentFields.filter((f) => f !== column.columnName);
|
||||||
|
} else {
|
||||||
|
newFields = [...currentFields, column.columnName];
|
||||||
|
}
|
||||||
|
updateConfig({
|
||||||
|
displayFields: newFields,
|
||||||
|
displayField: newFields[0] || "", // 첫 번째 필드를 기본 displayField로
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
className="text-xs sm:text-sm"
|
||||||
|
>
|
||||||
|
<Check className={cn("mr-2 h-4 w-4", isSelected ? "opacity-100" : "opacity-0")} />
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<span className="font-medium">{column.displayName || column.columnName}</span>
|
||||||
|
{column.displayName && <span className="text-[10px] text-gray-500">{column.columnName}</span>}
|
||||||
|
</div>
|
||||||
|
</CommandItem>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</CommandGroup>
|
||||||
|
</CommandList>
|
||||||
|
</Command>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
|
||||||
|
{/* 구분자 설정 */}
|
||||||
|
{localConfig.displayFields && localConfig.displayFields.length > 1 && (
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Label className="text-xs whitespace-nowrap">구분자:</Label>
|
||||||
|
<Input
|
||||||
|
value={localConfig.displaySeparator || " → "}
|
||||||
|
onChange={(e) => updateConfig({ displaySeparator: e.target.value })}
|
||||||
|
placeholder=" → "
|
||||||
|
className="h-7 w-20 text-xs text-center"
|
||||||
|
/>
|
||||||
|
<span className="text-xs text-muted-foreground">
|
||||||
|
미리보기: {localConfig.displayFields.map((f) => {
|
||||||
|
const col = sourceTableColumns.find((c) => c.columnName === f);
|
||||||
|
return col?.displayName || f;
|
||||||
|
}).join(localConfig.displaySeparator || " → ")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 3. 저장 대상 테이블 선택 */}
|
{/* 3. 저장 대상 테이블 선택 */}
|
||||||
|
|
@ -419,7 +485,9 @@ export function AutocompleteSearchInputConfigPanel({
|
||||||
<strong>외부 테이블:</strong> {localConfig.tableName}
|
<strong>외부 테이블:</strong> {localConfig.tableName}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>표시 필드:</strong> {localConfig.displayField}
|
<strong>표시 필드:</strong> {localConfig.displayFields?.length
|
||||||
|
? localConfig.displayFields.join(localConfig.displaySeparator || " → ")
|
||||||
|
: localConfig.displayField}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>저장 테이블:</strong> {localConfig.targetTable}
|
<strong>저장 테이블:</strong> {localConfig.targetTable}
|
||||||
|
|
|
||||||
|
|
@ -29,5 +29,8 @@ export interface AutocompleteSearchInputConfig {
|
||||||
fieldMappings?: FieldMapping[]; // 매핑할 필드 목록
|
fieldMappings?: FieldMapping[]; // 매핑할 필드 목록
|
||||||
// 저장 대상 테이블 (간소화 버전)
|
// 저장 대상 테이블 (간소화 버전)
|
||||||
targetTable?: string;
|
targetTable?: string;
|
||||||
|
// 🆕 다중 표시 필드 설정 (여러 컬럼 조합)
|
||||||
|
displayFields?: string[]; // 여러 컬럼을 조합하여 표시
|
||||||
|
displaySeparator?: string; // 구분자 (기본값: " - ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -663,9 +663,29 @@ export const ButtonPrimaryComponent: React.FC<ButtonPrimaryComponentProps> = ({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 🆕 modalDataStore에서 선택된 데이터 가져오기 (분할 패널 등에서 선택한 데이터)
|
||||||
|
let effectiveSelectedRowsData = selectedRowsData;
|
||||||
|
if ((!selectedRowsData || selectedRowsData.length === 0) && effectiveTableName) {
|
||||||
|
try {
|
||||||
|
const { useModalDataStore } = await import("@/stores/modalDataStore");
|
||||||
|
const dataRegistry = useModalDataStore.getState().dataRegistry;
|
||||||
|
const modalData = dataRegistry[effectiveTableName];
|
||||||
|
if (modalData && modalData.length > 0) {
|
||||||
|
effectiveSelectedRowsData = modalData;
|
||||||
|
console.log("🔗 [ButtonPrimaryComponent] modalDataStore에서 선택된 데이터 가져옴:", {
|
||||||
|
tableName: effectiveTableName,
|
||||||
|
count: modalData.length,
|
||||||
|
data: modalData,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.warn("modalDataStore 접근 실패:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 삭제 액션인데 선택된 데이터가 없으면 경고 메시지 표시하고 중단
|
// 삭제 액션인데 선택된 데이터가 없으면 경고 메시지 표시하고 중단
|
||||||
const hasDataToDelete =
|
const hasDataToDelete =
|
||||||
(selectedRowsData && selectedRowsData.length > 0) || (flowSelectedData && flowSelectedData.length > 0);
|
(effectiveSelectedRowsData && effectiveSelectedRowsData.length > 0) || (flowSelectedData && flowSelectedData.length > 0);
|
||||||
|
|
||||||
if (processedConfig.action.type === "delete" && !hasDataToDelete) {
|
if (processedConfig.action.type === "delete" && !hasDataToDelete) {
|
||||||
toast.warning("삭제할 항목을 먼저 선택해주세요.");
|
toast.warning("삭제할 항목을 먼저 선택해주세요.");
|
||||||
|
|
@ -724,9 +744,9 @@ export const ButtonPrimaryComponent: React.FC<ButtonPrimaryComponentProps> = ({
|
||||||
onClose,
|
onClose,
|
||||||
onFlowRefresh, // 플로우 새로고침 콜백 추가
|
onFlowRefresh, // 플로우 새로고침 콜백 추가
|
||||||
onSave: finalOnSave, // 🆕 EditModal의 handleSave 콜백 (props에서도 추출)
|
onSave: finalOnSave, // 🆕 EditModal의 handleSave 콜백 (props에서도 추출)
|
||||||
// 테이블 선택된 행 정보 추가
|
// 테이블 선택된 행 정보 추가 (modalDataStore에서 가져온 데이터 우선)
|
||||||
selectedRows,
|
selectedRows,
|
||||||
selectedRowsData,
|
selectedRowsData: effectiveSelectedRowsData,
|
||||||
// 테이블 정렬 정보 추가
|
// 테이블 정렬 정보 추가
|
||||||
sortBy, // 🆕 정렬 컬럼
|
sortBy, // 🆕 정렬 컬럼
|
||||||
sortOrder, // 🆕 정렬 방향
|
sortOrder, // 🆕 정렬 방향
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,10 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
menuObjid, // 🆕 메뉴 OBJID
|
menuObjid, // 🆕 메뉴 OBJID
|
||||||
...props
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
|
// 🆕 읽기전용/비활성화 상태 확인
|
||||||
|
const isReadonly = (component as any).readonly || (props as any).readonly || componentConfig?.readonly || false;
|
||||||
|
const isDisabled = (component as any).disabled || (props as any).disabled || componentConfig?.disabled || false;
|
||||||
|
const isFieldDisabled = isDesignMode || isReadonly || isDisabled;
|
||||||
// 화면 컨텍스트 (데이터 제공자로 등록)
|
// 화면 컨텍스트 (데이터 제공자로 등록)
|
||||||
const screenContext = useScreenContextOptional();
|
const screenContext = useScreenContextOptional();
|
||||||
|
|
||||||
|
|
@ -327,7 +331,7 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
|
|
||||||
// 클릭 이벤트 핸들러 (React Query로 간소화)
|
// 클릭 이벤트 핸들러 (React Query로 간소화)
|
||||||
const handleToggle = () => {
|
const handleToggle = () => {
|
||||||
if (isDesignMode) return;
|
if (isFieldDisabled) return; // 🆕 읽기전용/비활성화 상태에서는 토글 불가
|
||||||
|
|
||||||
// React Query가 자동으로 캐시 관리하므로 수동 새로고침 불필요
|
// React Query가 자동으로 캐시 관리하므로 수동 새로고침 불필요
|
||||||
setIsOpen(!isOpen);
|
setIsOpen(!isOpen);
|
||||||
|
|
@ -425,7 +429,7 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
value={option.value}
|
value={option.value}
|
||||||
checked={selectedValue === option.value}
|
checked={selectedValue === option.value}
|
||||||
onChange={() => handleOptionSelect(option.value, option.label)}
|
onChange={() => handleOptionSelect(option.value, option.label)}
|
||||||
disabled={isDesignMode}
|
disabled={isFieldDisabled}
|
||||||
className="border-input text-primary focus:ring-ring h-4 w-4"
|
className="border-input text-primary focus:ring-ring h-4 w-4"
|
||||||
/>
|
/>
|
||||||
<span className="text-sm">{option.label}</span>
|
<span className="text-sm">{option.label}</span>
|
||||||
|
|
@ -456,12 +460,14 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
placeholder="코드 또는 코드명 입력..."
|
placeholder="코드 또는 코드명 입력..."
|
||||||
className={cn(
|
className={cn(
|
||||||
"h-10 w-full rounded-lg border border-gray-300 bg-white px-3 py-2 transition-all outline-none",
|
"h-10 w-full rounded-lg border border-gray-300 bg-white px-3 py-2 transition-all outline-none",
|
||||||
!isDesignMode && "hover:border-orange-400 focus:border-orange-500 focus:ring-2 focus:ring-orange-200",
|
!isFieldDisabled && "hover:border-orange-400 focus:border-orange-500 focus:ring-2 focus:ring-orange-200",
|
||||||
isSelected && "ring-2 ring-orange-500",
|
isSelected && "ring-2 ring-orange-500",
|
||||||
|
isFieldDisabled && "bg-gray-100 cursor-not-allowed",
|
||||||
)}
|
)}
|
||||||
readOnly={isDesignMode}
|
readOnly={isFieldDisabled}
|
||||||
|
disabled={isFieldDisabled}
|
||||||
/>
|
/>
|
||||||
{isOpen && !isDesignMode && filteredOptions.length > 0 && (
|
{isOpen && !isFieldDisabled && filteredOptions.length > 0 && (
|
||||||
<div className="absolute z-[99999] mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg">
|
<div className="absolute z-[99999] mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg">
|
||||||
{filteredOptions.map((option, index) => (
|
{filteredOptions.map((option, index) => (
|
||||||
<div
|
<div
|
||||||
|
|
@ -490,13 +496,14 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex h-10 w-full cursor-pointer items-center justify-between rounded-lg border border-gray-300 bg-white px-3 py-2",
|
"flex h-10 w-full items-center justify-between rounded-lg border border-gray-300 bg-white px-3 py-2",
|
||||||
!isDesignMode && "hover:border-orange-400",
|
!isFieldDisabled && "cursor-pointer hover:border-orange-400",
|
||||||
isSelected && "ring-2 ring-orange-500",
|
isSelected && "ring-2 ring-orange-500",
|
||||||
isOpen && "border-orange-500",
|
isOpen && "border-orange-500",
|
||||||
|
isFieldDisabled && "bg-gray-100 cursor-not-allowed",
|
||||||
)}
|
)}
|
||||||
onClick={handleToggle}
|
onClick={handleToggle}
|
||||||
style={{ pointerEvents: isDesignMode ? "none" : "auto" }}
|
style={{ pointerEvents: isFieldDisabled ? "none" : "auto" }}
|
||||||
>
|
>
|
||||||
<span className={selectedLabel ? "text-gray-900" : "text-gray-500"}>{selectedLabel || placeholder}</span>
|
<span className={selectedLabel ? "text-gray-900" : "text-gray-500"}>{selectedLabel || placeholder}</span>
|
||||||
<svg
|
<svg
|
||||||
|
|
@ -508,7 +515,7 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
{isOpen && !isDesignMode && (
|
{isOpen && !isFieldDisabled && (
|
||||||
<div className="absolute z-[99999] mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg">
|
<div className="absolute z-[99999] mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg">
|
||||||
{isLoadingCodes ? (
|
{isLoadingCodes ? (
|
||||||
<div className="bg-white px-3 py-2 text-gray-900">로딩 중...</div>
|
<div className="bg-white px-3 py-2 text-gray-900">로딩 중...</div>
|
||||||
|
|
@ -538,8 +545,9 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"box-border flex h-full w-full flex-wrap gap-2 rounded-lg border border-gray-300 bg-white px-3 py-2",
|
"box-border flex h-full w-full flex-wrap gap-2 rounded-lg border border-gray-300 bg-white px-3 py-2",
|
||||||
!isDesignMode && "hover:border-orange-400",
|
!isFieldDisabled && "hover:border-orange-400",
|
||||||
isSelected && "ring-2 ring-orange-500",
|
isSelected && "ring-2 ring-orange-500",
|
||||||
|
isFieldDisabled && "bg-gray-100 cursor-not-allowed",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{selectedValues.map((val, idx) => {
|
{selectedValues.map((val, idx) => {
|
||||||
|
|
@ -567,8 +575,9 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={selectedValues.length > 0 ? "" : placeholder}
|
placeholder={selectedValues.length > 0 ? "" : placeholder}
|
||||||
className="min-w-[100px] flex-1 border-none bg-transparent outline-none"
|
className="min-w-[100px] flex-1 border-none bg-transparent outline-none"
|
||||||
onClick={() => setIsOpen(true)}
|
onClick={() => !isFieldDisabled && setIsOpen(true)}
|
||||||
readOnly={isDesignMode}
|
readOnly={isFieldDisabled}
|
||||||
|
disabled={isFieldDisabled}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -589,19 +598,22 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
type="text"
|
type="text"
|
||||||
value={searchQuery}
|
value={searchQuery}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
|
if (isFieldDisabled) return;
|
||||||
setSearchQuery(e.target.value);
|
setSearchQuery(e.target.value);
|
||||||
setIsOpen(true);
|
setIsOpen(true);
|
||||||
}}
|
}}
|
||||||
onFocus={() => setIsOpen(true)}
|
onFocus={() => !isFieldDisabled && setIsOpen(true)}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
className={cn(
|
className={cn(
|
||||||
"h-10 w-full rounded-lg border border-gray-300 bg-white px-3 py-2 transition-all outline-none",
|
"h-10 w-full rounded-lg border border-gray-300 bg-white px-3 py-2 transition-all outline-none",
|
||||||
!isDesignMode && "hover:border-orange-400 focus:border-orange-500 focus:ring-2 focus:ring-orange-200",
|
!isFieldDisabled && "hover:border-orange-400 focus:border-orange-500 focus:ring-2 focus:ring-orange-200",
|
||||||
isSelected && "ring-2 ring-orange-500",
|
isSelected && "ring-2 ring-orange-500",
|
||||||
|
isFieldDisabled && "bg-gray-100 cursor-not-allowed",
|
||||||
)}
|
)}
|
||||||
readOnly={isDesignMode}
|
readOnly={isFieldDisabled}
|
||||||
|
disabled={isFieldDisabled}
|
||||||
/>
|
/>
|
||||||
{isOpen && !isDesignMode && filteredOptions.length > 0 && (
|
{isOpen && !isFieldDisabled && filteredOptions.length > 0 && (
|
||||||
<div className="absolute z-[99999] mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg">
|
<div className="absolute z-[99999] mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg">
|
||||||
{filteredOptions.map((option, index) => (
|
{filteredOptions.map((option, index) => (
|
||||||
<div
|
<div
|
||||||
|
|
@ -632,13 +644,14 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex h-10 w-full cursor-pointer items-center justify-between rounded-lg border border-gray-300 bg-white px-3 py-2",
|
"flex h-10 w-full items-center justify-between rounded-lg border border-gray-300 bg-white px-3 py-2",
|
||||||
!isDesignMode && "hover:border-orange-400",
|
!isFieldDisabled && "cursor-pointer hover:border-orange-400",
|
||||||
isSelected && "ring-2 ring-orange-500",
|
isSelected && "ring-2 ring-orange-500",
|
||||||
isOpen && "border-orange-500",
|
isOpen && "border-orange-500",
|
||||||
|
isFieldDisabled && "bg-gray-100 cursor-not-allowed",
|
||||||
)}
|
)}
|
||||||
onClick={handleToggle}
|
onClick={handleToggle}
|
||||||
style={{ pointerEvents: isDesignMode ? "none" : "auto" }}
|
style={{ pointerEvents: isFieldDisabled ? "none" : "auto" }}
|
||||||
>
|
>
|
||||||
<span className={selectedLabel ? "text-gray-900" : "text-gray-500"}>{selectedLabel || placeholder}</span>
|
<span className={selectedLabel ? "text-gray-900" : "text-gray-500"}>{selectedLabel || placeholder}</span>
|
||||||
<svg
|
<svg
|
||||||
|
|
@ -650,7 +663,7 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
{isOpen && !isDesignMode && (
|
{isOpen && !isFieldDisabled && (
|
||||||
<div className="absolute z-[99999] mt-1 w-full rounded-md border border-gray-300 bg-white shadow-lg">
|
<div className="absolute z-[99999] mt-1 w-full rounded-md border border-gray-300 bg-white shadow-lg">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
|
@ -690,12 +703,13 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"box-border flex w-full flex-wrap items-center gap-2 rounded-lg border border-gray-300 bg-white px-3 py-2",
|
"box-border flex w-full flex-wrap items-center gap-2 rounded-lg border border-gray-300 bg-white px-3 py-2",
|
||||||
!isDesignMode && "hover:border-orange-400",
|
!isFieldDisabled && "hover:border-orange-400",
|
||||||
isSelected && "ring-2 ring-orange-500",
|
isSelected && "ring-2 ring-orange-500",
|
||||||
|
isFieldDisabled && "bg-gray-100 cursor-not-allowed",
|
||||||
)}
|
)}
|
||||||
onClick={() => !isDesignMode && setIsOpen(true)}
|
onClick={() => !isFieldDisabled && setIsOpen(true)}
|
||||||
style={{
|
style={{
|
||||||
pointerEvents: isDesignMode ? "none" : "auto",
|
pointerEvents: isFieldDisabled ? "none" : "auto",
|
||||||
height: "100%"
|
height: "100%"
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
@ -726,7 +740,7 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
<span className="text-gray-500">{placeholder}</span>
|
<span className="text-gray-500">{placeholder}</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{isOpen && !isDesignMode && (
|
{isOpen && !isFieldDisabled && (
|
||||||
<div className="absolute z-[99999] mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg">
|
<div className="absolute z-[99999] mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg">
|
||||||
{(isLoadingCodes || isLoadingCategories) ? (
|
{(isLoadingCodes || isLoadingCategories) ? (
|
||||||
<div className="bg-white px-3 py-2 text-gray-900">로딩 중...</div>
|
<div className="bg-white px-3 py-2 text-gray-900">로딩 중...</div>
|
||||||
|
|
@ -789,13 +803,14 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex h-10 w-full cursor-pointer items-center justify-between rounded-lg border border-gray-300 bg-white px-3 py-2",
|
"flex h-10 w-full items-center justify-between rounded-lg border border-gray-300 bg-white px-3 py-2",
|
||||||
!isDesignMode && "hover:border-orange-400",
|
!isFieldDisabled && "cursor-pointer hover:border-orange-400",
|
||||||
isSelected && "ring-2 ring-orange-500",
|
isSelected && "ring-2 ring-orange-500",
|
||||||
isOpen && "border-orange-500",
|
isOpen && "border-orange-500",
|
||||||
|
isFieldDisabled && "bg-gray-100 cursor-not-allowed",
|
||||||
)}
|
)}
|
||||||
onClick={handleToggle}
|
onClick={handleToggle}
|
||||||
style={{ pointerEvents: isDesignMode ? "none" : "auto" }}
|
style={{ pointerEvents: isFieldDisabled ? "none" : "auto" }}
|
||||||
>
|
>
|
||||||
<span className={selectedLabel ? "text-gray-900" : "text-gray-500"}>{selectedLabel || placeholder}</span>
|
<span className={selectedLabel ? "text-gray-900" : "text-gray-500"}>{selectedLabel || placeholder}</span>
|
||||||
<svg
|
<svg
|
||||||
|
|
@ -807,7 +822,7 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
{isOpen && !isDesignMode && (
|
{isOpen && !isFieldDisabled && (
|
||||||
<div className="absolute z-[99999] mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg">
|
<div className="absolute z-[99999] mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg">
|
||||||
{isLoadingCodes ? (
|
{isLoadingCodes ? (
|
||||||
<div className="bg-white px-3 py-2 text-gray-900">로딩 중...</div>
|
<div className="bg-white px-3 py-2 text-gray-900">로딩 중...</div>
|
||||||
|
|
|
||||||
|
|
@ -293,8 +293,17 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
|
||||||
) => {
|
) => {
|
||||||
if (value === null || value === undefined) return "-";
|
if (value === null || value === undefined) return "-";
|
||||||
|
|
||||||
// 카테고리 매핑이 있는지 확인
|
// 🆕 카테고리 매핑 찾기 (여러 키 형태 시도)
|
||||||
const mapping = categoryMappings[columnName];
|
// 1. 전체 컬럼명 (예: "item_info.material")
|
||||||
|
// 2. 컬럼명만 (예: "material")
|
||||||
|
let mapping = categoryMappings[columnName];
|
||||||
|
|
||||||
|
if (!mapping && columnName.includes(".")) {
|
||||||
|
// 조인된 컬럼의 경우 컬럼명만으로 다시 시도
|
||||||
|
const simpleColumnName = columnName.split(".").pop() || columnName;
|
||||||
|
mapping = categoryMappings[simpleColumnName];
|
||||||
|
}
|
||||||
|
|
||||||
if (mapping && mapping[String(value)]) {
|
if (mapping && mapping[String(value)]) {
|
||||||
const categoryData = mapping[String(value)];
|
const categoryData = mapping[String(value)];
|
||||||
const displayLabel = categoryData.label || String(value);
|
const displayLabel = categoryData.label || String(value);
|
||||||
|
|
@ -690,43 +699,69 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
|
||||||
loadLeftCategoryMappings();
|
loadLeftCategoryMappings();
|
||||||
}, [componentConfig.leftPanel?.tableName, isDesignMode]);
|
}, [componentConfig.leftPanel?.tableName, isDesignMode]);
|
||||||
|
|
||||||
// 우측 테이블 카테고리 매핑 로드
|
// 우측 테이블 카테고리 매핑 로드 (조인된 테이블 포함)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadRightCategoryMappings = async () => {
|
const loadRightCategoryMappings = async () => {
|
||||||
const rightTableName = componentConfig.rightPanel?.tableName;
|
const rightTableName = componentConfig.rightPanel?.tableName;
|
||||||
if (!rightTableName || isDesignMode) return;
|
if (!rightTableName || isDesignMode) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 1. 컬럼 메타 정보 조회
|
|
||||||
const columnsResponse = await tableTypeApi.getColumns(rightTableName);
|
|
||||||
const categoryColumns = columnsResponse.filter((col: any) => col.inputType === "category");
|
|
||||||
|
|
||||||
if (categoryColumns.length === 0) {
|
|
||||||
setRightCategoryMappings({});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 각 카테고리 컬럼에 대한 값 조회
|
|
||||||
const mappings: Record<string, Record<string, { label: string; color?: string }>> = {};
|
const mappings: Record<string, Record<string, { label: string; color?: string }>> = {};
|
||||||
|
|
||||||
for (const col of categoryColumns) {
|
// 🆕 우측 패널 컬럼 설정에서 조인된 테이블 추출
|
||||||
const columnName = col.columnName || col.column_name;
|
const rightColumns = componentConfig.rightPanel?.columns || [];
|
||||||
try {
|
const tablesToLoad = new Set<string>([rightTableName]);
|
||||||
const response = await apiClient.get(`/table-categories/${rightTableName}/${columnName}/values`);
|
|
||||||
|
|
||||||
if (response.data.success && response.data.data) {
|
// 컬럼명에서 테이블명 추출 (예: "item_info.material" -> "item_info")
|
||||||
const valueMap: Record<string, { label: string; color?: string }> = {};
|
rightColumns.forEach((col: any) => {
|
||||||
response.data.data.forEach((item: any) => {
|
const colName = col.name || col.columnName;
|
||||||
valueMap[item.value_code || item.valueCode] = {
|
if (colName && colName.includes(".")) {
|
||||||
label: item.value_label || item.valueLabel,
|
const joinTableName = colName.split(".")[0];
|
||||||
color: item.color,
|
tablesToLoad.add(joinTableName);
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
mappings[columnName] = valueMap;
|
|
||||||
console.log(`✅ 우측 카테고리 매핑 로드 [${columnName}]:`, valueMap);
|
console.log("🔍 우측 패널 카테고리 로드 대상 테이블:", Array.from(tablesToLoad));
|
||||||
|
|
||||||
|
// 각 테이블에 대해 카테고리 매핑 로드
|
||||||
|
for (const tableName of tablesToLoad) {
|
||||||
|
try {
|
||||||
|
// 1. 컬럼 메타 정보 조회
|
||||||
|
const columnsResponse = await tableTypeApi.getColumns(tableName);
|
||||||
|
const categoryColumns = columnsResponse.filter((col: any) => col.inputType === "category");
|
||||||
|
|
||||||
|
// 2. 각 카테고리 컬럼에 대한 값 조회
|
||||||
|
for (const col of categoryColumns) {
|
||||||
|
const columnName = col.columnName || col.column_name;
|
||||||
|
try {
|
||||||
|
const response = await apiClient.get(`/table-categories/${tableName}/${columnName}/values`);
|
||||||
|
|
||||||
|
if (response.data.success && response.data.data) {
|
||||||
|
const valueMap: Record<string, { label: string; color?: string }> = {};
|
||||||
|
response.data.data.forEach((item: any) => {
|
||||||
|
valueMap[item.value_code || item.valueCode] = {
|
||||||
|
label: item.value_label || item.valueLabel,
|
||||||
|
color: item.color,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
// 조인된 테이블의 경우 "테이블명.컬럼명" 형태로 저장
|
||||||
|
const mappingKey = tableName === rightTableName ? columnName : `${tableName}.${columnName}`;
|
||||||
|
mappings[mappingKey] = valueMap;
|
||||||
|
|
||||||
|
// 🆕 컬럼명만으로도 접근할 수 있도록 추가 저장 (모든 테이블)
|
||||||
|
// 기존 매핑이 있으면 병합, 없으면 새로 생성
|
||||||
|
mappings[columnName] = { ...(mappings[columnName] || {}), ...valueMap };
|
||||||
|
|
||||||
|
console.log(`✅ 우측 카테고리 매핑 로드 [${mappingKey}]:`, valueMap);
|
||||||
|
console.log(`✅ 우측 카테고리 매핑 (컬럼명만) [${columnName}]:`, mappings[columnName]);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`우측 카테고리 값 조회 실패 [${tableName}.${columnName}]:`, error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`우측 카테고리 값 조회 실패 [${columnName}]:`, error);
|
console.error(`테이블 ${tableName} 컬럼 정보 조회 실패:`, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -737,7 +772,7 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
|
||||||
};
|
};
|
||||||
|
|
||||||
loadRightCategoryMappings();
|
loadRightCategoryMappings();
|
||||||
}, [componentConfig.rightPanel?.tableName, isDesignMode]);
|
}, [componentConfig.rightPanel?.tableName, componentConfig.rightPanel?.columns, isDesignMode]);
|
||||||
|
|
||||||
// 항목 펼치기/접기 토글
|
// 항목 펼치기/접기 토글
|
||||||
const toggleExpand = useCallback((itemId: any) => {
|
const toggleExpand = useCallback((itemId: any) => {
|
||||||
|
|
@ -2149,9 +2184,12 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
|
||||||
const format = colConfig?.format;
|
const format = colConfig?.format;
|
||||||
const boldValue = colConfig?.bold ?? false;
|
const boldValue = colConfig?.bold ?? false;
|
||||||
|
|
||||||
// 숫자 포맷 적용
|
// 🆕 카테고리 매핑 적용
|
||||||
let displayValue = String(value || "-");
|
const formattedValue = formatCellValue(key, value, rightCategoryMappings);
|
||||||
if (value !== null && value !== undefined && value !== "" && format) {
|
|
||||||
|
// 숫자 포맷 적용 (카테고리가 아닌 경우만)
|
||||||
|
let displayValue: React.ReactNode = formattedValue;
|
||||||
|
if (typeof formattedValue === 'string' && value !== null && value !== undefined && value !== "" && format) {
|
||||||
const numValue = typeof value === 'number' ? value : parseFloat(String(value));
|
const numValue = typeof value === 'number' ? value : parseFloat(String(value));
|
||||||
if (!isNaN(numValue)) {
|
if (!isNaN(numValue)) {
|
||||||
displayValue = numValue.toLocaleString('ko-KR', {
|
displayValue = numValue.toLocaleString('ko-KR', {
|
||||||
|
|
@ -2175,7 +2213,6 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
|
||||||
)}
|
)}
|
||||||
<span
|
<span
|
||||||
className={`text-foreground text-sm ${boldValue ? 'font-semibold' : ''}`}
|
className={`text-foreground text-sm ${boldValue ? 'font-semibold' : ''}`}
|
||||||
title={displayValue}
|
|
||||||
>
|
>
|
||||||
{displayValue}
|
{displayValue}
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -2240,9 +2277,12 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
|
||||||
const colConfig = rightColumns?.find(c => c.name === key);
|
const colConfig = rightColumns?.find(c => c.name === key);
|
||||||
const format = colConfig?.format;
|
const format = colConfig?.format;
|
||||||
|
|
||||||
// 숫자 포맷 적용
|
// 🆕 카테고리 매핑 적용
|
||||||
let displayValue = String(value);
|
const formattedValue = formatCellValue(key, value, rightCategoryMappings);
|
||||||
if (value !== null && value !== undefined && value !== "" && format) {
|
|
||||||
|
// 숫자 포맷 적용 (카테고리가 아닌 경우만)
|
||||||
|
let displayValue: React.ReactNode = formattedValue;
|
||||||
|
if (typeof formattedValue === 'string' && value !== null && value !== undefined && value !== "" && format) {
|
||||||
const numValue = typeof value === 'number' ? value : parseFloat(String(value));
|
const numValue = typeof value === 'number' ? value : parseFloat(String(value));
|
||||||
if (!isNaN(numValue)) {
|
if (!isNaN(numValue)) {
|
||||||
displayValue = numValue.toLocaleString('ko-KR', {
|
displayValue = numValue.toLocaleString('ko-KR', {
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,7 @@ export const TableListComponent: React.FC<TableListComponentProps> = ({
|
||||||
config,
|
config,
|
||||||
className,
|
className,
|
||||||
style,
|
style,
|
||||||
|
formData: propFormData, // 🆕 부모에서 전달받은 formData
|
||||||
onFormDataChange,
|
onFormDataChange,
|
||||||
componentConfig,
|
componentConfig,
|
||||||
onSelectedRowsChange,
|
onSelectedRowsChange,
|
||||||
|
|
@ -1183,13 +1184,74 @@ export const TableListComponent: React.FC<TableListComponentProps> = ({
|
||||||
referenceTable: col.additionalJoinInfo!.referenceTable,
|
referenceTable: col.additionalJoinInfo!.referenceTable,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// console.log("🔍 [TableList] API 호출 시작", {
|
// 🎯 화면별 엔티티 표시 설정 수집
|
||||||
// tableName: tableConfig.selectedTable,
|
const screenEntityConfigs: Record<string, any> = {};
|
||||||
// page,
|
(tableConfig.columns || [])
|
||||||
// pageSize,
|
.filter((col) => col.entityDisplayConfig && col.entityDisplayConfig.displayColumns?.length > 0)
|
||||||
// sortBy,
|
.forEach((col) => {
|
||||||
// sortOrder,
|
screenEntityConfigs[col.columnName] = {
|
||||||
// });
|
displayColumns: col.entityDisplayConfig!.displayColumns,
|
||||||
|
separator: col.entityDisplayConfig!.separator || " - ",
|
||||||
|
sourceTable: col.entityDisplayConfig!.sourceTable || tableConfig.selectedTable,
|
||||||
|
joinTable: col.entityDisplayConfig!.joinTable,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("🎯 [TableList] 화면별 엔티티 설정:", screenEntityConfigs);
|
||||||
|
|
||||||
|
// 🆕 제외 필터 처리 (다른 테이블에 이미 존재하는 데이터 제외)
|
||||||
|
let excludeFilterParam: any = undefined;
|
||||||
|
if (tableConfig.excludeFilter?.enabled) {
|
||||||
|
const excludeConfig = tableConfig.excludeFilter;
|
||||||
|
let filterValue: any = undefined;
|
||||||
|
|
||||||
|
// 필터 값 소스에 따라 값 가져오기 (우선순위: formData > URL > 분할패널)
|
||||||
|
if (excludeConfig.filterColumn && excludeConfig.filterValueField) {
|
||||||
|
const fieldName = excludeConfig.filterValueField;
|
||||||
|
|
||||||
|
// 1순위: props로 전달받은 formData에서 값 가져오기 (모달에서 사용)
|
||||||
|
if (propFormData && propFormData[fieldName]) {
|
||||||
|
filterValue = propFormData[fieldName];
|
||||||
|
console.log("🔗 [TableList] formData에서 excludeFilter 값 가져오기:", {
|
||||||
|
field: fieldName,
|
||||||
|
value: filterValue,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 2순위: URL 파라미터에서 값 가져오기
|
||||||
|
else if (typeof window !== "undefined") {
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
filterValue = urlParams.get(fieldName);
|
||||||
|
if (filterValue) {
|
||||||
|
console.log("🔗 [TableList] URL에서 excludeFilter 값 가져오기:", {
|
||||||
|
field: fieldName,
|
||||||
|
value: filterValue,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 3순위: 분할 패널 부모 데이터에서 값 가져오기
|
||||||
|
if (!filterValue && splitPanelContext?.selectedLeftData) {
|
||||||
|
filterValue = splitPanelContext.selectedLeftData[fieldName];
|
||||||
|
if (filterValue) {
|
||||||
|
console.log("🔗 [TableList] 분할패널에서 excludeFilter 값 가져오기:", {
|
||||||
|
field: fieldName,
|
||||||
|
value: filterValue,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filterValue || !excludeConfig.filterColumn) {
|
||||||
|
excludeFilterParam = {
|
||||||
|
enabled: true,
|
||||||
|
referenceTable: excludeConfig.referenceTable,
|
||||||
|
referenceColumn: excludeConfig.referenceColumn,
|
||||||
|
sourceColumn: excludeConfig.sourceColumn,
|
||||||
|
filterColumn: excludeConfig.filterColumn,
|
||||||
|
filterValue: filterValue,
|
||||||
|
};
|
||||||
|
console.log("🚫 [TableList] 제외 필터 적용:", excludeFilterParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 🎯 항상 entityJoinApi 사용 (writer 컬럼 자동 조인 지원)
|
// 🎯 항상 entityJoinApi 사용 (writer 컬럼 자동 조인 지원)
|
||||||
response = await entityJoinApi.getTableDataWithJoins(tableConfig.selectedTable, {
|
response = await entityJoinApi.getTableDataWithJoins(tableConfig.selectedTable, {
|
||||||
|
|
@ -1200,7 +1262,9 @@ export const TableListComponent: React.FC<TableListComponentProps> = ({
|
||||||
search: hasFilters ? filters : undefined,
|
search: hasFilters ? filters : undefined,
|
||||||
enableEntityJoin: true,
|
enableEntityJoin: true,
|
||||||
additionalJoinColumns: entityJoinColumns.length > 0 ? entityJoinColumns : undefined,
|
additionalJoinColumns: entityJoinColumns.length > 0 ? entityJoinColumns : undefined,
|
||||||
|
screenEntityConfigs: Object.keys(screenEntityConfigs).length > 0 ? screenEntityConfigs : undefined, // 🎯 화면별 엔티티 설정 전달
|
||||||
dataFilter: tableConfig.dataFilter, // 🆕 데이터 필터 전달
|
dataFilter: tableConfig.dataFilter, // 🆕 데이터 필터 전달
|
||||||
|
excludeFilter: excludeFilterParam, // 🆕 제외 필터 전달
|
||||||
});
|
});
|
||||||
|
|
||||||
// 실제 데이터의 item_number만 추출하여 중복 확인
|
// 실제 데이터의 item_number만 추출하여 중복 확인
|
||||||
|
|
@ -1756,33 +1820,46 @@ export const TableListComponent: React.FC<TableListComponentProps> = ({
|
||||||
|
|
||||||
const formatCellValue = useCallback(
|
const formatCellValue = useCallback(
|
||||||
(value: any, column: ColumnConfig, rowData?: Record<string, any>) => {
|
(value: any, column: ColumnConfig, rowData?: Record<string, any>) => {
|
||||||
if (value === null || value === undefined) return "-";
|
// 🎯 엔티티 컬럼 표시 설정이 있는 경우 - value가 null이어도 rowData에서 조합 가능
|
||||||
|
// 이 체크를 가장 먼저 수행 (null 체크보다 앞에)
|
||||||
// 🎯 writer 컬럼 자동 변환: user_id -> user_name
|
|
||||||
if (column.columnName === "writer" && rowData && rowData.writer_name) {
|
|
||||||
return rowData.writer_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 🎯 엔티티 컬럼 표시 설정이 있는 경우
|
|
||||||
if (column.entityDisplayConfig && rowData) {
|
if (column.entityDisplayConfig && rowData) {
|
||||||
// displayColumns 또는 selectedColumns 둘 다 체크
|
const displayColumns = column.entityDisplayConfig.displayColumns || (column.entityDisplayConfig as any).selectedColumns;
|
||||||
const displayColumns = column.entityDisplayConfig.displayColumns || column.entityDisplayConfig.selectedColumns;
|
|
||||||
const separator = column.entityDisplayConfig.separator;
|
const separator = column.entityDisplayConfig.separator;
|
||||||
|
|
||||||
if (displayColumns && displayColumns.length > 0) {
|
if (displayColumns && displayColumns.length > 0) {
|
||||||
// 선택된 컬럼들의 값을 구분자로 조합
|
// 선택된 컬럼들의 값을 구분자로 조합
|
||||||
const values = displayColumns
|
const values = displayColumns
|
||||||
.map((colName) => {
|
.map((colName: string) => {
|
||||||
const cellValue = rowData[colName];
|
// 1. 먼저 직접 컬럼명으로 시도 (기본 테이블 컬럼인 경우)
|
||||||
|
let cellValue = rowData[colName];
|
||||||
|
|
||||||
|
// 2. 없으면 ${sourceColumn}_${colName} 형식으로 시도 (조인 테이블 컬럼인 경우)
|
||||||
|
if (cellValue === null || cellValue === undefined) {
|
||||||
|
const joinedKey = `${column.columnName}_${colName}`;
|
||||||
|
cellValue = rowData[joinedKey];
|
||||||
|
}
|
||||||
|
|
||||||
if (cellValue === null || cellValue === undefined) return "";
|
if (cellValue === null || cellValue === undefined) return "";
|
||||||
return String(cellValue);
|
return String(cellValue);
|
||||||
})
|
})
|
||||||
.filter((v) => v !== ""); // 빈 값 제외
|
.filter((v: string) => v !== ""); // 빈 값 제외
|
||||||
|
|
||||||
return values.join(separator || " - ");
|
const result = values.join(separator || " - ");
|
||||||
|
if (result) {
|
||||||
|
return result; // 결과가 있으면 반환
|
||||||
|
}
|
||||||
|
// 결과가 비어있으면 아래로 계속 진행 (원래 값 사용)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// value가 null/undefined면 "-" 반환
|
||||||
|
if (value === null || value === undefined) return "-";
|
||||||
|
|
||||||
|
// 🎯 writer 컬럼 자동 변환: user_id -> user_name
|
||||||
|
if (column.columnName === "writer" && rowData && rowData.writer_name) {
|
||||||
|
return rowData.writer_name;
|
||||||
|
}
|
||||||
|
|
||||||
const meta = columnMeta[column.columnName];
|
const meta = columnMeta[column.columnName];
|
||||||
|
|
||||||
// inputType 기반 포맷팅 (columnMeta에서 가져온 inputType 우선)
|
// inputType 기반 포맷팅 (columnMeta에서 가져온 inputType 우선)
|
||||||
|
|
@ -1906,12 +1983,16 @@ export const TableListComponent: React.FC<TableListComponentProps> = ({
|
||||||
return "-";
|
return "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 숫자 타입 포맷팅
|
// 숫자 타입 포맷팅 (천단위 구분자 설정 확인)
|
||||||
if (inputType === "number" || inputType === "decimal") {
|
if (inputType === "number" || inputType === "decimal") {
|
||||||
if (value !== null && value !== undefined && value !== "") {
|
if (value !== null && value !== undefined && value !== "") {
|
||||||
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
||||||
if (!isNaN(numValue)) {
|
if (!isNaN(numValue)) {
|
||||||
return numValue.toLocaleString("ko-KR");
|
// thousandSeparator가 false가 아닌 경우(기본값 true) 천단위 구분자 적용
|
||||||
|
if (column.thousandSeparator !== false) {
|
||||||
|
return numValue.toLocaleString("ko-KR");
|
||||||
|
}
|
||||||
|
return String(numValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return String(value);
|
return String(value);
|
||||||
|
|
@ -1922,7 +2003,11 @@ export const TableListComponent: React.FC<TableListComponentProps> = ({
|
||||||
if (value !== null && value !== undefined && value !== "") {
|
if (value !== null && value !== undefined && value !== "") {
|
||||||
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
||||||
if (!isNaN(numValue)) {
|
if (!isNaN(numValue)) {
|
||||||
return numValue.toLocaleString("ko-KR");
|
// thousandSeparator가 false가 아닌 경우(기본값 true) 천단위 구분자 적용
|
||||||
|
if (column.thousandSeparator !== false) {
|
||||||
|
return numValue.toLocaleString("ko-KR");
|
||||||
|
}
|
||||||
|
return String(numValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return String(value);
|
return String(value);
|
||||||
|
|
@ -1939,10 +2024,15 @@ export const TableListComponent: React.FC<TableListComponentProps> = ({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "-";
|
return "-";
|
||||||
case "number":
|
|
||||||
return typeof value === "number" ? value.toLocaleString() : value;
|
|
||||||
case "currency":
|
case "currency":
|
||||||
return typeof value === "number" ? `₩${value.toLocaleString()}` : value;
|
if (typeof value === "number") {
|
||||||
|
// thousandSeparator가 false가 아닌 경우(기본값 true) 천단위 구분자 적용
|
||||||
|
if (column.thousandSeparator !== false) {
|
||||||
|
return `₩${value.toLocaleString()}`;
|
||||||
|
}
|
||||||
|
return `₩${value}`;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
case "boolean":
|
case "boolean":
|
||||||
return value ? "예" : "아니오";
|
return value ? "예" : "아니오";
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import { Badge } from "@/components/ui/badge";
|
||||||
import { TableListConfig, ColumnConfig } from "./types";
|
import { TableListConfig, ColumnConfig } from "./types";
|
||||||
import { entityJoinApi } from "@/lib/api/entityJoin";
|
import { entityJoinApi } from "@/lib/api/entityJoin";
|
||||||
import { tableTypeApi } from "@/lib/api/screen";
|
import { tableTypeApi } from "@/lib/api/screen";
|
||||||
|
import { tableManagementApi } from "@/lib/api/tableManagement";
|
||||||
import { Plus, Trash2, ArrowUp, ArrowDown, ChevronsUpDown, Check } from "lucide-react";
|
import { Plus, Trash2, ArrowUp, ArrowDown, ChevronsUpDown, Check } from "lucide-react";
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||||
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@/components/ui/command";
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@/components/ui/command";
|
||||||
|
|
@ -73,6 +74,12 @@ export const TableListConfigPanel: React.FC<TableListConfigPanelProps> = ({
|
||||||
|
|
||||||
const [loadingEntityJoins, setLoadingEntityJoins] = useState(false);
|
const [loadingEntityJoins, setLoadingEntityJoins] = useState(false);
|
||||||
|
|
||||||
|
// 🆕 제외 필터용 참조 테이블 컬럼 목록
|
||||||
|
const [referenceTableColumns, setReferenceTableColumns] = useState<
|
||||||
|
Array<{ columnName: string; dataType: string; label?: string }>
|
||||||
|
>([]);
|
||||||
|
const [loadingReferenceColumns, setLoadingReferenceColumns] = useState(false);
|
||||||
|
|
||||||
// 🔄 외부에서 config가 변경될 때 내부 상태 동기화 (표의 페이지네이션 변경 감지)
|
// 🔄 외부에서 config가 변경될 때 내부 상태 동기화 (표의 페이지네이션 변경 감지)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// console.log("🔄 TableListConfigPanel - 외부 config 변경 감지:", {
|
// console.log("🔄 TableListConfigPanel - 외부 config 변경 감지:", {
|
||||||
|
|
@ -237,6 +244,42 @@ export const TableListConfigPanel: React.FC<TableListConfigPanelProps> = ({
|
||||||
fetchEntityJoinColumns();
|
fetchEntityJoinColumns();
|
||||||
}, [config.selectedTable, screenTableName]);
|
}, [config.selectedTable, screenTableName]);
|
||||||
|
|
||||||
|
// 🆕 제외 필터용 참조 테이블 컬럼 가져오기
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchReferenceColumns = async () => {
|
||||||
|
const refTable = config.excludeFilter?.referenceTable;
|
||||||
|
if (!refTable) {
|
||||||
|
setReferenceTableColumns([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setLoadingReferenceColumns(true);
|
||||||
|
try {
|
||||||
|
console.log("🔗 참조 테이블 컬럼 정보 가져오기:", refTable);
|
||||||
|
const result = await tableManagementApi.getColumnList(refTable);
|
||||||
|
if (result.success && result.data) {
|
||||||
|
// result.data는 { columns: [], total, page, size, totalPages } 형태
|
||||||
|
const columns = result.data.columns || [];
|
||||||
|
setReferenceTableColumns(
|
||||||
|
columns.map((col: any) => ({
|
||||||
|
columnName: col.columnName || col.column_name,
|
||||||
|
dataType: col.dataType || col.data_type || "text",
|
||||||
|
label: col.displayName || col.columnLabel || col.column_label || col.columnName || col.column_name,
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
console.log("✅ 참조 테이블 컬럼 로드 완료:", columns.length, "개");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("❌ 참조 테이블 컬럼 조회 오류:", error);
|
||||||
|
setReferenceTableColumns([]);
|
||||||
|
} finally {
|
||||||
|
setLoadingReferenceColumns(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchReferenceColumns();
|
||||||
|
}, [config.excludeFilter?.referenceTable]);
|
||||||
|
|
||||||
// 🎯 엔티티 컬럼 자동 로드
|
// 🎯 엔티티 컬럼 자동 로드
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const entityColumns = config.columns?.filter((col) => col.isEntityJoin && col.entityDisplayConfig);
|
const entityColumns = config.columns?.filter((col) => col.isEntityJoin && col.entityDisplayConfig);
|
||||||
|
|
@ -467,42 +510,22 @@ export const TableListConfigPanel: React.FC<TableListConfigPanelProps> = ({
|
||||||
|
|
||||||
// 🎯 엔티티 컬럼의 표시 컬럼 정보 로드
|
// 🎯 엔티티 컬럼의 표시 컬럼 정보 로드
|
||||||
const loadEntityDisplayConfig = async (column: ColumnConfig) => {
|
const loadEntityDisplayConfig = async (column: ColumnConfig) => {
|
||||||
if (!column.isEntityJoin || !column.entityJoinInfo) {
|
const configKey = `${column.columnName}`;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// entityDisplayConfig가 없으면 초기화
|
// 이미 로드된 경우 스킵
|
||||||
if (!column.entityDisplayConfig) {
|
if (entityDisplayConfigs[configKey]) return;
|
||||||
// sourceTable을 결정: entityJoinInfo -> config.selectedTable -> screenTableName 순서
|
|
||||||
const initialSourceTable = column.entityJoinInfo?.sourceTable || config.selectedTable || screenTableName;
|
|
||||||
|
|
||||||
if (!initialSourceTable) {
|
if (!column.isEntityJoin) {
|
||||||
return;
|
// 엔티티 컬럼이 아니면 빈 상태로 설정하여 로딩 상태 해제
|
||||||
}
|
setEntityDisplayConfigs((prev) => ({
|
||||||
|
...prev,
|
||||||
const updatedColumns = config.columns?.map((col) => {
|
[configKey]: {
|
||||||
if (col.columnName === column.columnName) {
|
sourceColumns: [],
|
||||||
return {
|
joinColumns: [],
|
||||||
...col,
|
selectedColumns: [],
|
||||||
entityDisplayConfig: {
|
separator: " - ",
|
||||||
displayColumns: [],
|
},
|
||||||
separator: " - ",
|
}));
|
||||||
sourceTable: initialSourceTable,
|
|
||||||
joinTable: "",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return col;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (updatedColumns) {
|
|
||||||
handleChange("columns", updatedColumns);
|
|
||||||
// 업데이트된 컬럼으로 다시 시도
|
|
||||||
const updatedColumn = updatedColumns.find((col) => col.columnName === column.columnName);
|
|
||||||
if (updatedColumn) {
|
|
||||||
return loadEntityDisplayConfig(updatedColumn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -512,32 +535,56 @@ export const TableListConfigPanel: React.FC<TableListConfigPanelProps> = ({
|
||||||
// 3. config.selectedTable
|
// 3. config.selectedTable
|
||||||
// 4. screenTableName
|
// 4. screenTableName
|
||||||
const sourceTable =
|
const sourceTable =
|
||||||
column.entityDisplayConfig.sourceTable ||
|
column.entityDisplayConfig?.sourceTable ||
|
||||||
column.entityJoinInfo?.sourceTable ||
|
column.entityJoinInfo?.sourceTable ||
|
||||||
config.selectedTable ||
|
config.selectedTable ||
|
||||||
screenTableName;
|
screenTableName;
|
||||||
|
|
||||||
let joinTable = column.entityDisplayConfig.joinTable;
|
// sourceTable이 비어있으면 빈 상태로 설정
|
||||||
|
|
||||||
// sourceTable이 여전히 비어있으면 에러
|
|
||||||
if (!sourceTable) {
|
if (!sourceTable) {
|
||||||
|
console.warn("⚠️ sourceTable을 찾을 수 없음:", column.columnName);
|
||||||
|
setEntityDisplayConfigs((prev) => ({
|
||||||
|
...prev,
|
||||||
|
[configKey]: {
|
||||||
|
sourceColumns: [],
|
||||||
|
joinColumns: [],
|
||||||
|
selectedColumns: column.entityDisplayConfig?.displayColumns || [],
|
||||||
|
separator: column.entityDisplayConfig?.separator || " - ",
|
||||||
|
},
|
||||||
|
}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!joinTable && sourceTable) {
|
let joinTable = column.entityDisplayConfig?.joinTable;
|
||||||
// joinTable이 없으면 tableTypeApi로 조회해서 설정
|
|
||||||
|
// joinTable이 없으면 tableTypeApi로 조회해서 설정
|
||||||
|
if (!joinTable) {
|
||||||
try {
|
try {
|
||||||
|
console.log("🔍 tableTypeApi로 컬럼 정보 조회:", {
|
||||||
|
tableName: sourceTable,
|
||||||
|
columnName: column.columnName,
|
||||||
|
});
|
||||||
|
|
||||||
const columnList = await tableTypeApi.getColumns(sourceTable);
|
const columnList = await tableTypeApi.getColumns(sourceTable);
|
||||||
const columnInfo = columnList.find((col: any) => (col.column_name || col.columnName) === column.columnName);
|
const columnInfo = columnList.find((col: any) => (col.column_name || col.columnName) === column.columnName);
|
||||||
|
|
||||||
|
console.log("🔍 컬럼 정보 조회 결과:", {
|
||||||
|
columnInfo: columnInfo,
|
||||||
|
referenceTable: columnInfo?.reference_table || columnInfo?.referenceTable,
|
||||||
|
referenceColumn: columnInfo?.reference_column || columnInfo?.referenceColumn,
|
||||||
|
});
|
||||||
|
|
||||||
if (columnInfo?.reference_table || columnInfo?.referenceTable) {
|
if (columnInfo?.reference_table || columnInfo?.referenceTable) {
|
||||||
joinTable = columnInfo.reference_table || columnInfo.referenceTable;
|
joinTable = columnInfo.reference_table || columnInfo.referenceTable;
|
||||||
|
console.log("✅ tableTypeApi에서 조인 테이블 정보 찾음:", joinTable);
|
||||||
|
|
||||||
// entityDisplayConfig 업데이트
|
// entityDisplayConfig 업데이트
|
||||||
const updatedConfig = {
|
const updatedConfig = {
|
||||||
...column.entityDisplayConfig,
|
...column.entityDisplayConfig,
|
||||||
sourceTable: sourceTable,
|
sourceTable: sourceTable,
|
||||||
joinTable: joinTable,
|
joinTable: joinTable,
|
||||||
|
displayColumns: column.entityDisplayConfig?.displayColumns || [],
|
||||||
|
separator: column.entityDisplayConfig?.separator || " - ",
|
||||||
};
|
};
|
||||||
|
|
||||||
// 컬럼 설정 업데이트
|
// 컬럼 설정 업데이트
|
||||||
|
|
@ -553,74 +600,27 @@ export const TableListConfigPanel: React.FC<TableListConfigPanelProps> = ({
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("tableTypeApi 컬럼 정보 조회 실패:", error);
|
console.error("tableTypeApi 컬럼 정보 조회 실패:", error);
|
||||||
console.log("❌ 조회 실패 상세:", { sourceTable, columnName: column.columnName });
|
|
||||||
}
|
}
|
||||||
} else if (!joinTable) {
|
|
||||||
console.warn("⚠️ sourceTable이 없어서 joinTable 조회 불가:", column.columnName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("🔍 최종 추출한 값:", { sourceTable, joinTable });
|
console.log("🔍 최종 추출한 값:", { sourceTable, joinTable });
|
||||||
const configKey = `${column.columnName}`;
|
|
||||||
|
|
||||||
// 이미 로드된 경우 스킵
|
|
||||||
if (entityDisplayConfigs[configKey]) return;
|
|
||||||
|
|
||||||
// joinTable이 비어있으면 tableTypeApi로 컬럼 정보를 다시 가져와서 referenceTable 정보를 찾기
|
|
||||||
let actualJoinTable = joinTable;
|
|
||||||
if (!actualJoinTable && sourceTable) {
|
|
||||||
try {
|
|
||||||
console.log("🔍 tableTypeApi로 컬럼 정보 다시 조회:", {
|
|
||||||
tableName: sourceTable,
|
|
||||||
columnName: column.columnName,
|
|
||||||
});
|
|
||||||
|
|
||||||
const columnList = await tableTypeApi.getColumns(sourceTable);
|
|
||||||
const columnInfo = columnList.find((col: any) => (col.column_name || col.columnName) === column.columnName);
|
|
||||||
|
|
||||||
console.log("🔍 컬럼 정보 조회 결과:", {
|
|
||||||
columnInfo: columnInfo,
|
|
||||||
referenceTable: columnInfo?.reference_table || columnInfo?.referenceTable,
|
|
||||||
referenceColumn: columnInfo?.reference_column || columnInfo?.referenceColumn,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (columnInfo?.reference_table || columnInfo?.referenceTable) {
|
|
||||||
actualJoinTable = columnInfo.reference_table || columnInfo.referenceTable;
|
|
||||||
console.log("✅ tableTypeApi에서 조인 테이블 정보 찾음:", actualJoinTable);
|
|
||||||
|
|
||||||
// entityDisplayConfig 업데이트
|
|
||||||
const updatedConfig = {
|
|
||||||
...column.entityDisplayConfig,
|
|
||||||
joinTable: actualJoinTable,
|
|
||||||
};
|
|
||||||
|
|
||||||
// 컬럼 설정 업데이트
|
|
||||||
const updatedColumns = config.columns?.map((col) =>
|
|
||||||
col.columnName === column.columnName ? { ...col, entityDisplayConfig: updatedConfig } : col,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (updatedColumns) {
|
|
||||||
handleChange("columns", updatedColumns);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error("tableTypeApi 컬럼 정보 조회 실패:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// sourceTable과 joinTable이 모두 있어야 로드
|
|
||||||
if (!sourceTable || !actualJoinTable) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 기본 테이블과 조인 테이블의 컬럼 정보를 병렬로 로드
|
// 기본 테이블 컬럼 정보는 항상 로드
|
||||||
const [sourceResult, joinResult] = await Promise.all([
|
const sourceResult = await entityJoinApi.getReferenceTableColumns(sourceTable);
|
||||||
entityJoinApi.getReferenceTableColumns(sourceTable),
|
|
||||||
entityJoinApi.getReferenceTableColumns(actualJoinTable),
|
|
||||||
]);
|
|
||||||
|
|
||||||
const sourceColumns = sourceResult.columns || [];
|
const sourceColumns = sourceResult.columns || [];
|
||||||
const joinColumns = joinResult.columns || [];
|
|
||||||
|
// joinTable이 있으면 조인 테이블 컬럼도 로드
|
||||||
|
let joinColumns: Array<{ columnName: string; displayName: string; dataType: string }> = [];
|
||||||
|
if (joinTable) {
|
||||||
|
try {
|
||||||
|
const joinResult = await entityJoinApi.getReferenceTableColumns(joinTable);
|
||||||
|
joinColumns = joinResult.columns || [];
|
||||||
|
} catch (joinError) {
|
||||||
|
console.warn("⚠️ 조인 테이블 컬럼 로드 실패:", joinTable, joinError);
|
||||||
|
// 조인 테이블 로드 실패해도 소스 테이블 컬럼은 표시
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setEntityDisplayConfigs((prev) => ({
|
setEntityDisplayConfigs((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
|
|
@ -633,6 +633,16 @@ export const TableListConfigPanel: React.FC<TableListConfigPanelProps> = ({
|
||||||
}));
|
}));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("엔티티 표시 컬럼 정보 로드 실패:", error);
|
console.error("엔티티 표시 컬럼 정보 로드 실패:", error);
|
||||||
|
// 에러 발생 시에도 빈 상태로 설정하여 로딩 상태 해제
|
||||||
|
setEntityDisplayConfigs((prev) => ({
|
||||||
|
...prev,
|
||||||
|
[configKey]: {
|
||||||
|
sourceColumns: [],
|
||||||
|
joinColumns: [],
|
||||||
|
selectedColumns: column.entityDisplayConfig?.displayColumns || [],
|
||||||
|
separator: column.entityDisplayConfig?.separator || " - ",
|
||||||
|
},
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -873,76 +883,95 @@ export const TableListConfigPanel: React.FC<TableListConfigPanelProps> = ({
|
||||||
{/* 표시 컬럼 선택 (다중 선택) */}
|
{/* 표시 컬럼 선택 (다중 선택) */}
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<Label className="text-xs">표시할 컬럼 선택</Label>
|
<Label className="text-xs">표시할 컬럼 선택</Label>
|
||||||
<Popover>
|
{entityDisplayConfigs[column.columnName].sourceColumns.length === 0 &&
|
||||||
<PopoverTrigger asChild>
|
entityDisplayConfigs[column.columnName].joinColumns.length === 0 ? (
|
||||||
<Button
|
<div className="py-2 text-center text-xs text-gray-400">
|
||||||
variant="outline"
|
표시 가능한 컬럼이 없습니다.
|
||||||
className="h-6 w-full justify-between text-xs"
|
{!column.entityDisplayConfig?.joinTable && (
|
||||||
style={{ fontSize: "12px" }}
|
<p className="mt-1 text-[10px]">
|
||||||
>
|
테이블 타입 관리에서 참조 테이블을 설정하면 더 많은 컬럼을 선택할 수 있습니다.
|
||||||
{entityDisplayConfigs[column.columnName].selectedColumns.length > 0
|
</p>
|
||||||
? `${entityDisplayConfigs[column.columnName].selectedColumns.length}개 선택됨`
|
)}
|
||||||
: "컬럼 선택"}
|
</div>
|
||||||
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
) : (
|
||||||
</Button>
|
<Popover>
|
||||||
</PopoverTrigger>
|
<PopoverTrigger asChild>
|
||||||
<PopoverContent className="w-full p-0" align="start">
|
<Button
|
||||||
<Command>
|
variant="outline"
|
||||||
<CommandInput placeholder="컬럼 검색..." className="text-xs" />
|
className="h-6 w-full justify-between text-xs"
|
||||||
<CommandList>
|
style={{ fontSize: "12px" }}
|
||||||
<CommandEmpty className="text-xs">컬럼을 찾을 수 없습니다.</CommandEmpty>
|
>
|
||||||
{entityDisplayConfigs[column.columnName].sourceColumns.length > 0 && (
|
{entityDisplayConfigs[column.columnName].selectedColumns.length > 0
|
||||||
<CommandGroup heading={`기본: ${column.entityDisplayConfig?.sourceTable}`}>
|
? `${entityDisplayConfigs[column.columnName].selectedColumns.length}개 선택됨`
|
||||||
{entityDisplayConfigs[column.columnName].sourceColumns.map((col) => (
|
: "컬럼 선택"}
|
||||||
<CommandItem
|
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
key={`source-${col.columnName}`}
|
</Button>
|
||||||
onSelect={() => toggleEntityDisplayColumn(column.columnName, col.columnName)}
|
</PopoverTrigger>
|
||||||
className="text-xs"
|
<PopoverContent className="w-full p-0" align="start">
|
||||||
>
|
<Command>
|
||||||
<Check
|
<CommandInput placeholder="컬럼 검색..." className="text-xs" />
|
||||||
className={cn(
|
<CommandList>
|
||||||
"mr-2 h-4 w-4",
|
<CommandEmpty className="text-xs">컬럼을 찾을 수 없습니다.</CommandEmpty>
|
||||||
entityDisplayConfigs[column.columnName].selectedColumns.includes(
|
{entityDisplayConfigs[column.columnName].sourceColumns.length > 0 && (
|
||||||
col.columnName,
|
<CommandGroup heading={`기본 테이블: ${column.entityDisplayConfig?.sourceTable || config.selectedTable || screenTableName}`}>
|
||||||
)
|
{entityDisplayConfigs[column.columnName].sourceColumns.map((col) => (
|
||||||
? "opacity-100"
|
<CommandItem
|
||||||
: "opacity-0",
|
key={`source-${col.columnName}`}
|
||||||
)}
|
onSelect={() => toggleEntityDisplayColumn(column.columnName, col.columnName)}
|
||||||
/>
|
className="text-xs"
|
||||||
{col.displayName}
|
>
|
||||||
</CommandItem>
|
<Check
|
||||||
))}
|
className={cn(
|
||||||
</CommandGroup>
|
"mr-2 h-4 w-4",
|
||||||
)}
|
entityDisplayConfigs[column.columnName].selectedColumns.includes(
|
||||||
{entityDisplayConfigs[column.columnName].joinColumns.length > 0 && (
|
col.columnName,
|
||||||
<CommandGroup heading={`조인: ${column.entityDisplayConfig?.joinTable}`}>
|
)
|
||||||
{entityDisplayConfigs[column.columnName].joinColumns.map((col) => (
|
? "opacity-100"
|
||||||
<CommandItem
|
: "opacity-0",
|
||||||
key={`join-${col.columnName}`}
|
)}
|
||||||
onSelect={() => toggleEntityDisplayColumn(column.columnName, col.columnName)}
|
/>
|
||||||
className="text-xs"
|
{col.displayName}
|
||||||
>
|
</CommandItem>
|
||||||
<Check
|
))}
|
||||||
className={cn(
|
</CommandGroup>
|
||||||
"mr-2 h-4 w-4",
|
)}
|
||||||
entityDisplayConfigs[column.columnName].selectedColumns.includes(
|
{entityDisplayConfigs[column.columnName].joinColumns.length > 0 && (
|
||||||
col.columnName,
|
<CommandGroup heading={`참조 테이블: ${column.entityDisplayConfig?.joinTable}`}>
|
||||||
)
|
{entityDisplayConfigs[column.columnName].joinColumns.map((col) => (
|
||||||
? "opacity-100"
|
<CommandItem
|
||||||
: "opacity-0",
|
key={`join-${col.columnName}`}
|
||||||
)}
|
onSelect={() => toggleEntityDisplayColumn(column.columnName, col.columnName)}
|
||||||
/>
|
className="text-xs"
|
||||||
{col.displayName}
|
>
|
||||||
</CommandItem>
|
<Check
|
||||||
))}
|
className={cn(
|
||||||
</CommandGroup>
|
"mr-2 h-4 w-4",
|
||||||
)}
|
entityDisplayConfigs[column.columnName].selectedColumns.includes(
|
||||||
</CommandList>
|
col.columnName,
|
||||||
</Command>
|
)
|
||||||
</PopoverContent>
|
? "opacity-100"
|
||||||
</Popover>
|
: "opacity-0",
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
{col.displayName}
|
||||||
|
</CommandItem>
|
||||||
|
))}
|
||||||
|
</CommandGroup>
|
||||||
|
)}
|
||||||
|
</CommandList>
|
||||||
|
</Command>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* 참조 테이블 미설정 안내 */}
|
||||||
|
{!column.entityDisplayConfig?.joinTable && entityDisplayConfigs[column.columnName].sourceColumns.length > 0 && (
|
||||||
|
<div className="rounded bg-blue-50 p-2 text-[10px] text-blue-600">
|
||||||
|
현재 기본 테이블 컬럼만 표시됩니다. 테이블 타입 관리에서 참조 테이블을 설정하면 조인된 테이블의 컬럼도 선택할 수 있습니다.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* 선택된 컬럼 미리보기 */}
|
{/* 선택된 컬럼 미리보기 */}
|
||||||
{entityDisplayConfigs[column.columnName].selectedColumns.length > 0 && (
|
{entityDisplayConfigs[column.columnName].selectedColumns.length > 0 && (
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
|
|
@ -1074,86 +1103,111 @@ export const TableListConfigPanel: React.FC<TableListConfigPanelProps> = ({
|
||||||
|
|
||||||
{/* 간결한 리스트 형식 컬럼 설정 */}
|
{/* 간결한 리스트 형식 컬럼 설정 */}
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
{config.columns?.map((column, index) => (
|
{config.columns?.map((column, index) => {
|
||||||
<div
|
// 해당 컬럼의 input_type 확인
|
||||||
key={column.columnName}
|
const columnInfo = availableColumns.find((col) => col.columnName === column.columnName);
|
||||||
className="hover:bg-muted/30 flex h-6 items-center justify-between rounded border px-2"
|
const isNumberType = columnInfo?.input_type === "number" || columnInfo?.input_type === "decimal";
|
||||||
>
|
|
||||||
{/* 컬럼명 */}
|
|
||||||
<span className="flex-1 truncate text-xs" style={{ fontSize: "12px" }}>
|
|
||||||
{availableColumns.find((col) => col.columnName === column.columnName)?.label ||
|
|
||||||
column.displayName ||
|
|
||||||
column.columnName}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
{/* 필터 체크박스 + 순서 변경 + 삭제 버튼 */}
|
return (
|
||||||
<div className="flex shrink-0 items-center gap-1">
|
<div
|
||||||
<Checkbox
|
key={column.columnName}
|
||||||
checked={config.filter?.filters?.some((f) => f.columnName === column.columnName) || false}
|
className="hover:bg-muted/30 flex items-center justify-between rounded border px-2 py-1"
|
||||||
onCheckedChange={(checked) => {
|
style={{ minHeight: "28px" }}
|
||||||
const currentFilters = config.filter?.filters || [];
|
>
|
||||||
const columnLabel =
|
<div className="flex flex-1 flex-col gap-0.5 overflow-hidden">
|
||||||
availableColumns.find((col) => col.columnName === column.columnName)?.label ||
|
{/* 컬럼명 */}
|
||||||
column.displayName ||
|
<span className="truncate text-xs" style={{ fontSize: "12px" }}>
|
||||||
column.columnName;
|
{columnInfo?.label || column.displayName || column.columnName}
|
||||||
|
</span>
|
||||||
|
|
||||||
if (checked) {
|
{/* 숫자 타입인 경우 천단위 구분자 설정 */}
|
||||||
// 필터 추가
|
{isNumberType && (
|
||||||
handleChange("filter", {
|
<div className="flex items-center gap-1">
|
||||||
...config.filter,
|
<Checkbox
|
||||||
enabled: true,
|
id={`thousand-sep-${column.columnName}`}
|
||||||
filters: [
|
checked={column.thousandSeparator !== false}
|
||||||
...currentFilters,
|
onCheckedChange={(checked) => {
|
||||||
{
|
updateColumn(column.columnName, { thousandSeparator: checked as boolean });
|
||||||
columnName: column.columnName,
|
}}
|
||||||
label: columnLabel,
|
className="h-3 w-3"
|
||||||
type: "text",
|
/>
|
||||||
},
|
<Label
|
||||||
],
|
htmlFor={`thousand-sep-${column.columnName}`}
|
||||||
});
|
className="text-[10px] text-muted-foreground cursor-pointer"
|
||||||
} else {
|
>
|
||||||
// 필터 제거
|
천단위 구분자
|
||||||
handleChange("filter", {
|
</Label>
|
||||||
...config.filter,
|
</div>
|
||||||
filters: currentFilters.filter((f) => f.columnName !== column.columnName),
|
)}
|
||||||
});
|
</div>
|
||||||
}
|
|
||||||
}}
|
{/* 필터 체크박스 + 순서 변경 + 삭제 버튼 */}
|
||||||
className="h-3 w-3"
|
<div className="flex shrink-0 items-center gap-1">
|
||||||
/>
|
<Checkbox
|
||||||
|
checked={config.filter?.filters?.some((f) => f.columnName === column.columnName) || false}
|
||||||
|
onCheckedChange={(checked) => {
|
||||||
|
const currentFilters = config.filter?.filters || [];
|
||||||
|
const columnLabel =
|
||||||
|
columnInfo?.label || column.displayName || column.columnName;
|
||||||
|
|
||||||
|
if (checked) {
|
||||||
|
// 필터 추가
|
||||||
|
handleChange("filter", {
|
||||||
|
...config.filter,
|
||||||
|
enabled: true,
|
||||||
|
filters: [
|
||||||
|
...currentFilters,
|
||||||
|
{
|
||||||
|
columnName: column.columnName,
|
||||||
|
label: columnLabel,
|
||||||
|
type: "text",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 필터 제거
|
||||||
|
handleChange("filter", {
|
||||||
|
...config.filter,
|
||||||
|
filters: currentFilters.filter((f) => f.columnName !== column.columnName),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
className="h-3 w-3"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 순서 변경 + 삭제 버튼 */}
|
||||||
|
<div className="flex shrink-0 items-center gap-1">
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => moveColumn(column.columnName, "up")}
|
||||||
|
disabled={index === 0}
|
||||||
|
className="h-6 w-6 p-0"
|
||||||
|
>
|
||||||
|
<ArrowUp className="h-3 w-3" />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => moveColumn(column.columnName, "down")}
|
||||||
|
disabled={index === (config.columns?.length || 0) - 1}
|
||||||
|
className="h-6 w-6 p-0"
|
||||||
|
>
|
||||||
|
<ArrowDown className="h-3 w-3" />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => removeColumn(column.columnName)}
|
||||||
|
className="h-6 w-6 p-0 text-red-500 hover:text-red-600"
|
||||||
|
>
|
||||||
|
<Trash2 className="h-3 w-3" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
);
|
||||||
{/* 순서 변경 + 삭제 버튼 */}
|
})}
|
||||||
<div className="flex shrink-0 items-center gap-1">
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => moveColumn(column.columnName, "up")}
|
|
||||||
disabled={index === 0}
|
|
||||||
className="h-6 w-6 p-0"
|
|
||||||
>
|
|
||||||
<ArrowUp className="h-3 w-3" />
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => moveColumn(column.columnName, "down")}
|
|
||||||
disabled={index === (config.columns?.length || 0) - 1}
|
|
||||||
className="h-6 w-6 p-0"
|
|
||||||
>
|
|
||||||
<ArrowDown className="h-3 w-3" />
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => removeColumn(column.columnName)}
|
|
||||||
className="h-6 w-6 p-0 text-red-500 hover:text-red-600"
|
|
||||||
>
|
|
||||||
<Trash2 className="h-3 w-3" />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
@ -1322,6 +1376,298 @@ export const TableListConfigPanel: React.FC<TableListConfigPanelProps> = ({
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* 🆕 제외 필터 설정 (다른 테이블에 이미 존재하는 데이터 제외) */}
|
||||||
|
<div className="space-y-3">
|
||||||
|
<div>
|
||||||
|
<h3 className="text-sm font-semibold">제외 필터</h3>
|
||||||
|
<p className="text-xs text-muted-foreground mt-1">
|
||||||
|
다른 테이블에 이미 존재하는 데이터를 목록에서 제외합니다
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<hr className="border-border" />
|
||||||
|
|
||||||
|
{/* 제외 필터 활성화 */}
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Checkbox
|
||||||
|
id="excludeFilter-enabled"
|
||||||
|
checked={config.excludeFilter?.enabled || false}
|
||||||
|
onCheckedChange={(checked) => {
|
||||||
|
handleChange("excludeFilter", {
|
||||||
|
...config.excludeFilter,
|
||||||
|
enabled: checked as boolean,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Label htmlFor="excludeFilter-enabled" className="text-xs">
|
||||||
|
제외 필터 활성화
|
||||||
|
</Label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{config.excludeFilter?.enabled && (
|
||||||
|
<div className="space-y-3 rounded border p-3">
|
||||||
|
{/* 참조 테이블 선택 */}
|
||||||
|
<div className="space-y-1">
|
||||||
|
<Label className="text-xs font-medium">참조 테이블 (매핑 테이블)</Label>
|
||||||
|
<Popover>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
role="combobox"
|
||||||
|
className="h-8 w-full justify-between text-xs"
|
||||||
|
>
|
||||||
|
{config.excludeFilter?.referenceTable || "테이블 선택..."}
|
||||||
|
<ChevronsUpDown className="ml-2 h-3 w-3 shrink-0 opacity-50" />
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-[300px] p-0">
|
||||||
|
<Command>
|
||||||
|
<CommandInput placeholder="테이블 검색..." className="h-8 text-xs" />
|
||||||
|
<CommandList>
|
||||||
|
<CommandEmpty className="text-xs py-2">테이블을 찾을 수 없습니다</CommandEmpty>
|
||||||
|
<CommandGroup>
|
||||||
|
{availableTables.map((table) => (
|
||||||
|
<CommandItem
|
||||||
|
key={table.tableName}
|
||||||
|
value={table.tableName}
|
||||||
|
onSelect={() => {
|
||||||
|
handleChange("excludeFilter", {
|
||||||
|
...config.excludeFilter,
|
||||||
|
referenceTable: table.tableName,
|
||||||
|
referenceColumn: undefined,
|
||||||
|
sourceColumn: undefined,
|
||||||
|
filterColumn: undefined,
|
||||||
|
filterValueField: undefined,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
className="text-xs"
|
||||||
|
>
|
||||||
|
<Check
|
||||||
|
className={cn(
|
||||||
|
"mr-2 h-3 w-3",
|
||||||
|
config.excludeFilter?.referenceTable === table.tableName ? "opacity-100" : "opacity-0"
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
{table.displayName || table.tableName}
|
||||||
|
</CommandItem>
|
||||||
|
))}
|
||||||
|
</CommandGroup>
|
||||||
|
</CommandList>
|
||||||
|
</Command>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{config.excludeFilter?.referenceTable && (
|
||||||
|
<>
|
||||||
|
{/* 비교 컬럼 설정 - 한 줄에 두 개 */}
|
||||||
|
<div className="grid grid-cols-2 gap-2">
|
||||||
|
{/* 참조 컬럼 (매핑 테이블) */}
|
||||||
|
<div className="space-y-1">
|
||||||
|
<Label className="text-xs">비교 컬럼 (매핑)</Label>
|
||||||
|
<Popover>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
role="combobox"
|
||||||
|
disabled={loadingReferenceColumns}
|
||||||
|
className="h-8 w-full justify-between text-xs"
|
||||||
|
>
|
||||||
|
{loadingReferenceColumns
|
||||||
|
? "..."
|
||||||
|
: config.excludeFilter?.referenceColumn || "선택"}
|
||||||
|
<ChevronsUpDown className="ml-1 h-3 w-3 shrink-0 opacity-50" />
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-[200px] p-0">
|
||||||
|
<Command>
|
||||||
|
<CommandInput placeholder="검색..." className="h-8 text-xs" />
|
||||||
|
<CommandList>
|
||||||
|
<CommandEmpty className="text-xs py-2">없음</CommandEmpty>
|
||||||
|
<CommandGroup>
|
||||||
|
{referenceTableColumns.map((col) => (
|
||||||
|
<CommandItem
|
||||||
|
key={col.columnName}
|
||||||
|
value={col.columnName}
|
||||||
|
onSelect={() => {
|
||||||
|
handleChange("excludeFilter", {
|
||||||
|
...config.excludeFilter,
|
||||||
|
referenceColumn: col.columnName,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
className="text-xs"
|
||||||
|
>
|
||||||
|
<Check
|
||||||
|
className={cn(
|
||||||
|
"mr-2 h-3 w-3",
|
||||||
|
config.excludeFilter?.referenceColumn === col.columnName ? "opacity-100" : "opacity-0"
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
{col.label || col.columnName}
|
||||||
|
</CommandItem>
|
||||||
|
))}
|
||||||
|
</CommandGroup>
|
||||||
|
</CommandList>
|
||||||
|
</Command>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 소스 컬럼 (현재 테이블) */}
|
||||||
|
<div className="space-y-1">
|
||||||
|
<Label className="text-xs">비교 컬럼 (현재)</Label>
|
||||||
|
<Popover>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
role="combobox"
|
||||||
|
className="h-8 w-full justify-between text-xs"
|
||||||
|
>
|
||||||
|
{config.excludeFilter?.sourceColumn || "선택"}
|
||||||
|
<ChevronsUpDown className="ml-1 h-3 w-3 shrink-0 opacity-50" />
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-[200px] p-0">
|
||||||
|
<Command>
|
||||||
|
<CommandInput placeholder="검색..." className="h-8 text-xs" />
|
||||||
|
<CommandList>
|
||||||
|
<CommandEmpty className="text-xs py-2">없음</CommandEmpty>
|
||||||
|
<CommandGroup>
|
||||||
|
{availableColumns.map((col) => (
|
||||||
|
<CommandItem
|
||||||
|
key={col.columnName}
|
||||||
|
value={col.columnName}
|
||||||
|
onSelect={() => {
|
||||||
|
handleChange("excludeFilter", {
|
||||||
|
...config.excludeFilter,
|
||||||
|
sourceColumn: col.columnName,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
className="text-xs"
|
||||||
|
>
|
||||||
|
<Check
|
||||||
|
className={cn(
|
||||||
|
"mr-2 h-3 w-3",
|
||||||
|
config.excludeFilter?.sourceColumn === col.columnName ? "opacity-100" : "opacity-0"
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
{col.label || col.columnName}
|
||||||
|
</CommandItem>
|
||||||
|
))}
|
||||||
|
</CommandGroup>
|
||||||
|
</CommandList>
|
||||||
|
</Command>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 조건 필터 - 특정 조건의 데이터만 제외 */}
|
||||||
|
<div className="space-y-1">
|
||||||
|
<Label className="text-xs">조건 필터 (선택사항)</Label>
|
||||||
|
<p className="text-[10px] text-muted-foreground mb-1">
|
||||||
|
특정 조건의 데이터만 제외하려면 설정하세요 (예: 특정 거래처의 품목만)
|
||||||
|
</p>
|
||||||
|
<div className="grid grid-cols-2 gap-2">
|
||||||
|
{/* 필터 컬럼 (매핑 테이블) */}
|
||||||
|
<Popover>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
role="combobox"
|
||||||
|
disabled={loadingReferenceColumns}
|
||||||
|
className="h-8 w-full justify-between text-xs"
|
||||||
|
>
|
||||||
|
{loadingReferenceColumns
|
||||||
|
? "..."
|
||||||
|
: config.excludeFilter?.filterColumn
|
||||||
|
? `매핑: ${config.excludeFilter.filterColumn}`
|
||||||
|
: "매핑 테이블 컬럼"}
|
||||||
|
<ChevronsUpDown className="ml-1 h-3 w-3 shrink-0 opacity-50" />
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-[200px] p-0">
|
||||||
|
<Command>
|
||||||
|
<CommandInput placeholder="검색..." className="h-8 text-xs" />
|
||||||
|
<CommandList>
|
||||||
|
<CommandEmpty className="text-xs py-2">없음</CommandEmpty>
|
||||||
|
<CommandGroup>
|
||||||
|
<CommandItem
|
||||||
|
value=""
|
||||||
|
onSelect={() => {
|
||||||
|
handleChange("excludeFilter", {
|
||||||
|
...config.excludeFilter,
|
||||||
|
filterColumn: undefined,
|
||||||
|
filterValueField: undefined,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
className="text-xs text-muted-foreground"
|
||||||
|
>
|
||||||
|
<Check className={cn("mr-2 h-3 w-3", !config.excludeFilter?.filterColumn ? "opacity-100" : "opacity-0")} />
|
||||||
|
사용 안함
|
||||||
|
</CommandItem>
|
||||||
|
{referenceTableColumns.map((col) => (
|
||||||
|
<CommandItem
|
||||||
|
key={col.columnName}
|
||||||
|
value={col.columnName}
|
||||||
|
onSelect={() => {
|
||||||
|
// 필터 컬럼 선택 시 같은 이름의 필드를 자동으로 설정
|
||||||
|
handleChange("excludeFilter", {
|
||||||
|
...config.excludeFilter,
|
||||||
|
filterColumn: col.columnName,
|
||||||
|
filterValueField: col.columnName, // 같은 이름으로 자동 설정
|
||||||
|
filterValueSource: "url",
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
className="text-xs"
|
||||||
|
>
|
||||||
|
<Check
|
||||||
|
className={cn(
|
||||||
|
"mr-2 h-3 w-3",
|
||||||
|
config.excludeFilter?.filterColumn === col.columnName ? "opacity-100" : "opacity-0"
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
{col.label || col.columnName}
|
||||||
|
</CommandItem>
|
||||||
|
))}
|
||||||
|
</CommandGroup>
|
||||||
|
</CommandList>
|
||||||
|
</Command>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
|
||||||
|
{/* 필터 값 필드명 (부모 화면에서 전달받는 필드) */}
|
||||||
|
<Input
|
||||||
|
placeholder="예: customer_code"
|
||||||
|
value={config.excludeFilter?.filterValueField || ""}
|
||||||
|
onChange={(e) => {
|
||||||
|
handleChange("excludeFilter", {
|
||||||
|
...config.excludeFilter,
|
||||||
|
filterValueField: e.target.value,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
disabled={!config.excludeFilter?.filterColumn}
|
||||||
|
className="h-8 text-xs"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* 설정 요약 */}
|
||||||
|
{config.excludeFilter?.referenceTable && config.excludeFilter?.referenceColumn && config.excludeFilter?.sourceColumn && (
|
||||||
|
<div className="rounded bg-muted/50 p-2 text-[10px] text-muted-foreground">
|
||||||
|
<strong>설정 요약:</strong> {config.selectedTable || screenTableName}.{config.excludeFilter.sourceColumn} 가
|
||||||
|
{" "}{config.excludeFilter.referenceTable}.{config.excludeFilter.referenceColumn} 에
|
||||||
|
{config.excludeFilter.filterColumn && config.excludeFilter.filterValueField && (
|
||||||
|
<> ({config.excludeFilter.filterColumn}=URL의 {config.excludeFilter.filterValueField}일 때)</>
|
||||||
|
)}
|
||||||
|
{" "}이미 있으면 제외
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,9 @@ export interface ColumnConfig {
|
||||||
isEntityJoin?: boolean; // Entity 조인된 컬럼인지 여부
|
isEntityJoin?: boolean; // Entity 조인된 컬럼인지 여부
|
||||||
entityJoinInfo?: EntityJoinInfo; // Entity 조인 상세 정보
|
entityJoinInfo?: EntityJoinInfo; // Entity 조인 상세 정보
|
||||||
|
|
||||||
|
// 숫자 포맷팅 설정
|
||||||
|
thousandSeparator?: boolean; // 천단위 구분자 사용 여부 (기본: true)
|
||||||
|
|
||||||
// 🎯 엔티티 컬럼 표시 설정 (화면별 동적 설정)
|
// 🎯 엔티티 컬럼 표시 설정 (화면별 동적 설정)
|
||||||
entityDisplayConfig?: {
|
entityDisplayConfig?: {
|
||||||
displayColumns: string[]; // 표시할 컬럼들 (기본 테이블 + 조인 테이블)
|
displayColumns: string[]; // 표시할 컬럼들 (기본 테이블 + 조인 테이블)
|
||||||
|
|
@ -182,6 +185,21 @@ export interface LinkedFilterConfig {
|
||||||
enabled?: boolean; // 활성화 여부 (기본: true)
|
enabled?: boolean; // 활성화 여부 (기본: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 제외 필터 설정
|
||||||
|
* 다른 테이블에 이미 존재하는 데이터를 제외하고 표시
|
||||||
|
* 예: 거래처에 이미 등록된 품목을 품목 선택 모달에서 제외
|
||||||
|
*/
|
||||||
|
export interface ExcludeFilterConfig {
|
||||||
|
enabled: boolean; // 제외 필터 활성화 여부
|
||||||
|
referenceTable: string; // 참조 테이블 (예: customer_item_mapping)
|
||||||
|
referenceColumn: string; // 참조 테이블의 비교 컬럼 (예: item_id)
|
||||||
|
sourceColumn: string; // 현재 테이블의 비교 컬럼 (예: item_number)
|
||||||
|
filterColumn?: string; // 참조 테이블의 필터 컬럼 (예: customer_id)
|
||||||
|
filterValueSource?: "url" | "formData" | "parentData"; // 필터 값 소스 (기본: url)
|
||||||
|
filterValueField?: string; // 필터 값 필드명 (예: customer_code)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TableList 컴포넌트 설정 타입
|
* TableList 컴포넌트 설정 타입
|
||||||
*/
|
*/
|
||||||
|
|
@ -246,6 +264,9 @@ export interface TableListConfig extends ComponentConfig {
|
||||||
// 🆕 연결된 필터 (다른 컴포넌트 값으로 필터링)
|
// 🆕 연결된 필터 (다른 컴포넌트 값으로 필터링)
|
||||||
linkedFilters?: LinkedFilterConfig[];
|
linkedFilters?: LinkedFilterConfig[];
|
||||||
|
|
||||||
|
// 🆕 제외 필터 (다른 테이블에 이미 존재하는 데이터 제외)
|
||||||
|
excludeFilter?: ExcludeFilterConfig;
|
||||||
|
|
||||||
// 이벤트 핸들러
|
// 이벤트 핸들러
|
||||||
onRowClick?: (row: any) => void;
|
onRowClick?: (row: any) => void;
|
||||||
onRowDoubleClick?: (row: any) => void;
|
onRowDoubleClick?: (row: any) => void;
|
||||||
|
|
|
||||||
|
|
@ -1236,8 +1236,13 @@ export class ButtonActionExecutor {
|
||||||
} else {
|
} else {
|
||||||
console.log("🔄 테이블 데이터 삭제 완료, 테이블 새로고침 호출");
|
console.log("🔄 테이블 데이터 삭제 완료, 테이블 새로고침 호출");
|
||||||
context.onRefresh?.(); // 테이블 새로고침
|
context.onRefresh?.(); // 테이블 새로고침
|
||||||
|
|
||||||
|
// 🆕 분할 패널 등 전역 테이블 새로고침 이벤트 발생
|
||||||
|
window.dispatchEvent(new CustomEvent("refreshTable"));
|
||||||
|
console.log("🔄 refreshTable 전역 이벤트 발생");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toast.success(config.successMessage || `${dataToDelete.length}개 항목이 삭제되었습니다.`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1258,6 +1263,12 @@ export class ButtonActionExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
context.onRefresh?.();
|
context.onRefresh?.();
|
||||||
|
|
||||||
|
// 🆕 분할 패널 등 전역 테이블 새로고침 이벤트 발생
|
||||||
|
window.dispatchEvent(new CustomEvent("refreshTable"));
|
||||||
|
console.log("🔄 refreshTable 전역 이벤트 발생 (단일 삭제)");
|
||||||
|
|
||||||
|
toast.success(config.successMessage || "삭제되었습니다.");
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("삭제 오류:", error);
|
console.error("삭제 오류:", error);
|
||||||
|
|
@ -1536,6 +1547,13 @@ export class ButtonActionExecutor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 🆕 부모 화면의 선택된 데이터 가져오기 (excludeFilter에서 사용)
|
||||||
|
const parentData = dataRegistry[dataSourceId]?.[0]?.originalData || dataRegistry[dataSourceId]?.[0] || {};
|
||||||
|
console.log("📦 [openModalWithData] 부모 데이터 전달:", {
|
||||||
|
dataSourceId,
|
||||||
|
parentData,
|
||||||
|
});
|
||||||
|
|
||||||
// 🆕 전역 모달 상태 업데이트를 위한 이벤트 발생 (URL 파라미터 포함)
|
// 🆕 전역 모달 상태 업데이트를 위한 이벤트 발생 (URL 파라미터 포함)
|
||||||
const modalEvent = new CustomEvent("openScreenModal", {
|
const modalEvent = new CustomEvent("openScreenModal", {
|
||||||
detail: {
|
detail: {
|
||||||
|
|
@ -1544,6 +1562,7 @@ export class ButtonActionExecutor {
|
||||||
description: description,
|
description: description,
|
||||||
size: config.modalSize || "lg", // 데이터 입력 화면은 기본 large
|
size: config.modalSize || "lg", // 데이터 입력 화면은 기본 large
|
||||||
urlParams: { dataSourceId }, // 🆕 주 데이터 소스만 전달 (나머지는 modalDataStore에서 자동으로 찾음)
|
urlParams: { dataSourceId }, // 🆕 주 데이터 소스만 전달 (나머지는 modalDataStore에서 자동으로 찾음)
|
||||||
|
splitPanelParentData: parentData, // 🆕 부모 데이터 전달 (excludeFilter에서 사용)
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
"leaflet": "^1.9.4",
|
"leaflet": "^1.9.4",
|
||||||
"lucide-react": "^0.525.0",
|
"lucide-react": "^0.525.0",
|
||||||
"mammoth": "^1.11.0",
|
"mammoth": "^1.11.0",
|
||||||
"next": "15.4.4",
|
"next": "^15.4.8",
|
||||||
"react": "19.1.0",
|
"react": "19.1.0",
|
||||||
"react-day-picker": "^9.11.1",
|
"react-day-picker": "^9.11.1",
|
||||||
"react-dnd": "^16.0.1",
|
"react-dnd": "^16.0.1",
|
||||||
|
|
@ -1145,9 +1145,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/env": {
|
"node_modules/@next/env": {
|
||||||
"version": "15.4.4",
|
"version": "15.4.8",
|
||||||
"resolved": "https://registry.npmjs.org/@next/env/-/env-15.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/@next/env/-/env-15.4.8.tgz",
|
||||||
"integrity": "sha512-SJKOOkULKENyHSYXE5+KiFU6itcIb6wSBjgM92meK0HVKpo94dNOLZVdLLuS7/BxImROkGoPsjR4EnuDucqiiA==",
|
"integrity": "sha512-LydLa2MDI1NMrOFSkO54mTc8iIHSttj6R6dthITky9ylXV2gCGi0bHQjVCtLGRshdRPjyh2kXbxJukDtBWQZtQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@next/eslint-plugin-next": {
|
"node_modules/@next/eslint-plugin-next": {
|
||||||
|
|
@ -1161,9 +1161,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-darwin-arm64": {
|
"node_modules/@next/swc-darwin-arm64": {
|
||||||
"version": "15.4.4",
|
"version": "15.4.8",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.4.8.tgz",
|
||||||
"integrity": "sha512-eVG55dnGwfUuG+TtnUCt+mEJ+8TGgul6nHEvdb8HEH7dmJIFYOCApAaFrIrxwtEq2Cdf+0m5sG1Np8cNpw9EAw==",
|
"integrity": "sha512-Pf6zXp7yyQEn7sqMxur6+kYcywx5up1J849psyET7/8pG2gQTVMjU3NzgIt8SeEP5to3If/SaWmaA6H6ysBr1A==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
|
@ -1177,9 +1177,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-darwin-x64": {
|
"node_modules/@next/swc-darwin-x64": {
|
||||||
"version": "15.4.4",
|
"version": "15.4.8",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.4.8.tgz",
|
||||||
"integrity": "sha512-zqG+/8apsu49CltEj4NAmCGZvHcZbOOOsNoTVeIXphYWIbE4l6A/vuQHyqll0flU2o3dmYCXsBW5FmbrGDgljQ==",
|
"integrity": "sha512-xla6AOfz68a6kq3gRQccWEvFC/VRGJmA/QuSLENSO7CZX5WIEkSz7r1FdXUjtGCQ1c2M+ndUAH7opdfLK1PQbw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
|
@ -1193,9 +1193,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-linux-arm64-gnu": {
|
"node_modules/@next/swc-linux-arm64-gnu": {
|
||||||
"version": "15.4.4",
|
"version": "15.4.8",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.4.8.tgz",
|
||||||
"integrity": "sha512-LRD4l2lq4R+2QCHBQVC0wjxxkLlALGJCwigaJ5FSRSqnje+MRKHljQNZgDCaKUZQzO/TXxlmUdkZP/X3KNGZaw==",
|
"integrity": "sha512-y3fmp+1Px/SJD+5ntve5QLZnGLycsxsVPkTzAc3zUiXYSOlTPqT8ynfmt6tt4fSo1tAhDPmryXpYKEAcoAPDJw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
|
@ -1209,9 +1209,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-linux-arm64-musl": {
|
"node_modules/@next/swc-linux-arm64-musl": {
|
||||||
"version": "15.4.4",
|
"version": "15.4.8",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.4.8.tgz",
|
||||||
"integrity": "sha512-LsGUCTvuZ0690fFWerA4lnQvjkYg9gHo12A3wiPUR4kCxbx/d+SlwmonuTH2SWZI+RVGA9VL3N0S03WTYv6bYg==",
|
"integrity": "sha512-DX/L8VHzrr1CfwaVjBQr3GWCqNNFgyWJbeQ10Lx/phzbQo3JNAxUok1DZ8JHRGcL6PgMRgj6HylnLNndxn4Z6A==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
|
@ -1225,9 +1225,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-linux-x64-gnu": {
|
"node_modules/@next/swc-linux-x64-gnu": {
|
||||||
"version": "15.4.4",
|
"version": "15.4.8",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.4.8.tgz",
|
||||||
"integrity": "sha512-aOy5yNRpLL3wNiJVkFYl6w22hdREERNjvegE6vvtix8LHRdsTHhWTpgvcYdCK7AIDCQW5ATmzr9XkPHvSoAnvg==",
|
"integrity": "sha512-9fLAAXKAL3xEIFdKdzG5rUSvSiZTLLTCc6JKq1z04DR4zY7DbAPcRvNm3K1inVhTiQCs19ZRAgUerHiVKMZZIA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
|
@ -1241,9 +1241,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-linux-x64-musl": {
|
"node_modules/@next/swc-linux-x64-musl": {
|
||||||
"version": "15.4.4",
|
"version": "15.4.8",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.4.8.tgz",
|
||||||
"integrity": "sha512-FL7OAn4UkR8hKQRGBmlHiHinzOb07tsfARdGh7v0Z0jEJ3sz8/7L5bR23ble9E6DZMabSStqlATHlSxv1fuzAg==",
|
"integrity": "sha512-s45V7nfb5g7dbS7JK6XZDcapicVrMMvX2uYgOHP16QuKH/JA285oy6HcxlKqwUNaFY/UC6EvQ8QZUOo19cBKSA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
|
@ -1257,9 +1257,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-win32-arm64-msvc": {
|
"node_modules/@next/swc-win32-arm64-msvc": {
|
||||||
"version": "15.4.4",
|
"version": "15.4.8",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.4.8.tgz",
|
||||||
"integrity": "sha512-eEdNW/TXwjYhOulQh0pffTMMItWVwKCQpbziSBmgBNFZIIRn2GTXrhrewevs8wP8KXWYMx8Z+mNU0X+AfvtrRg==",
|
"integrity": "sha512-KjgeQyOAq7t/HzAJcWPGA8X+4WY03uSCZ2Ekk98S9OgCFsb6lfBE3dbUzUuEQAN2THbwYgFfxX2yFTCMm8Kehw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
|
@ -1273,9 +1273,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-win32-x64-msvc": {
|
"node_modules/@next/swc-win32-x64-msvc": {
|
||||||
"version": "15.4.4",
|
"version": "15.4.8",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.4.8.tgz",
|
||||||
"integrity": "sha512-SE5pYNbn/xZKMy1RE3pAs+4xD32OI4rY6mzJa4XUkp/ItZY+OMjIgilskmErt8ls/fVJ+Ihopi2QIeW6O3TrMw==",
|
"integrity": "sha512-Exsmf/+42fWVnLMaZHzshukTBxZrSwuuLKFvqhGHJ+mC1AokqieLY/XzAl3jc/CqhXLqLY3RRjkKJ9YnLPcRWg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
|
@ -10876,12 +10876,12 @@
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/next": {
|
"node_modules/next": {
|
||||||
"version": "15.4.4",
|
"version": "15.4.8",
|
||||||
"resolved": "https://registry.npmjs.org/next/-/next-15.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/next/-/next-15.4.8.tgz",
|
||||||
"integrity": "sha512-kNcubvJjOL9yUOfwtZF3HfDhuhp+kVD+FM2A6Tyua1eI/xfmY4r/8ZS913MMz+oWKDlbps/dQOWdDricuIkXLw==",
|
"integrity": "sha512-jwOXTz/bo0Pvlf20FSb6VXVeWRssA2vbvq9SdrOPEg9x8E1B27C2rQtvriAn600o9hH61kjrVRexEffv3JybuA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@next/env": "15.4.4",
|
"@next/env": "15.4.8",
|
||||||
"@swc/helpers": "0.5.15",
|
"@swc/helpers": "0.5.15",
|
||||||
"caniuse-lite": "^1.0.30001579",
|
"caniuse-lite": "^1.0.30001579",
|
||||||
"postcss": "8.4.31",
|
"postcss": "8.4.31",
|
||||||
|
|
@ -10894,14 +10894,14 @@
|
||||||
"node": "^18.18.0 || ^19.8.0 || >= 20.0.0"
|
"node": "^18.18.0 || ^19.8.0 || >= 20.0.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@next/swc-darwin-arm64": "15.4.4",
|
"@next/swc-darwin-arm64": "15.4.8",
|
||||||
"@next/swc-darwin-x64": "15.4.4",
|
"@next/swc-darwin-x64": "15.4.8",
|
||||||
"@next/swc-linux-arm64-gnu": "15.4.4",
|
"@next/swc-linux-arm64-gnu": "15.4.8",
|
||||||
"@next/swc-linux-arm64-musl": "15.4.4",
|
"@next/swc-linux-arm64-musl": "15.4.8",
|
||||||
"@next/swc-linux-x64-gnu": "15.4.4",
|
"@next/swc-linux-x64-gnu": "15.4.8",
|
||||||
"@next/swc-linux-x64-musl": "15.4.4",
|
"@next/swc-linux-x64-musl": "15.4.8",
|
||||||
"@next/swc-win32-arm64-msvc": "15.4.4",
|
"@next/swc-win32-arm64-msvc": "15.4.8",
|
||||||
"@next/swc-win32-x64-msvc": "15.4.4",
|
"@next/swc-win32-x64-msvc": "15.4.8",
|
||||||
"sharp": "^0.34.3"
|
"sharp": "^0.34.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@
|
||||||
"leaflet": "^1.9.4",
|
"leaflet": "^1.9.4",
|
||||||
"lucide-react": "^0.525.0",
|
"lucide-react": "^0.525.0",
|
||||||
"mammoth": "^1.11.0",
|
"mammoth": "^1.11.0",
|
||||||
"next": "15.4.4",
|
"next": "^15.4.8",
|
||||||
"react": "19.1.0",
|
"react": "19.1.0",
|
||||||
"react-day-picker": "^9.11.1",
|
"react-day-picker": "^9.11.1",
|
||||||
"react-dnd": "^16.0.1",
|
"react-dnd": "^16.0.1",
|
||||||
|
|
|
||||||
|
|
@ -1679,3 +1679,4 @@ const 출고등록_설정: ScreenSplitPanel = {
|
||||||
|
|
||||||
화면 임베딩 및 데이터 전달 시스템은 복잡한 업무 워크플로우를 효율적으로 처리할 수 있는 강력한 기능입니다. 단계별로 체계적으로 구현하면 약 3.5개월 내에 완성할 수 있으며, 이를 통해 사용자 경험을 크게 향상시킬 수 있습니다.
|
화면 임베딩 및 데이터 전달 시스템은 복잡한 업무 워크플로우를 효율적으로 처리할 수 있는 강력한 기능입니다. 단계별로 체계적으로 구현하면 약 3.5개월 내에 완성할 수 있으며, 이를 통해 사용자 경험을 크게 향상시킬 수 있습니다.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -526,3 +526,4 @@ const { data: config } = await getScreenSplitPanel(screenId);
|
||||||
|
|
||||||
이제 입고 등록과 같은 복잡한 워크플로우를 구현할 수 있습니다. 다음 단계는 각 컴포넌트 타입별 DataReceivable 인터페이스 구현과 설정 UI 개발입니다.
|
이제 입고 등록과 같은 복잡한 워크플로우를 구현할 수 있습니다. 다음 단계는 각 컴포넌트 타입별 DataReceivable 인터페이스 구현과 설정 UI 개발입니다.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -513,3 +513,4 @@ function ScreenViewPage() {
|
||||||
|
|
||||||
새로운 시스템은 기존 시스템과 **독립적으로 동작**하며, 최소한의 수정만으로 통합 가능합니다. 화면 페이지에 조건 분기만 추가하면 바로 사용할 수 있습니다.
|
새로운 시스템은 기존 시스템과 **독립적으로 동작**하며, 최소한의 수정만으로 통합 가능합니다. 화면 페이지에 조건 분기만 추가하면 바로 사용할 수 있습니다.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue