diff --git a/frontend/lib/registry/components/select-basic/SelectBasicComponent.tsx b/frontend/lib/registry/components/select-basic/SelectBasicComponent.tsx index 9f151509..0e438da6 100644 --- a/frontend/lib/registry/components/select-basic/SelectBasicComponent.tsx +++ b/frontend/lib/registry/components/select-basic/SelectBasicComponent.tsx @@ -138,6 +138,53 @@ const SelectBasicComponent: React.FC = ({ isFetching, } = useCodeOptions(codeCategory, isCodeCategoryValid, menuObjid); + // ๐Ÿ†• ์นดํ…Œ๊ณ ๋ฆฌ ํƒ€์ž… (category webType)์„ ์œ„ํ•œ ์˜ต์…˜ ๋กœ๋”ฉ + const [categoryOptions, setCategoryOptions] = useState([]); + const [isLoadingCategories, setIsLoadingCategories] = useState(false); + + useEffect(() => { + if (webType === "category" && component.tableName && component.columnName) { + console.log("๐Ÿ” [SelectBasic] ์นดํ…Œ๊ณ ๋ฆฌ ๊ฐ’ ๋กœ๋”ฉ ์‹œ์ž‘:", { + tableName: component.tableName, + columnName: component.columnName, + webType, + }); + + setIsLoadingCategories(true); + + import("@/lib/api/tableCategoryValue").then(({ getCategoryValues }) => { + getCategoryValues(component.tableName!, component.columnName!) + .then((response) => { + console.log("๐Ÿ” [SelectBasic] ์นดํ…Œ๊ณ ๋ฆฌ API ์‘๋‹ต:", response); + + if (response.success && response.data) { + const activeValues = response.data.filter((v) => v.isActive !== false); + const options = activeValues.map((v) => ({ + value: v.categoryValue, + label: v.categoryLabel || v.categoryValue, + })); + + console.log("โœ… [SelectBasic] ์นดํ…Œ๊ณ ๋ฆฌ ์˜ต์…˜ ์„ค์ •:", { + activeValuesCount: activeValues.length, + options, + sampleOption: options[0], + }); + + setCategoryOptions(options); + } else { + console.error("โŒ [SelectBasic] ์นดํ…Œ๊ณ ๋ฆฌ ์‘๋‹ต ์‹คํŒจ:", response); + } + }) + .catch((error) => { + console.error("โŒ [SelectBasic] ์นดํ…Œ๊ณ ๋ฆฌ ๊ฐ’ ์กฐํšŒ ์‹คํŒจ:", error); + }) + .finally(() => { + setIsLoadingCategories(false); + }); + }); + } + }, [webType, component.tableName, component.columnName]); + // ๋””๋ฒ„๊น…: menuObjid๊ฐ€ ์ œ๋Œ€๋กœ ์ „๋‹ฌ๋˜๋Š”์ง€ ํ™•์ธ useEffect(() => { if (codeCategory && codeCategory !== "none") { @@ -176,7 +223,7 @@ const SelectBasicComponent: React.FC = ({ useEffect(() => { const getAllOptions = () => { const configOptions = config.options || []; - return [...codeOptions, ...configOptions]; + return [...codeOptions, ...categoryOptions, ...configOptions]; }; const options = getAllOptions(); @@ -252,12 +299,24 @@ const SelectBasicComponent: React.FC = ({ // ๋ชจ๋“  ์˜ต์…˜ ๊ฐ€์ ธ์˜ค๊ธฐ const getAllOptions = () => { const configOptions = config.options || []; - return [...codeOptions, ...configOptions]; + return [...codeOptions, ...categoryOptions, ...configOptions]; }; const allOptions = getAllOptions(); const placeholder = componentConfig.placeholder || "์„ ํƒํ•˜์„ธ์š”"; + // ๐Ÿ” ๋””๋ฒ„๊น…: ์ตœ์ข… ์˜ต์…˜ ํ™•์ธ + useEffect(() => { + if (webType === "category" && allOptions.length > 0) { + console.log("๐Ÿ” [SelectBasic] ์ตœ์ข… allOptions:", { + count: allOptions.length, + categoryOptionsCount: categoryOptions.length, + codeOptionsCount: codeOptions.length, + sampleOptions: allOptions.slice(0, 3), + }); + } + }, [webType, allOptions.length, categoryOptions.length, codeOptions.length]); + // DOM props์—์„œ React ์ „์šฉ props ํ•„ํ„ฐ๋ง const { component: _component, @@ -590,7 +649,7 @@ const SelectBasicComponent: React.FC = ({ {isOpen && !isDesignMode && (
- {isLoadingCodes ? ( + {(isLoadingCodes || isLoadingCategories) ? (
๋กœ๋”ฉ ์ค‘...
) : allOptions.length > 0 ? ( allOptions.map((option, index) => {