import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as a,useEffect as i}from"react";import{DICTIONARY_APP_KEY_ENUM as t}from"../../../enum/dictionary/index.js";import{executeWithCache as r}from"../../../utils/index.js";import o from"../Basic/index.js";import{jsx as c}from"react/jsx-runtime";function n(n){const{appKey:s=t.DEFAULT,dictValue:d="",nameKey:m="dictLabel",idKey:p="dictValue",...u}=n,[y,l]=a([]);return i(()=>{(async()=>{if(!Object.values(t).includes(s))return void console.error(`【DictionaryCascader】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中，当前传入的 appKey 是 ${s}`);if(!d)return void console.error("【DictionaryCascader】 缺少 dictValue 参数");const a={appKey:s,dictValue:d};await r(a,async()=>{const{data:a}=await e("/config/dict-trees/list/by/dictValues","get",{appKey:s,dictValue:d});return a},l)})()},[d]),c(o,{data:y,nameKey:m,idKey:p,...u})}n.displayName="DictionaryCascader";export{n as default};
