@packtrack/layout 1.3.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.built/source/layout.js +8 -8
- package/package.json +1 -1
- package/source/layout.ts +11 -10
package/.built/source/layout.js
CHANGED
|
@@ -241,7 +241,6 @@ export class Layout {
|
|
|
241
241
|
}
|
|
242
242
|
linkRouter(source, router) {
|
|
243
243
|
let child = source.firstChild;
|
|
244
|
-
let active;
|
|
245
244
|
while (child) {
|
|
246
245
|
if (child.tagName == 'route') {
|
|
247
246
|
const route = new Route(child.getAttribute('name'), router);
|
|
@@ -249,17 +248,18 @@ export class Layout {
|
|
|
249
248
|
route.in.out = router;
|
|
250
249
|
route.out = this.findSection(child.getAttribute('out'), router.district);
|
|
251
250
|
route.out.in = router;
|
|
252
|
-
if (child.hasAttribute('active')) {
|
|
253
|
-
if (active) {
|
|
254
|
-
throw new Error(`Router '${router.domainName}' has multiple active routes (${active.name}, ${route.name}).`);
|
|
255
|
-
}
|
|
256
|
-
active = route;
|
|
257
|
-
}
|
|
258
251
|
router.routes.push(route);
|
|
259
252
|
}
|
|
260
253
|
child = child.nextSibling;
|
|
261
254
|
}
|
|
262
|
-
|
|
255
|
+
const active = source.getAttribute('active');
|
|
256
|
+
if (active) {
|
|
257
|
+
const route = router.routes.find(route => route.name == active);
|
|
258
|
+
if (!route) {
|
|
259
|
+
throw new Error(`Router '${router.domainName}' cannot have active route '${active}': Router has no such route (available: ${router.routes.map(route => route.name).join(', ')})`);
|
|
260
|
+
}
|
|
261
|
+
router.activeRoute = route;
|
|
262
|
+
}
|
|
263
263
|
}
|
|
264
264
|
loadPowerDistrict(source, district) {
|
|
265
265
|
const powerDistrict = new PowerDistrict(source.getAttribute('name'), district);
|
package/package.json
CHANGED
package/source/layout.ts
CHANGED
|
@@ -343,7 +343,6 @@ export class Layout {
|
|
|
343
343
|
|
|
344
344
|
linkRouter(source, router: Router) {
|
|
345
345
|
let child = source.firstChild;
|
|
346
|
-
let active: Route;
|
|
347
346
|
|
|
348
347
|
while (child) {
|
|
349
348
|
if (child.tagName == 'route') {
|
|
@@ -355,21 +354,23 @@ export class Layout {
|
|
|
355
354
|
route.out = this.findSection(child.getAttribute('out'), router.district);
|
|
356
355
|
route.out.in = router;
|
|
357
356
|
|
|
358
|
-
if (child.hasAttribute('active')) {
|
|
359
|
-
if (active) {
|
|
360
|
-
throw new Error(`Router '${router.domainName}' has multiple active routes (${active.name}, ${route.name}).`);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
active = route;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
357
|
router.routes.push(route);
|
|
367
358
|
}
|
|
368
359
|
|
|
369
360
|
child = child.nextSibling;
|
|
370
361
|
}
|
|
371
362
|
|
|
372
|
-
|
|
363
|
+
const active = source.getAttribute('active');
|
|
364
|
+
|
|
365
|
+
if (active) {
|
|
366
|
+
const route = router.routes.find(route => route.name == active);
|
|
367
|
+
|
|
368
|
+
if (!route) {
|
|
369
|
+
throw new Error(`Router '${router.domainName}' cannot have active route '${active}': Router has no such route (available: ${router.routes.map(route => route.name).join(', ')})`);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
router.activeRoute = route;
|
|
373
|
+
}
|
|
373
374
|
}
|
|
374
375
|
|
|
375
376
|
loadPowerDistrict(source, district: District) {
|