import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
import * as __WEBPACK_EXTERNAL_MODULE__index_mjs__ from "./index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../schema-component/index.mjs";
function useCollectionDataSource(filter) {
    const compile = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useCompile)();
    const { collections = [] } = (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.useCollectionManager_deprecated)();
    return (field)=>{
        __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.action.bound((data)=>{
            const filtered = 'function' == typeof filter ? data.filter(filter) : data;
            field.dataSource = filtered.map((item)=>({
                    label: compile(item.title),
                    value: item.name
                }));
        })(collections);
    };
}
export { useCollectionDataSource };
