import { Formatter } from '@nodata/redux-utils'; import { Grid } from './Grid.js'; import { Resource, ResourceEvents } from './Resource.js'; /** * A page contains informations about what it contains. * And the navigation logic: * - If the page have a next element. * - If the page have a branch element. * * @prop id The page technical identifier. * @prop label The page label, shown in the summary. * @prop events The events applied on all grid children in the page. * @prop next The next element after the current one. * @prop branch The sub element of this page. * @prop content The resources of this element. */ export interface Page { readonly branch?: Page; readonly content?: PageContent; readonly id?: PageId; readonly label?: PageLabel; readonly next?: Page; readonly events?: ResourceEvents; } export type PageId = Formatter; export type PageLabel = Formatter; /** * The page content can be a grid or a resource. * * @prop type The type configuration. */ export type PageContent = PageContentTypeObject & (Grid | Resource); export interface PageContentTypeObject { readonly type?: PageContentType; } export type PageContentType = Formatter<'grid' | 'resource'>;