Setting the file. One moment.
Subchapter 2.21
references/auto-patterns-dashboard/entity-page.mdMarkdown3 KBView on GitHub
interface EntityPageConfig {
type: 'entityPage';
entityPage: {
mode?: 'edit' | 'view'; // Default 'edit'
route: { path: string; params: { id: string } };
parentPageId: string; // REQUIRED
collectionId: string;
entityTypeSource: 'cms' | 'custom';
title?: {
text: string;
badges?: { id: string }; // Dynamic badges override ID
};
subtitle?: {
text: string;
id?: string; // Dynamic subtitle override ID
};
layout?: {
main: CardLayout[];
sidebar?: CardLayout[];
};
actions?: EntityPageActions; // See Action Rules
};
}
interface CardLayout {
type: 'card';
card: {
title?: { text: string };
children: LayoutContent[];
};
}
type LayoutContent = | { type: 'field'; field: { fieldId: string; span?: number } } | { type: 'container'; container: { children: LayoutContent[]; span?: number } } | { type: 'component'; component
// Override Types
type EntityPageHeaderSubtitle = (entity: any) => { text: string };
type EntityPageHeaderBadges = (entity: any) => {
text: string;
skin?: 'success' | 'warning' | 'destructive' | 'neutral' | 'premium';
prefixIcon?: ReactElement;
suffixIcon?: ReactElement;
}[];mode is undefined THEN defaults to 'edit'.mode: 'edit' THEN only moreActions supported.mode: 'view' THEN primaryActions, secondaryActions, moreActions supported.badges.id defined THEN implementation MUST return array of badge objects.subtitle.id defined THEN implementation MUST return { text: string }./[segment]/:entityId (NEVER /:entityId).route.params (e.g. { id: 'entityId' }).badges and subtitle if IDs are used.span (wraps if > 12).main layout, metadata in sidebar.// Config
{
type: 'entityPage',
entityPage: {
mode: 'view',
route: { path: '/pet/:entityId', params: { id: 'entityId' } },
parentPageId: 'pets-list',
collectionId: 'pets',
entityTypeSource: 'cms',
title: {
text: 'Pet Details',
badges: { id: 'petBadges' }
},
layout: {
main: [{
type: 'card',
card: {
title: { text: 'Info' },
children: [
{ type: 'field', field: { fieldId: 'name', span: 6 } },
{ type: 'field', field: { fieldId: 'age', span: 6 } }
]
}
}]
}
}
}
// Override Implementation
export const petBadges = (entity) => ([
{ text: entity.status, skin: entity.status === 'Active' ? 'success' : 'neutral' }
]);