fix(pop-card-list): 원본 컴포넌트 선택 안 되는 문제 수정
- CartListModeConfig에 sourceComponentId 추가 - cartType이 빈 문자열인 경우 componentId로 매칭 - Select value: sourceComponentId 기반 안정적 매칭 - 런타임: sourceComponentId > cartType > 첫 번째 순으로 폴백 원인: 4160 화면의 cartAction에 cartType 미설정 -> 빈 문자열 -> Select 저장 시 undefined 순환 -> 선택 불가
This commit is contained in:
parent
c1cf31f57b
commit
220e05d2ae
|
|
@ -515,7 +515,10 @@ export function PopCardListComponent({
|
||||||
const layoutJson = await screenApi.getLayoutPop(cartListMode.sourceScreenId);
|
const layoutJson = await screenApi.getLayoutPop(cartListMode.sourceScreenId);
|
||||||
const componentsMap = layoutJson?.components || {};
|
const componentsMap = layoutJson?.components || {};
|
||||||
const componentList = Object.values(componentsMap) as any[];
|
const componentList = Object.values(componentsMap) as any[];
|
||||||
const matched = cartListMode.cartType
|
// sourceComponentId > cartType > 첫 번째 pop-card-list 순으로 매칭
|
||||||
|
const matched = cartListMode.sourceComponentId
|
||||||
|
? componentList.find((c: any) => c.id === cartListMode.sourceComponentId)
|
||||||
|
: cartListMode.cartType
|
||||||
? componentList.find(
|
? componentList.find(
|
||||||
(c: any) =>
|
(c: any) =>
|
||||||
c.type === "pop-card-list" &&
|
c.type === "pop-card-list" &&
|
||||||
|
|
|
||||||
|
|
@ -933,15 +933,18 @@ function CartListModeSection({
|
||||||
|
|
||||||
const handleComponentSelect = (val: string) => {
|
const handleComponentSelect = (val: string) => {
|
||||||
if (val === "__none__") {
|
if (val === "__none__") {
|
||||||
onUpdate({ ...mode, cartType: undefined });
|
onUpdate({ ...mode, cartType: undefined, sourceComponentId: undefined });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// cartType 직접 매칭 또는 componentId 매칭 (__comp_ 접두사)
|
|
||||||
const found = val.startsWith("__comp_")
|
const found = val.startsWith("__comp_")
|
||||||
? sourceCardLists.find((c) => c.componentId === val.replace("__comp_", ""))
|
? sourceCardLists.find((c) => c.componentId === val.replace("__comp_", ""))
|
||||||
: sourceCardLists.find((c) => c.cartType === val);
|
: sourceCardLists.find((c) => c.cartType === val);
|
||||||
if (found) {
|
if (found) {
|
||||||
onUpdate({ ...mode, cartType: found.cartType || undefined });
|
onUpdate({
|
||||||
|
...mode,
|
||||||
|
sourceComponentId: found.componentId,
|
||||||
|
cartType: found.cartType || undefined,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -997,7 +1000,11 @@ function CartListModeSection({
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<Select
|
<Select
|
||||||
value={mode.cartType || "__none__"}
|
value={
|
||||||
|
mode.sourceComponentId
|
||||||
|
? (sourceCardLists.find(c => c.componentId === mode.sourceComponentId)?.cartType || `__comp_${mode.sourceComponentId}`)
|
||||||
|
: mode.cartType || "__none__"
|
||||||
|
}
|
||||||
onValueChange={handleComponentSelect}
|
onValueChange={handleComponentSelect}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="mt-1 h-7 text-xs">
|
<SelectTrigger className="mt-1 h-7 text-xs">
|
||||||
|
|
|
||||||
|
|
@ -613,6 +613,7 @@ export interface CardResponsiveConfig {
|
||||||
export interface CartListModeConfig {
|
export interface CartListModeConfig {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
sourceScreenId?: number;
|
sourceScreenId?: number;
|
||||||
|
sourceComponentId?: string;
|
||||||
cartType?: string;
|
cartType?: string;
|
||||||
statusFilter?: string;
|
statusFilter?: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue