UNPKG

@premieroctet/next-admin

Version:

Next-Admin provides a customizable and turnkey admin dashboard for applications built with Next.js and powered by the Prisma ORM. It aims to simplify the development process by providing a turnkey admin system that can be easily integrated into your proje

23 lines (22 loc) 827 B
const getCustomInputs = (model, options)=>{ const editFields = options?.model?.[model]?.edit?.fields; const customFields = options?.model?.[model]?.edit?.customFields; const inputs = { ...editFields, ...customFields }; return Object.keys(inputs ?? {}).reduce((acc, field)=>{ const input = inputs?.[field]?.input; if (input) acc[field] = input; return acc; }, {}); }; const getClientActionsComponents = (model, options)=>{ const modelClientActions = options?.model?.[model]?.actions?.filter((action)=>"dialog" === action.type); return modelClientActions?.reduce((acc, val)=>{ const component = val.component; if (component) acc[val.id] = component; return acc; }, {}); }; export { getClientActionsComponents, getCustomInputs };