UNPKG

apphouse

Version:

Component library for React that uses observable state management and theme-able components.

73 lines (72 loc) 1.99 kB
import { AppLayoutType } from '../models/AppLayout'; import { Route } from './routing/route.interface'; declare class PartialView { id: string; open: boolean; updatedAt: number; constructor(props: { id: string; open: boolean; }); setOpen(open: boolean): void; } export interface IView { appName?: string; appLayout?: AppLayoutType; routes?: Route[]; } /** * A model to handle views in the app. * This will be similar to a route in a traditional web app. */ declare class View { path: string; title: string; updated: number; tabIndex?: number; tabId?: string; sectionId?: string; params?: { [key: string]: string; }; routes: Route[]; /** * Handles partial views states such as tabs, sections, etc. * To be able to access them from anywhere in the app. */ views: { [key: string]: PartialView; }; constructor(props?: IView); get openedViewsByMostRecent(): PartialView[]; get currentPath(): string; get currentParams(): { [key: string]: string; }; get crumbs(): string[]; open: (path: string, title?: string, onOpen?: () => void) => void; openTab: (tabId?: string, tabIndex?: number) => void; closeTab: () => void; openSection: () => void; setParams: (params: { [key: string]: string; }) => void; setRoutes: (routes: Route[]) => void; /** * Sets a partial view in the app * @param id string the id of the partial view * @param open boolean to set the partial view open or closed */ setView: (id: string, open: boolean) => void; toggleView: (id: string) => void; closeAllOpenViews: () => void; getViewStatus: (id: string) => boolean; deleteAllViews: () => void; closeMostRecentOpenedView: () => void; private setSectionId; private setTabIndex; private setTitle; private setTabId; private setPath; } export default View;