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