UNPKG

5.25 kBTypeScriptView Raw
1import { Injector, Type } from '@angular/core';
2import { ActivatedRouteSnapshot, Route } from '@angular/router';
3import { Controller } from './controller';
4import { FramingNgModule } from './framing-ng-module';
5/**
6 * @description This is a description
7 */
8export declare abstract class Framer<Model, View> {
9 private static _nextId;
10 /**
11 * The name of this framer.
12 */
13 readonly abstract framerName: string;
14 /**
15 * Model accessor.
16 */
17 readonly theModel: Model;
18 /**
19 * View accessor.
20 */
21 readonly theView: View;
22 /**
23 * Controller accessor.
24 */
25 readonly theController: Type<Controller<Model, View>>;
26 /**
27 * When true, framing will create a frame for this framer.
28 */
29 readonly createFrame: boolean;
30 /**
31 * When true, framing will use multi on all providers so multiple framers of the same type can be setup on the same module.
32 */
33 readonly multiFramer: boolean;
34 /**
35 * When true, framing will setup the controller as a provider by its type.
36 */
37 readonly provideControllerByType: boolean;
38 /**
39 * When true, framing will add the model to the route data.
40 */
41 readonly addModelToRouteData: boolean;
42 /**
43 * When true, framing will add the view to the route data.
44 */
45 readonly addViewToRouteData: boolean;
46 /**
47 * When true, framing will add the frame to the route data.
48 */
49 readonly addFrameToRouteData: boolean;
50 /**
51 * The default model.
52 */
53 readonly defaultModel: Model;
54 /**
55 * The default view.
56 */
57 readonly defaultView: View;
58 /**
59 * The default controller.
60 */
61 readonly defaultController: Type<Controller<Model, View>>;
62 /**
63 * 'require': framing will attach the default route, creating it if it doesn't yet exist, if not route is attached to this framer (default behavior)
64 * 'auto': framing will attach the default route if available if not route is attached to this framer
65 * 'none': framing will not attach a route to this framer
66 */
67 readonly routeRule: ('require' | 'auto' | 'none');
68 /**
69 * A unique framer id for this framer.
70 */
71 readonly framerId: number;
72 /**
73 * A unique identifier string for this framer instance.
74 */
75 readonly framerIdent: string;
76 /**
77 * True if framing() has been called.
78 */
79 readonly framed: boolean;
80 /**
81 * The injector (available on and after framerOnResolveRoute or framerOnControllerInit, whichever comes first)
82 */
83 readonly injector: Injector;
84 /**
85 * The framer's route, if attached to a route, otherwise undefined
86 * Valid ONLY during the runFraming() and framing() functions
87 */
88 readonly route: Route;
89 /**
90 * A unique framer id for this framer.
91 */
92 private _framerId;
93 /**
94 * True if framing() has been called.
95 */
96 private _framed;
97 /**
98 * The model.
99 */
100 private _model;
101 /**
102 * The view.
103 */
104 private _view;
105 /**
106 * The controller.
107 */
108 private _controller;
109 /**
110 * The frame.
111 */
112 private _frame;
113 /**
114 * The framer's injector.
115 */
116 private _injector;
117 /**
118 * The framer's route, if attached to a route, otherwise undefined
119 * Valid ONLY during the runFraming() and framing() functions
120 */
121 private _route;
122 /**
123 * Reference to the framer's FramingNgModule.
124 * Valid ONLY during the framing() function
125 */
126 private _framing;
127 /**
128 * Helper function to build the URL of an ActivatedRouteSnapshot
129 */
130 static buildUrlLink(route: ActivatedRouteSnapshot): string;
131 /**
132 * Model chaining function.
133 */
134 model(model?: Model): Framer<Model, View>;
135 /**
136 * View chaining function.
137 */
138 view(view?: View): Framer<Model, View>;
139 /**
140 * Controller chaining function.
141 */
142 controller(controller?: Type<Controller<Model, View>>): Framer<Model, View>;
143 /**
144 * The frame function.
145 */
146 abstract frame(framing: FramingNgModule): void;
147 /**
148 * Framer on resolve route function called when framer's route is resolved.
149 * Injector is set before during this call.
150 * Not called if framer is not attached to a route.
151 * To be overwritten if needed.
152 */
153 framerOnResolveRoute(): void;
154 /**
155 * Framer on controller init function is called when the controller is first injected.
156 * To be overwritten if needed.
157 */
158 framerOnControllerInit(controller: Controller<Model, View>): void;
159 /**
160 * Calls derived framing()
161 */
162 runFraming(framing: FramingNgModule, routeParam?: Route): void;
163 /**
164 * Contructor.
165 */
166 constructor(model?: Model, view?: View, controller?: Type<Controller<Model, View>>);
167 /**
168 * Protected construct function for derived construction help.
169 */
170 protected construct(model?: Model, view?: View, controller?: Type<Controller<Model, View>>): void;
171 /**
172 * Protected construct function for derived construction help.
173 */
174 private findActivateRouteSnapshot(route);
175 /**
176 * FUTURE
177 */
178 /**
179 * FUTURE
180 */
181 /**
182 * FUTURE
183 */
184 private addRouteData(framing, name, value);
185}