로그 제거
This commit is contained in:
parent
a883187889
commit
4cdc72e360
|
|
@ -397,6 +397,11 @@ function ScreenViewPage() {
|
||||||
|
|
||||||
const regularComponents = topLevelComponents.filter((c) => !processedButtonIds.has(c.id));
|
const regularComponents = topLevelComponents.filter((c) => !processedButtonIds.has(c.id));
|
||||||
|
|
||||||
|
// TableSearchWidget들을 먼저 찾기
|
||||||
|
const tableSearchWidgets = regularComponents.filter(
|
||||||
|
(c) => (c as any).componentId === "table-search-widget"
|
||||||
|
);
|
||||||
|
|
||||||
// TableSearchWidget 높이 차이를 계산하여 Y 위치 조정
|
// TableSearchWidget 높이 차이를 계산하여 Y 위치 조정
|
||||||
const adjustedComponents = regularComponents.map((component) => {
|
const adjustedComponents = regularComponents.map((component) => {
|
||||||
const isTableSearchWidget = (component as any).componentId === "table-search-widget";
|
const isTableSearchWidget = (component as any).componentId === "table-search-widget";
|
||||||
|
|
@ -406,26 +411,15 @@ function ScreenViewPage() {
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableSearchWidget들을 찾아서 해당 위젯 아래에 있는지 확인
|
|
||||||
const tableSearchWidgets = regularComponents.filter(
|
|
||||||
(c) => (c as any).componentId === "table-search-widget"
|
|
||||||
);
|
|
||||||
|
|
||||||
let totalHeightAdjustment = 0;
|
let totalHeightAdjustment = 0;
|
||||||
|
|
||||||
for (const widget of tableSearchWidgets) {
|
for (const widget of tableSearchWidgets) {
|
||||||
// 현재 컴포넌트가 이 위젯 아래에 있는지 확인
|
// 현재 컴포넌트가 이 위젯 아래에 있는지 확인
|
||||||
if (component.position.y > widget.position.y) {
|
const isBelow = component.position.y > widget.position.y;
|
||||||
const heightDiff = getHeightDiff(screenId, widget.id);
|
const heightDiff = getHeightDiff(screenId, widget.id);
|
||||||
if (heightDiff > 0) {
|
|
||||||
totalHeightAdjustment += heightDiff;
|
if (isBelow && heightDiff > 0) {
|
||||||
console.log("📏 [ScreenView] 컴포넌트 위치 조정:", {
|
totalHeightAdjustment += heightDiff;
|
||||||
componentId: component.id,
|
|
||||||
originalY: component.position.y,
|
|
||||||
adjustment: heightDiff,
|
|
||||||
newY: component.position.y + heightDiff,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -206,12 +206,30 @@ export const FilterPanel: React.FC<Props> = ({ isOpen, onClose, onFiltersApplied
|
||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 초기화
|
// 초기화 (즉시 저장 및 적용)
|
||||||
const clearFilters = () => {
|
const clearFilters = () => {
|
||||||
setColumnFilters((prev) =>
|
const clearedFilters = columnFilters.map((filter) => ({
|
||||||
prev.map((filter) => ({ ...filter, enabled: false }))
|
...filter,
|
||||||
);
|
enabled: false
|
||||||
|
}));
|
||||||
|
|
||||||
|
setColumnFilters(clearedFilters);
|
||||||
setSelectAll(false);
|
setSelectAll(false);
|
||||||
|
|
||||||
|
// localStorage에서 제거
|
||||||
|
if (table?.tableName) {
|
||||||
|
const storageKey = `table_filters_${table.tableName}`;
|
||||||
|
localStorage.removeItem(storageKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 빈 필터 배열로 적용
|
||||||
|
table?.onFilterChange([]);
|
||||||
|
|
||||||
|
// 콜백으로 빈 필터 정보 전달
|
||||||
|
onFiltersApplied?.([]);
|
||||||
|
|
||||||
|
// 즉시 닫기
|
||||||
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
const enabledCount = columnFilters.filter((f) => f.enabled).length;
|
const enabledCount = columnFilters.filter((f) => f.enabled).length;
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,6 @@ export function TableSearchWidgetHeightProvider({ children }: { children: React.
|
||||||
originalHeight,
|
originalHeight,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("📏 [TableSearchWidgetHeightContext] 높이 저장:", {
|
|
||||||
key,
|
|
||||||
height,
|
|
||||||
originalHeight,
|
|
||||||
heightDiff: height - originalHeight,
|
|
||||||
});
|
|
||||||
|
|
||||||
return newMap;
|
return newMap;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -130,56 +130,27 @@ export function TableSearchWidget({ component, screenId, onHeightChange }: Table
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("🔄 [TableSearchWidget] select 옵션 초기 로드:", {
|
|
||||||
activeFiltersCount: activeFilters.length,
|
|
||||||
selectFiltersCount: selectFilters.length,
|
|
||||||
dataCount: currentTable.dataCount,
|
|
||||||
});
|
|
||||||
|
|
||||||
const newOptions: Record<string, Array<{ label: string; value: string }>> = { ...selectOptions };
|
const newOptions: Record<string, Array<{ label: string; value: string }>> = { ...selectOptions };
|
||||||
|
|
||||||
for (const filter of selectFilters) {
|
for (const filter of selectFilters) {
|
||||||
// 이미 로드된 옵션이 있으면 스킵 (초기값 유지)
|
// 이미 로드된 옵션이 있으면 스킵 (초기값 유지)
|
||||||
if (newOptions[filter.columnName] && newOptions[filter.columnName].length > 0) {
|
if (newOptions[filter.columnName] && newOptions[filter.columnName].length > 0) {
|
||||||
console.log("⏭️ [TableSearchWidget] 이미 로드된 옵션 스킵:", filter.columnName);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = await currentTable.getColumnUniqueValues(filter.columnName);
|
const options = await currentTable.getColumnUniqueValues(filter.columnName);
|
||||||
newOptions[filter.columnName] = options;
|
newOptions[filter.columnName] = options;
|
||||||
console.log("✅ [TableSearchWidget] select 옵션 로드:", {
|
|
||||||
columnName: filter.columnName,
|
|
||||||
optionCount: options.length,
|
|
||||||
options: options.slice(0, 5),
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("❌ [TableSearchWidget] select 옵션 로드 실패:", filter.columnName, error);
|
console.error("❌ [TableSearchWidget] select 옵션 로드 실패:", filter.columnName, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("✅ [TableSearchWidget] 최종 selectOptions:", newOptions);
|
|
||||||
setSelectOptions(newOptions);
|
setSelectOptions(newOptions);
|
||||||
};
|
};
|
||||||
|
|
||||||
loadSelectOptions();
|
loadSelectOptions();
|
||||||
}, [activeFilters, currentTable?.tableName, currentTable?.getColumnUniqueValues]); // dataCount 제거, tableName으로 변경
|
}, [activeFilters, currentTable?.tableName, currentTable?.getColumnUniqueValues]); // dataCount 제거, tableName으로 변경
|
||||||
|
|
||||||
// 디버깅: 현재 테이블 정보 로깅
|
|
||||||
useEffect(() => {
|
|
||||||
if (currentTable) {
|
|
||||||
console.log("🔍 [TableSearchWidget] 현재 테이블 정보:", {
|
|
||||||
selectedTableId,
|
|
||||||
tableId: currentTable.tableId,
|
|
||||||
tableName: currentTable.tableName,
|
|
||||||
label: currentTable.label,
|
|
||||||
dataCount: currentTable.dataCount,
|
|
||||||
hasDataCount: currentTable.dataCount !== undefined,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.log("🔍 [TableSearchWidget] 테이블 없음:", { selectedTableId });
|
|
||||||
}
|
|
||||||
}, [selectedTableId, currentTable?.dataCount]);
|
|
||||||
|
|
||||||
// 높이 변화 감지 및 알림 (실제 화면에서만)
|
// 높이 변화 감지 및 알림 (실제 화면에서만)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -192,14 +163,6 @@ export function TableSearchWidget({ component, screenId, onHeightChange }: Table
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
const newHeight = entry.contentRect.height;
|
const newHeight = entry.contentRect.height;
|
||||||
|
|
||||||
console.log("📏 [TableSearchWidget] 높이 변화 감지:", {
|
|
||||||
screenId,
|
|
||||||
componentId: component.id,
|
|
||||||
originalHeight,
|
|
||||||
newHeight,
|
|
||||||
heightDiff: newHeight - originalHeight,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Context에 높이 저장 (다른 컴포넌트 위치 조정에 사용)
|
// Context에 높이 저장 (다른 컴포넌트 위치 조정에 사용)
|
||||||
setWidgetHeight(screenId, component.id, newHeight, originalHeight);
|
setWidgetHeight(screenId, component.id, newHeight, originalHeight);
|
||||||
|
|
||||||
|
|
@ -234,14 +197,6 @@ export function TableSearchWidget({ component, screenId, onHeightChange }: Table
|
||||||
try {
|
try {
|
||||||
const { height, originalHeight } = JSON.parse(savedData);
|
const { height, originalHeight } = JSON.parse(savedData);
|
||||||
setWidgetHeight(screenId, component.id, height, originalHeight);
|
setWidgetHeight(screenId, component.id, height, originalHeight);
|
||||||
|
|
||||||
console.log("📥 [TableSearchWidget] 저장된 높이 복원:", {
|
|
||||||
screenId,
|
|
||||||
componentId: component.id,
|
|
||||||
height,
|
|
||||||
originalHeight,
|
|
||||||
heightDiff: height - originalHeight,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("저장된 높이 복원 실패:", error);
|
console.error("저장된 높이 복원 실패:", error);
|
||||||
}
|
}
|
||||||
|
|
@ -252,12 +207,6 @@ export function TableSearchWidget({ component, screenId, onHeightChange }: Table
|
||||||
|
|
||||||
// 필터 값 변경 핸들러
|
// 필터 값 변경 핸들러
|
||||||
const handleFilterChange = (columnName: string, value: string) => {
|
const handleFilterChange = (columnName: string, value: string) => {
|
||||||
console.log("🔍 [TableSearchWidget] 필터 값 변경:", {
|
|
||||||
columnName,
|
|
||||||
value,
|
|
||||||
currentTable: currentTable?.tableId,
|
|
||||||
});
|
|
||||||
|
|
||||||
const newValues = {
|
const newValues = {
|
||||||
...filterValues,
|
...filterValues,
|
||||||
[columnName]: value,
|
[columnName]: value,
|
||||||
|
|
@ -277,13 +226,6 @@ export function TableSearchWidget({ component, screenId, onHeightChange }: Table
|
||||||
value: values[filter.columnName] || "",
|
value: values[filter.columnName] || "",
|
||||||
})).filter((f) => f.value !== "");
|
})).filter((f) => f.value !== "");
|
||||||
|
|
||||||
console.log("🔍 [TableSearchWidget] 필터 적용:", {
|
|
||||||
activeFilters: activeFilters.length,
|
|
||||||
filtersWithValues: filtersWithValues.length,
|
|
||||||
filters: filtersWithValues,
|
|
||||||
hasOnFilterChange: !!currentTable?.onFilterChange,
|
|
||||||
});
|
|
||||||
|
|
||||||
currentTable?.onFilterChange(filtersWithValues);
|
currentTable?.onFilterChange(filtersWithValues);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -328,12 +270,6 @@ export function TableSearchWidget({ component, screenId, onHeightChange }: Table
|
||||||
case "select": {
|
case "select": {
|
||||||
let options = selectOptions[filter.columnName] || [];
|
let options = selectOptions[filter.columnName] || [];
|
||||||
|
|
||||||
console.log("🔍 [renderFilterInput] select 렌더링:", {
|
|
||||||
columnName: filter.columnName,
|
|
||||||
selectOptions: selectOptions[filter.columnName],
|
|
||||||
optionsLength: options.length,
|
|
||||||
});
|
|
||||||
|
|
||||||
// 현재 선택된 값이 옵션 목록에 없으면 추가 (데이터 없을 때도 선택값 유지)
|
// 현재 선택된 값이 옵션 목록에 없으면 추가 (데이터 없을 때도 선택값 유지)
|
||||||
if (value && !options.find(opt => opt.value === value)) {
|
if (value && !options.find(opt => opt.value === value)) {
|
||||||
const savedLabel = selectedLabels[filter.columnName] || value;
|
const savedLabel = selectedLabels[filter.columnName] || value;
|
||||||
|
|
@ -348,14 +284,6 @@ export function TableSearchWidget({ component, screenId, onHeightChange }: Table
|
||||||
return acc;
|
return acc;
|
||||||
}, [] as Array<{ value: string; label: string }>);
|
}, [] as Array<{ value: string; label: string }>);
|
||||||
|
|
||||||
console.log("✅ [renderFilterInput] uniqueOptions:", {
|
|
||||||
columnName: filter.columnName,
|
|
||||||
originalOptionsLength: options.length,
|
|
||||||
uniqueOptionsLength: uniqueOptions.length,
|
|
||||||
originalOptions: options,
|
|
||||||
uniqueOptions: uniqueOptions,
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
value={value}
|
value={value}
|
||||||
|
|
@ -455,10 +383,7 @@ export function TableSearchWidget({ component, screenId, onHeightChange }: Table
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => {
|
onClick={() => setColumnVisibilityOpen(true)}
|
||||||
console.log("🔘 [TableSearchWidget] 테이블 옵션 버튼 클릭");
|
|
||||||
setColumnVisibilityOpen(true);
|
|
||||||
}}
|
|
||||||
disabled={!selectedTableId}
|
disabled={!selectedTableId}
|
||||||
className="h-8 text-xs sm:h-9 sm:text-sm"
|
className="h-8 text-xs sm:h-9 sm:text-sm"
|
||||||
>
|
>
|
||||||
|
|
@ -469,10 +394,7 @@ export function TableSearchWidget({ component, screenId, onHeightChange }: Table
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => {
|
onClick={() => setFilterOpen(true)}
|
||||||
console.log("🔘 [TableSearchWidget] 필터 설정 버튼 클릭");
|
|
||||||
setFilterOpen(true);
|
|
||||||
}}
|
|
||||||
disabled={!selectedTableId}
|
disabled={!selectedTableId}
|
||||||
className="h-8 text-xs sm:h-9 sm:text-sm"
|
className="h-8 text-xs sm:h-9 sm:text-sm"
|
||||||
>
|
>
|
||||||
|
|
@ -483,10 +405,7 @@ export function TableSearchWidget({ component, screenId, onHeightChange }: Table
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => {
|
onClick={() => setGroupingOpen(true)}
|
||||||
console.log("🔘 [TableSearchWidget] 그룹 설정 버튼 클릭");
|
|
||||||
setGroupingOpen(true);
|
|
||||||
}}
|
|
||||||
disabled={!selectedTableId}
|
disabled={!selectedTableId}
|
||||||
className="h-8 text-xs sm:h-9 sm:text-sm"
|
className="h-8 text-xs sm:h-9 sm:text-sm"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue