@coolon/angular-ui-powerups 0.0.37 → 0.0.38
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/bundles/coolon-angular-ui-powerups.umd.js +1427 -808
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.d.ts +16 -14
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +16 -14
- package/esm2015/index.js +2 -2
- package/esm2015/lib/angular-ui-powerups.module.js +6 -8
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +1 -2
- package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +1 -2
- package/esm2015/lib/place/components/abstract-place-navigation.component.js +75 -0
- package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js +47 -0
- package/esm2015/lib/place/components/place-outlet/route-animations.js +12 -5
- package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +5 -39
- package/esm2015/lib/place/guards/leave-place.guard.js +11 -2
- package/esm2015/lib/place/guards/place-route.guard.js +29 -37
- package/esm2015/lib/place/index.js +11 -9
- package/esm2015/lib/place/nav-item.js +23 -0
- package/esm2015/lib/place/place-component-like.js +17 -0
- package/esm2015/lib/place/place-component.js +118 -14
- package/esm2015/lib/place/place-updates-service.js +16 -0
- package/esm2015/lib/place/place.decorator.js +1 -1
- package/esm2015/lib/place/place.module.js +6 -3
- package/esm2015/lib/place/place.service.js +30 -6
- package/esm2015/lib/place/route/default-parameter-sanitiser.js +78 -0
- package/esm2015/lib/place/route/parameter-decorators.js +15 -7
- package/esm2015/lib/place/route/parameter-definition.class.js +2 -2
- package/esm2015/lib/place/route/parameter-sanitiser.js +17 -2
- package/esm2015/lib/place/route/parameter-snapshot.js +382 -0
- package/esm2015/lib/place/route/parameter-type.js +3 -2
- package/esm2015/lib/place/route/route-parameter-sanitiser.js +73 -38
- package/esm2015/lib/place/visit.js +22 -0
- package/esm2015/public_api.js +2 -2
- package/esm5/coolon-angular-ui-powerups.js +16 -14
- package/esm5/index.js +2 -2
- package/esm5/lib/angular-ui-powerups.module.js +6 -8
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +1 -2
- package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +1 -2
- package/esm5/lib/place/components/abstract-place-navigation.component.js +86 -0
- package/esm5/lib/place/components/list-place-nav/list-place-nav.component.js +61 -0
- package/esm5/lib/place/components/place-outlet/route-animations.js +12 -5
- package/esm5/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +6 -43
- package/esm5/lib/place/guards/leave-place.guard.js +11 -2
- package/esm5/lib/place/guards/place-route.guard.js +28 -37
- package/esm5/lib/place/index.js +11 -9
- package/esm5/lib/place/nav-item.js +23 -0
- package/esm5/lib/place/place-component-like.js +17 -0
- package/esm5/lib/place/place-component.js +132 -15
- package/esm5/lib/place/place-updates-service.js +16 -0
- package/esm5/lib/place/place.decorator.js +1 -1
- package/esm5/lib/place/place.module.js +6 -3
- package/esm5/lib/place/place.service.js +35 -6
- package/esm5/lib/place/route/default-parameter-sanitiser.js +85 -0
- package/esm5/lib/place/route/parameter-decorators.js +15 -7
- package/esm5/lib/place/route/parameter-definition.class.js +2 -2
- package/esm5/lib/place/route/parameter-sanitiser.js +17 -2
- package/esm5/lib/place/route/parameter-snapshot.js +474 -0
- package/esm5/lib/place/route/parameter-type.js +3 -2
- package/esm5/lib/place/route/route-parameter-sanitiser.js +100 -45
- package/esm5/lib/place/visit.js +22 -0
- package/esm5/public_api.js +2 -2
- package/fesm2015/coolon-angular-ui-powerups.js +1145 -650
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +1390 -778
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/place/components/abstract-place-navigation.component.d.ts +13 -0
- package/lib/place/components/list-place-nav/list-place-nav.component.d.ts +8 -0
- package/lib/place/components/place-outlet/route-animations.d.ts +1 -0
- package/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.d.ts +2 -9
- package/lib/place/guards/place-route.guard.d.ts +4 -4
- package/lib/place/index.d.ts +8 -6
- package/lib/place/nav-item.d.ts +5 -0
- package/lib/place/{i-place-component.d.ts → place-component-like.d.ts} +1 -1
- package/lib/place/place-component.d.ts +19 -8
- package/lib/place/place-updates-service.d.ts +10 -0
- package/lib/place/place.service.d.ts +11 -8
- package/lib/place/route/default-parameter-sanitiser.d.ts +13 -0
- package/lib/place/route/parameter-decorators.d.ts +6 -2
- package/lib/place/route/parameter-definition.class.d.ts +3 -3
- package/lib/place/route/parameter-sanitiser.d.ts +8 -1
- package/lib/place/route/parameter-snapshot.d.ts +46 -0
- package/lib/place/route/route-parameter-sanitiser.d.ts +13 -9
- package/lib/place/visit.d.ts +6 -0
- package/package.json +1 -1
- package/schematics/place-routes/index.js +8 -95
- package/schematics/place-routes/index.js.map +1 -1
- package/schematics/place-routes/place-builder.d.ts +19 -0
- package/schematics/place-routes/place-builder.js +109 -0
- package/schematics/place-routes/place-builder.js.map +1 -0
- package/schematics/place-routes/{scanner.d.ts → place-class-scanner.d.ts} +10 -6
- package/schematics/place-routes/{scanner.js → place-class-scanner.js} +43 -18
- package/schematics/place-routes/place-class-scanner.js.map +1 -0
- package/schematics/place-routes/place-def.d.ts +19 -4
- package/schematics/place-routes/place-def.js +54 -4
- package/schematics/place-routes/place-def.js.map +1 -1
- package/schematics/place-routes/templates/{place-routes.ts.template → places.ts.template} +14 -11
- package/esm2015/lib/place/i-place-component.js +0 -17
- package/esm2015/lib/place/i-place-service.js +0 -16
- package/esm2015/lib/place/route/resolved-parameter.js +0 -16
- package/esm2015/lib/place/route/resolved-route-parameter-snapshot.js +0 -106
- package/esm2015/lib/place/route/route-parameter-bindings.js +0 -150
- package/esm2015/lib/place/route/visit-snapshot.js +0 -7
- package/esm5/lib/place/i-place-component.js +0 -17
- package/esm5/lib/place/i-place-service.js +0 -16
- package/esm5/lib/place/route/resolved-parameter.js +0 -16
- package/esm5/lib/place/route/resolved-route-parameter-snapshot.js +0 -129
- package/esm5/lib/place/route/route-parameter-bindings.js +0 -167
- package/esm5/lib/place/route/visit-snapshot.js +0 -11
- package/lib/place/i-place-service.d.ts +0 -10
- package/lib/place/route/resolved-parameter.d.ts +0 -5
- package/lib/place/route/resolved-route-parameter-snapshot.d.ts +0 -12
- package/lib/place/route/route-parameter-bindings.d.ts +0 -17
- package/lib/place/route/visit-snapshot.d.ts +0 -2
- package/schematics/place-routes/scanner.js.map +0 -1
- package/schematics/place-routes/templates/place-router.ts.template +0 -33
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
2
|
-
import { EventEmitter, Input, Output, HostListener, Component, Directive, ElementRef, Inject, NgZone, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, ɵɵdefineInjectable, ɵɵinject, NgModule, INJECTOR } from '@angular/core';
|
|
2
|
+
import { EventEmitter, Input, Output, HostListener, Component, Directive, ElementRef, Inject, NgZone, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, ɵɵdefineInjectable, ɵɵinject, NgModule, HostBinding, INJECTOR } from '@angular/core';
|
|
3
3
|
import { FormsModule } from '@angular/forms';
|
|
4
4
|
import { MatDialog, MatButtonModule, MatDialogModule, MatTabsModule, MatProgressSpinnerModule, MatInputModule, MatFormFieldModule, MatSelectModule } from '@angular/material';
|
|
5
|
-
import { BrowserModule } from '@angular/platform-browser';
|
|
6
5
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
7
6
|
import { __decorate, __metadata, __awaiter } from 'tslib';
|
|
8
|
-
import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, assert, UnaryCommand, lang, Dsl, Logger,
|
|
7
|
+
import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, assert, UnaryCommand, lang, Dsl, Logger, EventListenerList, DelegatingValueModel, Trace, MutableListModel, StoreInValueModel, MutableValueModel, Binding, OptionsHelper, ValueHolder } from '@coolon/pectin';
|
|
9
8
|
import { PortalModule } from '@angular/cdk/portal';
|
|
10
9
|
import { Deferred } from '@coolon/pectin/lib/promise/deferred.class';
|
|
11
10
|
import { assert as assert$1, Klass, Opts } from '@coolon/typescript-utilities';
|
|
@@ -14,13 +13,13 @@ import { MatIconModule } from '@angular/material/icon';
|
|
|
14
13
|
import { MatListModule } from '@angular/material/list';
|
|
15
14
|
import { MatTabsModule as MatTabsModule$1 } from '@angular/material/tabs';
|
|
16
15
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
17
|
-
import { Router, RouterModule
|
|
18
|
-
import { Memoize } from '@typescript-plus/fast-memoize-decorator';
|
|
19
|
-
import {
|
|
16
|
+
import { Router, RouterModule } from '@angular/router';
|
|
17
|
+
import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
|
|
18
|
+
import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator';
|
|
19
|
+
import { isNil, isEqual, isEmpty, isFunction } from 'lodash';
|
|
20
20
|
import 'reflect-metadata';
|
|
21
21
|
import { style, query, group, animate, trigger, transition } from '@angular/animations';
|
|
22
22
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
23
|
-
import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator/dist/src';
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
25
|
* @fileoverview added by tsickle
|
|
@@ -237,6 +236,110 @@ NumberInputComponent.decorators = [
|
|
|
237
236
|
/** @nocollapse */
|
|
238
237
|
NumberInputComponent.ctorParameters = () => [];
|
|
239
238
|
|
|
239
|
+
/**
|
|
240
|
+
* @fileoverview added by tsickle
|
|
241
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
242
|
+
*/
|
|
243
|
+
class PasswordInputComponent extends AbstractInputComponent {
|
|
244
|
+
constructor() {
|
|
245
|
+
super();
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* @return {?}
|
|
249
|
+
*/
|
|
250
|
+
ngOnInit() {
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
PasswordInputComponent.decorators = [
|
|
254
|
+
{ type: Component, args: [{
|
|
255
|
+
selector: 'angular-ui-powerups-password-input',
|
|
256
|
+
template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input type=\"password\"\n matInput\n placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"valueModel\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n\n",
|
|
257
|
+
styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
|
|
258
|
+
}] }
|
|
259
|
+
];
|
|
260
|
+
/** @nocollapse */
|
|
261
|
+
PasswordInputComponent.ctorParameters = () => [];
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* @fileoverview added by tsickle
|
|
265
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
266
|
+
*/
|
|
267
|
+
/**
|
|
268
|
+
* @template T
|
|
269
|
+
*/
|
|
270
|
+
class SelectInputComponent extends AbstractInputComponent {
|
|
271
|
+
constructor() {
|
|
272
|
+
super();
|
|
273
|
+
this.optionLabelFormat = (/**
|
|
274
|
+
* @param {?} option
|
|
275
|
+
* @return {?}
|
|
276
|
+
*/
|
|
277
|
+
(option) => (option && this.optionLabel) ? option[this.optionLabel] : option);
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* @return {?}
|
|
281
|
+
*/
|
|
282
|
+
ngOnInit() {
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
SelectInputComponent.decorators = [
|
|
286
|
+
{ type: Component, args: [{
|
|
287
|
+
selector: 'angular-ui-powerups-select-input',
|
|
288
|
+
template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <mat-select placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"valueModel\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-option *ngFor=\"let option of optionsModel.value\" [value]=\"option\">{{optionLabelFormat(option)}}\n </mat-option>\n </mat-select>\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n",
|
|
289
|
+
styles: [":host{display:inline-block}mat-form-field{width:100%}"]
|
|
290
|
+
}] }
|
|
291
|
+
];
|
|
292
|
+
/** @nocollapse */
|
|
293
|
+
SelectInputComponent.ctorParameters = () => [];
|
|
294
|
+
SelectInputComponent.propDecorators = {
|
|
295
|
+
optionsModel: [{ type: Input }],
|
|
296
|
+
options: [{ type: Input }],
|
|
297
|
+
optionLabel: [{ type: Input }],
|
|
298
|
+
optionLabelFormat: [{ type: Input }]
|
|
299
|
+
};
|
|
300
|
+
__decorate([
|
|
301
|
+
UseDelegate(),
|
|
302
|
+
__metadata("design:type", ListModel)
|
|
303
|
+
], SelectInputComponent.prototype, "optionsModel", void 0);
|
|
304
|
+
__decorate([
|
|
305
|
+
StoreInListModel('optionsModel'),
|
|
306
|
+
__metadata("design:type", Array)
|
|
307
|
+
], SelectInputComponent.prototype, "options", void 0);
|
|
308
|
+
if (false) {
|
|
309
|
+
/** @type {?} */
|
|
310
|
+
SelectInputComponent.prototype.optionsModel;
|
|
311
|
+
/** @type {?} */
|
|
312
|
+
SelectInputComponent.prototype.options;
|
|
313
|
+
/** @type {?} */
|
|
314
|
+
SelectInputComponent.prototype.optionLabel;
|
|
315
|
+
/** @type {?} */
|
|
316
|
+
SelectInputComponent.prototype.optionLabelFormat;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* @fileoverview added by tsickle
|
|
321
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
322
|
+
*/
|
|
323
|
+
class StringInputComponent extends AbstractInputComponent {
|
|
324
|
+
constructor() {
|
|
325
|
+
super();
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* @return {?}
|
|
329
|
+
*/
|
|
330
|
+
ngOnInit() {
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
StringInputComponent.decorators = [
|
|
334
|
+
{ type: Component, args: [{
|
|
335
|
+
selector: 'angular-ui-powerups-string-input',
|
|
336
|
+
template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input matInput\n placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"valueModel\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n\n",
|
|
337
|
+
styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
|
|
338
|
+
}] }
|
|
339
|
+
];
|
|
340
|
+
/** @nocollapse */
|
|
341
|
+
StringInputComponent.ctorParameters = () => [];
|
|
342
|
+
|
|
240
343
|
/**
|
|
241
344
|
* @fileoverview added by tsickle
|
|
242
345
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -545,110 +648,6 @@ if (false) {
|
|
|
545
648
|
FocusBindingDirective.prototype.ngZone;
|
|
546
649
|
}
|
|
547
650
|
|
|
548
|
-
/**
|
|
549
|
-
* @fileoverview added by tsickle
|
|
550
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
551
|
-
*/
|
|
552
|
-
class StringInputComponent extends AbstractInputComponent {
|
|
553
|
-
constructor() {
|
|
554
|
-
super();
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
* @return {?}
|
|
558
|
-
*/
|
|
559
|
-
ngOnInit() {
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
StringInputComponent.decorators = [
|
|
563
|
-
{ type: Component, args: [{
|
|
564
|
-
selector: 'angular-ui-powerups-string-input',
|
|
565
|
-
template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input matInput\n placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"valueModel\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n\n",
|
|
566
|
-
styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
|
|
567
|
-
}] }
|
|
568
|
-
];
|
|
569
|
-
/** @nocollapse */
|
|
570
|
-
StringInputComponent.ctorParameters = () => [];
|
|
571
|
-
|
|
572
|
-
/**
|
|
573
|
-
* @fileoverview added by tsickle
|
|
574
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
575
|
-
*/
|
|
576
|
-
class PasswordInputComponent extends AbstractInputComponent {
|
|
577
|
-
constructor() {
|
|
578
|
-
super();
|
|
579
|
-
}
|
|
580
|
-
/**
|
|
581
|
-
* @return {?}
|
|
582
|
-
*/
|
|
583
|
-
ngOnInit() {
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
PasswordInputComponent.decorators = [
|
|
587
|
-
{ type: Component, args: [{
|
|
588
|
-
selector: 'angular-ui-powerups-password-input',
|
|
589
|
-
template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input type=\"password\"\n matInput\n placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"valueModel\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n\n",
|
|
590
|
-
styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
|
|
591
|
-
}] }
|
|
592
|
-
];
|
|
593
|
-
/** @nocollapse */
|
|
594
|
-
PasswordInputComponent.ctorParameters = () => [];
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* @fileoverview added by tsickle
|
|
598
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
599
|
-
*/
|
|
600
|
-
/**
|
|
601
|
-
* @template T
|
|
602
|
-
*/
|
|
603
|
-
class SelectInputComponent extends AbstractInputComponent {
|
|
604
|
-
constructor() {
|
|
605
|
-
super();
|
|
606
|
-
this.optionLabelFormat = (/**
|
|
607
|
-
* @param {?} option
|
|
608
|
-
* @return {?}
|
|
609
|
-
*/
|
|
610
|
-
(option) => (option && this.optionLabel) ? option[this.optionLabel] : option);
|
|
611
|
-
}
|
|
612
|
-
/**
|
|
613
|
-
* @return {?}
|
|
614
|
-
*/
|
|
615
|
-
ngOnInit() {
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
SelectInputComponent.decorators = [
|
|
619
|
-
{ type: Component, args: [{
|
|
620
|
-
selector: 'angular-ui-powerups-select-input',
|
|
621
|
-
template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <mat-select placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"valueModel\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-option *ngFor=\"let option of optionsModel.value\" [value]=\"option\">{{optionLabelFormat(option)}}\n </mat-option>\n </mat-select>\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n",
|
|
622
|
-
styles: [":host{display:inline-block}mat-form-field{width:100%}"]
|
|
623
|
-
}] }
|
|
624
|
-
];
|
|
625
|
-
/** @nocollapse */
|
|
626
|
-
SelectInputComponent.ctorParameters = () => [];
|
|
627
|
-
SelectInputComponent.propDecorators = {
|
|
628
|
-
optionsModel: [{ type: Input }],
|
|
629
|
-
options: [{ type: Input }],
|
|
630
|
-
optionLabel: [{ type: Input }],
|
|
631
|
-
optionLabelFormat: [{ type: Input }]
|
|
632
|
-
};
|
|
633
|
-
__decorate([
|
|
634
|
-
UseDelegate(),
|
|
635
|
-
__metadata("design:type", ListModel)
|
|
636
|
-
], SelectInputComponent.prototype, "optionsModel", void 0);
|
|
637
|
-
__decorate([
|
|
638
|
-
StoreInListModel('optionsModel'),
|
|
639
|
-
__metadata("design:type", Array)
|
|
640
|
-
], SelectInputComponent.prototype, "options", void 0);
|
|
641
|
-
if (false) {
|
|
642
|
-
/** @type {?} */
|
|
643
|
-
SelectInputComponent.prototype.optionsModel;
|
|
644
|
-
/** @type {?} */
|
|
645
|
-
SelectInputComponent.prototype.options;
|
|
646
|
-
/** @type {?} */
|
|
647
|
-
SelectInputComponent.prototype.optionLabel;
|
|
648
|
-
/** @type {?} */
|
|
649
|
-
SelectInputComponent.prototype.optionLabelFormat;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
651
|
/**
|
|
653
652
|
* @fileoverview added by tsickle
|
|
654
653
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -1066,7 +1065,6 @@ class ConfirmationDialogComponent extends AbstractActivity {
|
|
|
1066
1065
|
super();
|
|
1067
1066
|
this.confirm = confirm;
|
|
1068
1067
|
assert.notNil(confirm);
|
|
1069
|
-
console.log(confirm);
|
|
1070
1068
|
}
|
|
1071
1069
|
/**
|
|
1072
1070
|
* @return {?}
|
|
@@ -1177,7 +1175,6 @@ class ActivityContainerComponent extends DisposableComponent {
|
|
|
1177
1175
|
* @return {?}
|
|
1178
1176
|
*/
|
|
1179
1177
|
onAnimationFinished() {
|
|
1180
|
-
// TODO: notify selected tab they are ready. activty.afterAnimationComplete
|
|
1181
1178
|
this.activityTabs.value = this.activityTabs.value.filter((/**
|
|
1182
1179
|
* @param {?} tab
|
|
1183
1180
|
* @return {?}
|
|
@@ -1449,166 +1446,414 @@ EmptyStateComponent.decorators = [
|
|
|
1449
1446
|
/** @nocollapse */
|
|
1450
1447
|
EmptyStateComponent.ctorParameters = () => [];
|
|
1451
1448
|
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1449
|
+
var _a;
|
|
1450
|
+
// TODO: there are really two types of snapshot, ones with id's and ones without.
|
|
1451
|
+
// Id snapshot are repesented by 2 url segments
|
|
1452
|
+
// ID => [{'/basePath', params}, {'id', params}]
|
|
1453
|
+
// NO ID => [{'/basePath', params}]
|
|
1454
|
+
class ParameterSnapshot {
|
|
1457
1455
|
/**
|
|
1458
|
-
* @param {?}
|
|
1456
|
+
* @param {?} placeDefinition
|
|
1457
|
+
* @param {?} resolved
|
|
1459
1458
|
*/
|
|
1460
|
-
constructor(
|
|
1461
|
-
this.
|
|
1459
|
+
constructor(placeDefinition, resolved) {
|
|
1460
|
+
this.placeDefinition = placeDefinition;
|
|
1461
|
+
this.resolved = resolved;
|
|
1462
1462
|
}
|
|
1463
1463
|
/**
|
|
1464
|
-
* @
|
|
1465
|
-
* @param {?} parameter
|
|
1464
|
+
* @param {?} other
|
|
1466
1465
|
* @return {?}
|
|
1467
1466
|
*/
|
|
1468
|
-
|
|
1467
|
+
hasChanged(other) {
|
|
1469
1468
|
/** @type {?} */
|
|
1470
|
-
const
|
|
1471
|
-
* @param {?}
|
|
1469
|
+
const changed = this.resolved.find((/**
|
|
1470
|
+
* @param {?} r
|
|
1472
1471
|
* @return {?}
|
|
1473
1472
|
*/
|
|
1474
|
-
|
|
1475
|
-
|
|
1473
|
+
(r) => {
|
|
1474
|
+
return !r.isSame(other.getResolvedParameterValue(r.parameterDef));
|
|
1475
|
+
}));
|
|
1476
|
+
if (changed) {
|
|
1477
|
+
console.log({ mine: changed, theirs: other.getResolvedParameter(changed.parameterDef) });
|
|
1478
|
+
}
|
|
1479
|
+
return !!changed;
|
|
1476
1480
|
}
|
|
1477
1481
|
/**
|
|
1478
|
-
* @
|
|
1479
|
-
* @param {?} parameter
|
|
1480
|
-
* @param {?} value
|
|
1482
|
+
* @param {?} other
|
|
1481
1483
|
* @return {?}
|
|
1482
1484
|
*/
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1485
|
+
asUrlSegment(other) {
|
|
1486
|
+
assert.isTruthy(this.hasChanged(other));
|
|
1487
|
+
/** @type {?} */
|
|
1488
|
+
const routeParts = [];
|
|
1489
|
+
/** @type {?} */
|
|
1490
|
+
const gainedId = this.getFormattedRouteId() && !other.getFormattedRouteId();
|
|
1491
|
+
/** @type {?} */
|
|
1492
|
+
const sameId = this.getFormattedRouteId() === other.getFormattedRouteId();
|
|
1493
|
+
/** @type {?} */
|
|
1494
|
+
const lostId = (!this.getFormattedRouteId() && other.getFormattedRouteId());
|
|
1495
|
+
/** @type {?} */
|
|
1496
|
+
const changedId = (this.getFormattedRouteId() !== other.getFormattedRouteId());
|
|
1497
|
+
if (lostId || changedId) {
|
|
1498
|
+
routeParts.push('..');
|
|
1499
|
+
if (changedId) {
|
|
1500
|
+
routeParts.push(this.getFormattedRouteId());
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
else {
|
|
1504
|
+
routeParts.push('.');
|
|
1505
|
+
}
|
|
1506
|
+
routeParts.push(this.getFormattedParameters());
|
|
1507
|
+
return routeParts;
|
|
1508
|
+
}
|
|
1509
|
+
/**
|
|
1510
|
+
* @template T, S
|
|
1511
|
+
* @param {?} parameterDef
|
|
1512
|
+
* @return {?}
|
|
1513
|
+
*/
|
|
1514
|
+
getResolvedParameter(parameterDef) {
|
|
1515
|
+
return this.resolved.find((/**
|
|
1516
|
+
* @param {?} r
|
|
1486
1517
|
* @return {?}
|
|
1487
1518
|
*/
|
|
1488
|
-
|
|
1489
|
-
parameterDef: parameter,
|
|
1490
|
-
resolvedValue: value
|
|
1491
|
-
}));
|
|
1519
|
+
r => r.parameterDef === parameterDef));
|
|
1492
1520
|
}
|
|
1493
1521
|
/**
|
|
1522
|
+
* @template T, S
|
|
1523
|
+
* @param {?} parameterDef
|
|
1494
1524
|
* @return {?}
|
|
1495
1525
|
*/
|
|
1496
|
-
|
|
1526
|
+
getResolvedParameterValue(parameterDef) {
|
|
1497
1527
|
/** @type {?} */
|
|
1498
|
-
const
|
|
1499
|
-
return
|
|
1528
|
+
const resolvedParameter = this.getResolvedParameter(parameterDef);
|
|
1529
|
+
return resolvedParameter ? resolvedParameter.value : null;
|
|
1500
1530
|
}
|
|
1501
1531
|
/**
|
|
1502
|
-
* @private
|
|
1503
1532
|
* @return {?}
|
|
1504
1533
|
*/
|
|
1505
|
-
|
|
1506
|
-
return this.
|
|
1507
|
-
* @param {?} p
|
|
1508
|
-
* @return {?}
|
|
1509
|
-
*/
|
|
1510
|
-
p => p.parameterDef.isRouteId));
|
|
1534
|
+
getRouteId() {
|
|
1535
|
+
return this.getResolvedRouteId() ? this.getResolvedRouteId().value : null;
|
|
1511
1536
|
}
|
|
1512
1537
|
/**
|
|
1538
|
+
* @param {?} name
|
|
1513
1539
|
* @return {?}
|
|
1514
1540
|
*/
|
|
1515
|
-
|
|
1516
|
-
/** @type {?} */
|
|
1517
|
-
const params = {};
|
|
1541
|
+
getRouteParameter(name) {
|
|
1518
1542
|
/** @type {?} */
|
|
1519
|
-
const
|
|
1520
|
-
* @param {?}
|
|
1543
|
+
const resolvedParameter = this.resolved.find((/**
|
|
1544
|
+
* @param {?} r
|
|
1521
1545
|
* @return {?}
|
|
1522
1546
|
*/
|
|
1523
|
-
|
|
1547
|
+
r => r.parameterDef.name === name));
|
|
1548
|
+
return resolvedParameter ? resolvedParameter.value : null;
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
* @private
|
|
1552
|
+
* @return {?}
|
|
1553
|
+
*/
|
|
1554
|
+
getResolvedRouteId() {
|
|
1555
|
+
// RouteId's are never arrays: see parameter-decorators.ts createDefinition methods. It would be nice to
|
|
1556
|
+
// capture this in the type system though
|
|
1557
|
+
return (/** @type {?} */ (this.resolved.find((/**
|
|
1524
1558
|
* @param {?} p
|
|
1525
1559
|
* @return {?}
|
|
1526
1560
|
*/
|
|
1527
|
-
p =>
|
|
1528
|
-
|
|
1561
|
+
p => p.parameterDef.isRouteId))));
|
|
1562
|
+
}
|
|
1563
|
+
/**
|
|
1564
|
+
* @return {?}
|
|
1565
|
+
*/
|
|
1566
|
+
hasRouteId() {
|
|
1567
|
+
return !!this.getResolvedRouteId();
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* @return {?}
|
|
1571
|
+
*/
|
|
1572
|
+
getFormattedRouteId() {
|
|
1573
|
+
/** @type {?} */
|
|
1574
|
+
const routeIdParam = this.getResolvedRouteId();
|
|
1575
|
+
return routeIdParam ? routeIdParam.formattedValue() : null;
|
|
1576
|
+
}
|
|
1577
|
+
/**
|
|
1578
|
+
* @return {?}
|
|
1579
|
+
*/
|
|
1580
|
+
getFormattedParameters() {
|
|
1581
|
+
/** @type {?} */
|
|
1582
|
+
const params = {};
|
|
1583
|
+
/** @type {?} */
|
|
1584
|
+
const routeIdParam = this.resolved.filter((/**
|
|
1585
|
+
* @param {?} p
|
|
1586
|
+
* @return {?}
|
|
1587
|
+
*/
|
|
1588
|
+
p => !p.parameterDef.isRouteId)).forEach((/**
|
|
1589
|
+
* @param {?} p
|
|
1590
|
+
* @return {?}
|
|
1591
|
+
*/
|
|
1592
|
+
p => {
|
|
1593
|
+
params[p.parameterDef.name] = p.formattedValue();
|
|
1529
1594
|
}));
|
|
1530
1595
|
return params;
|
|
1531
1596
|
}
|
|
1532
1597
|
/**
|
|
1598
|
+
* @template T, S
|
|
1599
|
+
* @param {?} parameter
|
|
1600
|
+
* @param {?} value
|
|
1533
1601
|
* @return {?}
|
|
1534
1602
|
*/
|
|
1535
|
-
|
|
1536
|
-
return
|
|
1603
|
+
replace(parameter, value) {
|
|
1604
|
+
return new ParameterSnapshot(this.placeDefinition, this.resolved.map((/**
|
|
1605
|
+
* @param {?} p
|
|
1606
|
+
* @return {?}
|
|
1607
|
+
*/
|
|
1608
|
+
p => {
|
|
1609
|
+
return p.parameterDef === parameter ? p.replace(value) : p;
|
|
1610
|
+
})));
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* @param {?} url
|
|
1614
|
+
* @return {?}
|
|
1615
|
+
*/
|
|
1616
|
+
updateUrl(url) {
|
|
1617
|
+
return url;
|
|
1537
1618
|
}
|
|
1538
1619
|
}
|
|
1539
1620
|
__decorate([
|
|
1540
|
-
|
|
1621
|
+
Memoize(),
|
|
1541
1622
|
__metadata("design:type", Function),
|
|
1542
|
-
__metadata("design:paramtypes", []),
|
|
1543
|
-
__metadata("design:returntype",
|
|
1544
|
-
],
|
|
1623
|
+
__metadata("design:paramtypes", [Object]),
|
|
1624
|
+
__metadata("design:returntype", ParameterSnapshot.ResolvedParameter)
|
|
1625
|
+
], ParameterSnapshot.prototype, "getResolvedParameter", null);
|
|
1545
1626
|
__decorate([
|
|
1546
|
-
|
|
1627
|
+
Memoize(),
|
|
1628
|
+
__metadata("design:type", Function),
|
|
1629
|
+
__metadata("design:paramtypes", [Object]),
|
|
1630
|
+
__metadata("design:returntype", typeof (_a = typeof S !== "undefined" && S) === "function" ? _a : Object)
|
|
1631
|
+
], ParameterSnapshot.prototype, "getResolvedParameterValue", null);
|
|
1632
|
+
__decorate([
|
|
1633
|
+
Memoize(),
|
|
1634
|
+
__metadata("design:type", Function),
|
|
1635
|
+
__metadata("design:paramtypes", [String]),
|
|
1636
|
+
__metadata("design:returntype", Object)
|
|
1637
|
+
], ParameterSnapshot.prototype, "getRouteParameter", null);
|
|
1638
|
+
__decorate([
|
|
1639
|
+
Memoize(),
|
|
1547
1640
|
__metadata("design:type", Function),
|
|
1548
1641
|
__metadata("design:paramtypes", []),
|
|
1549
|
-
__metadata("design:returntype",
|
|
1550
|
-
],
|
|
1642
|
+
__metadata("design:returntype", ParameterSnapshot.ResolvedValueParameter)
|
|
1643
|
+
], ParameterSnapshot.prototype, "getResolvedRouteId", null);
|
|
1551
1644
|
if (false) {
|
|
1552
1645
|
/** @type {?} */
|
|
1553
|
-
|
|
1646
|
+
ParameterSnapshot.prototype.placeDefinition;
|
|
1647
|
+
/**
|
|
1648
|
+
* @type {?}
|
|
1649
|
+
* @private
|
|
1650
|
+
*/
|
|
1651
|
+
ParameterSnapshot.prototype.resolved;
|
|
1554
1652
|
}
|
|
1653
|
+
(function (ParameterSnapshot) {
|
|
1654
|
+
/**
|
|
1655
|
+
* @param {?} placeDef
|
|
1656
|
+
* @param {?} paramMap
|
|
1657
|
+
* @return {?}
|
|
1658
|
+
*/
|
|
1659
|
+
function create(placeDef, paramMap) {
|
|
1660
|
+
/** @type {?} */
|
|
1661
|
+
const resolvedParameters = placeDef.getRouteParameters()
|
|
1662
|
+
.map((/**
|
|
1663
|
+
* @param {?} def
|
|
1664
|
+
* @return {?}
|
|
1665
|
+
*/
|
|
1666
|
+
def => {
|
|
1667
|
+
if (def.isArray) {
|
|
1668
|
+
/** @type {?} */
|
|
1669
|
+
const value = paramMap.has(def.name) ? paramMap.getAll(def.name).map((/**
|
|
1670
|
+
* @param {?} raw
|
|
1671
|
+
* @return {?}
|
|
1672
|
+
*/
|
|
1673
|
+
raw => def.type.parse(raw))) : null;
|
|
1674
|
+
return new ResolvedArrayParameter(def, value);
|
|
1675
|
+
}
|
|
1676
|
+
else {
|
|
1677
|
+
/** @type {?} */
|
|
1678
|
+
const value = paramMap.has(def.name) ? def.type.parse(paramMap.get(def.name)) : null;
|
|
1679
|
+
return new ResolvedValueParameter(def, value);
|
|
1680
|
+
}
|
|
1681
|
+
}));
|
|
1682
|
+
return new ParameterSnapshot(placeDef, resolvedParameters);
|
|
1683
|
+
}
|
|
1684
|
+
ParameterSnapshot.create = create;
|
|
1685
|
+
/**
|
|
1686
|
+
* @abstract
|
|
1687
|
+
* @template T, S
|
|
1688
|
+
*/
|
|
1689
|
+
class ResolvedParameter {
|
|
1690
|
+
/**
|
|
1691
|
+
* @param {?} parameterDef
|
|
1692
|
+
* @param {?} value
|
|
1693
|
+
*/
|
|
1694
|
+
constructor(parameterDef, value) {
|
|
1695
|
+
this.parameterDef = parameterDef;
|
|
1696
|
+
this.value = value;
|
|
1697
|
+
}
|
|
1698
|
+
/**
|
|
1699
|
+
* @return {?}
|
|
1700
|
+
*/
|
|
1701
|
+
isRouteId() {
|
|
1702
|
+
return this.parameterDef.isRouteId;
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
ParameterSnapshot.ResolvedParameter = ResolvedParameter;
|
|
1706
|
+
if (false) {
|
|
1707
|
+
/** @type {?} */
|
|
1708
|
+
ResolvedParameter.prototype.parameterDef;
|
|
1709
|
+
/** @type {?} */
|
|
1710
|
+
ResolvedParameter.prototype.value;
|
|
1711
|
+
/**
|
|
1712
|
+
* @abstract
|
|
1713
|
+
* @param {?} dest
|
|
1714
|
+
* @return {?}
|
|
1715
|
+
*/
|
|
1716
|
+
ResolvedParameter.prototype.injectRouteParam = function (dest) { };
|
|
1717
|
+
/**
|
|
1718
|
+
* @abstract
|
|
1719
|
+
* @param {?} otherValue
|
|
1720
|
+
* @return {?}
|
|
1721
|
+
*/
|
|
1722
|
+
ResolvedParameter.prototype.isSame = function (otherValue) { };
|
|
1723
|
+
/**
|
|
1724
|
+
* @abstract
|
|
1725
|
+
* @return {?}
|
|
1726
|
+
*/
|
|
1727
|
+
ResolvedParameter.prototype.formattedValue = function () { };
|
|
1728
|
+
/**
|
|
1729
|
+
* @abstract
|
|
1730
|
+
* @param {?} value
|
|
1731
|
+
* @return {?}
|
|
1732
|
+
*/
|
|
1733
|
+
ResolvedParameter.prototype.replace = function (value) { };
|
|
1734
|
+
}
|
|
1735
|
+
/**
|
|
1736
|
+
* @template T
|
|
1737
|
+
*/
|
|
1738
|
+
class ResolvedValueParameter extends ResolvedParameter {
|
|
1739
|
+
/**
|
|
1740
|
+
* @param {?} otherValue
|
|
1741
|
+
* @return {?}
|
|
1742
|
+
*/
|
|
1743
|
+
isSame(otherValue) {
|
|
1744
|
+
return this.value === otherValue;
|
|
1745
|
+
}
|
|
1746
|
+
/**
|
|
1747
|
+
* @param {?} dest
|
|
1748
|
+
* @return {?}
|
|
1749
|
+
*/
|
|
1750
|
+
injectRouteParam(dest) {
|
|
1751
|
+
dest[this.parameterDef.name] = this.parameterDef.type.format(this.value);
|
|
1752
|
+
}
|
|
1753
|
+
/**
|
|
1754
|
+
* @param {?} value
|
|
1755
|
+
* @return {?}
|
|
1756
|
+
*/
|
|
1757
|
+
replace(value) {
|
|
1758
|
+
return new ResolvedValueParameter(this.parameterDef, value);
|
|
1759
|
+
}
|
|
1760
|
+
/**
|
|
1761
|
+
* @return {?}
|
|
1762
|
+
*/
|
|
1763
|
+
formattedValue() {
|
|
1764
|
+
return !isNil(this.value) ? this.parameterDef.type.format(this.value) : null;
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
__decorate([
|
|
1768
|
+
Trace(),
|
|
1769
|
+
__metadata("design:type", Function),
|
|
1770
|
+
__metadata("design:paramtypes", [Object]),
|
|
1771
|
+
__metadata("design:returntype", Boolean)
|
|
1772
|
+
], ResolvedValueParameter.prototype, "isSame", null);
|
|
1773
|
+
ParameterSnapshot.ResolvedValueParameter = ResolvedValueParameter;
|
|
1774
|
+
/**
|
|
1775
|
+
* @template T
|
|
1776
|
+
*/
|
|
1777
|
+
class ResolvedArrayParameter extends ResolvedParameter {
|
|
1778
|
+
/**
|
|
1779
|
+
* @param {?} otherValue
|
|
1780
|
+
* @return {?}
|
|
1781
|
+
*/
|
|
1782
|
+
isSame(otherValue) {
|
|
1783
|
+
return isEqual(this.value, otherValue);
|
|
1784
|
+
}
|
|
1785
|
+
/**
|
|
1786
|
+
* @param {?} dest
|
|
1787
|
+
* @return {?}
|
|
1788
|
+
*/
|
|
1789
|
+
injectRouteParam(dest) {
|
|
1790
|
+
dest[this.parameterDef.name] = this.value.map((/**
|
|
1791
|
+
* @param {?} v
|
|
1792
|
+
* @return {?}
|
|
1793
|
+
*/
|
|
1794
|
+
v => this.parameterDef.type.format(v)));
|
|
1795
|
+
}
|
|
1796
|
+
/**
|
|
1797
|
+
* @param {?} value
|
|
1798
|
+
* @return {?}
|
|
1799
|
+
*/
|
|
1800
|
+
replace(value) {
|
|
1801
|
+
return new ResolvedArrayParameter(this.parameterDef, value);
|
|
1802
|
+
}
|
|
1803
|
+
/**
|
|
1804
|
+
* @return {?}
|
|
1805
|
+
*/
|
|
1806
|
+
formattedValue() {
|
|
1807
|
+
return this.value ? this.value.map((/**
|
|
1808
|
+
* @param {?} v
|
|
1809
|
+
* @return {?}
|
|
1810
|
+
*/
|
|
1811
|
+
v => this.parameterDef.type.format(v))) : [];
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
__decorate([
|
|
1815
|
+
Trace(),
|
|
1816
|
+
__metadata("design:type", Function),
|
|
1817
|
+
__metadata("design:paramtypes", [Array]),
|
|
1818
|
+
__metadata("design:returntype", Boolean)
|
|
1819
|
+
], ResolvedArrayParameter.prototype, "isSame", null);
|
|
1820
|
+
ParameterSnapshot.ResolvedArrayParameter = ResolvedArrayParameter;
|
|
1821
|
+
})(ParameterSnapshot || (ParameterSnapshot = {}));
|
|
1555
1822
|
|
|
1556
1823
|
/**
|
|
1557
1824
|
* @fileoverview added by tsickle
|
|
1558
1825
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1559
1826
|
*/
|
|
1560
|
-
|
|
1827
|
+
// RAKE: making this Symbol(...) broke things.
|
|
1828
|
+
/** @type {?} */
|
|
1829
|
+
const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';
|
|
1830
|
+
// this one seems ok.
|
|
1831
|
+
/** @type {?} */
|
|
1832
|
+
const ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');
|
|
1833
|
+
class PlaceComponent extends DisposableComponent {
|
|
1561
1834
|
/**
|
|
1562
|
-
* @param {?}
|
|
1835
|
+
* @param {?} activatedRoute
|
|
1563
1836
|
* @param {?} placeService
|
|
1564
1837
|
*/
|
|
1565
|
-
constructor(
|
|
1838
|
+
constructor(activatedRoute, placeService) {
|
|
1566
1839
|
super();
|
|
1567
|
-
this.
|
|
1840
|
+
this.activatedRoute = activatedRoute;
|
|
1568
1841
|
this._incomingRouteChange = new MutableValueModel(false);
|
|
1569
1842
|
this.resolvedParameters = new MutableValueModel();
|
|
1570
|
-
const { chain, valueOf, before, when, after, observe } = Dsl.disposeWith(this);
|
|
1571
|
-
this.
|
|
1572
|
-
|
|
1573
|
-
/** @type {?} */
|
|
1574
|
-
const routeParameterDefs = Klass.get(component).getMetadataList(RouteParameterBindings.ROUTE_PARAMETER_LIST_KEY);
|
|
1575
|
-
routeParameterDefs.forEach((/**
|
|
1576
|
-
* @param {?} parameter
|
|
1843
|
+
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
1844
|
+
this.placeDefinition.getRouteParameters().forEach((/**
|
|
1845
|
+
* @param {?} p
|
|
1577
1846
|
* @return {?}
|
|
1578
1847
|
*/
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
const incomingResolvedRouteParameters = observe.valuesFrom(component.activatedRoute.paramMap)
|
|
1848
|
+
p => this.installBinding(p)));
|
|
1849
|
+
observe.valuesFrom(activatedRoute.paramMap)
|
|
1582
1850
|
.last()
|
|
1583
1851
|
.map((/**
|
|
1584
1852
|
* @param {?} params
|
|
1585
1853
|
* @return {?}
|
|
1586
1854
|
*/
|
|
1587
|
-
params =>
|
|
1588
|
-
/**
|
|
1589
|
-
const result = [];
|
|
1590
|
-
routeParameterDefs.forEach((/**
|
|
1591
|
-
* @param {?} parameterDef
|
|
1592
|
-
* @return {?}
|
|
1593
|
-
*/
|
|
1594
|
-
parameterDef => {
|
|
1595
|
-
/** @type {?} */
|
|
1596
|
-
let resolvedValue;
|
|
1597
|
-
if (parameterDef.isArray) {
|
|
1598
|
-
resolvedValue = params.getAll(parameterDef.name).map((/**
|
|
1599
|
-
* @param {?} v
|
|
1600
|
-
* @return {?}
|
|
1601
|
-
*/
|
|
1602
|
-
v => parameterDef.type.parse(v)));
|
|
1603
|
-
}
|
|
1604
|
-
else {
|
|
1605
|
-
resolvedValue = parameterDef.type.parse(params.get(parameterDef.name));
|
|
1606
|
-
}
|
|
1607
|
-
result.push({ parameterDef: parameterDef, resolvedValue: resolvedValue });
|
|
1608
|
-
}));
|
|
1609
|
-
return new ResolvedRouteParameterSnapshot(result);
|
|
1610
|
-
}));
|
|
1611
|
-
incomingResolvedRouteParameters.subscribe((/**
|
|
1855
|
+
params => ParameterSnapshot.create(this.placeDefinition, params)))
|
|
1856
|
+
.subscribe((/**
|
|
1612
1857
|
* @param {?} resolvedParameters
|
|
1613
1858
|
* @return {?}
|
|
1614
1859
|
*/
|
|
@@ -1624,14 +1869,12 @@ class RouteParameterBindings extends GarbageCollector {
|
|
|
1624
1869
|
*/
|
|
1625
1870
|
(params, previous) => {
|
|
1626
1871
|
placeService.notifyRouteParametersChanged({
|
|
1627
|
-
|
|
1872
|
+
activatedRoute: this.activatedRoute,
|
|
1628
1873
|
next: params,
|
|
1629
1874
|
previous: previous,
|
|
1630
1875
|
updateRoute: !this.incomingRouteChange.value // we update the route if it's a component triggered change.
|
|
1631
1876
|
});
|
|
1632
1877
|
}));
|
|
1633
|
-
this.txo.observe('incomingResolvedRouteParameters', incomingResolvedRouteParameters);
|
|
1634
|
-
this.txo.observe('this.routeIsChanging', this.incomingRouteChange);
|
|
1635
1878
|
}
|
|
1636
1879
|
/**
|
|
1637
1880
|
* @return {?}
|
|
@@ -1640,22 +1883,22 @@ class RouteParameterBindings extends GarbageCollector {
|
|
|
1640
1883
|
return this._incomingRouteChange.readonly;
|
|
1641
1884
|
}
|
|
1642
1885
|
/**
|
|
1643
|
-
* @
|
|
1644
|
-
* @template T
|
|
1645
|
-
* @param {?}
|
|
1886
|
+
* @private
|
|
1887
|
+
* @template T, S
|
|
1888
|
+
* @param {?} parameterDef
|
|
1646
1889
|
* @return {?}
|
|
1647
1890
|
*/
|
|
1648
|
-
installBinding(
|
|
1891
|
+
installBinding(parameterDef) {
|
|
1649
1892
|
/** @type {?} */
|
|
1650
|
-
const model = this.
|
|
1651
|
-
// this.txo.observe(
|
|
1893
|
+
const model = (/** @type {?} */ (this[parameterDef.propertyName]));
|
|
1894
|
+
// this.txo.observe(parameterDef.propertyName, model);
|
|
1652
1895
|
this.registerDisposable(new Binding(this.resolvedParameters, model, {
|
|
1653
1896
|
/**
|
|
1654
1897
|
* @param {?} parameters
|
|
1655
1898
|
* @return {?}
|
|
1656
1899
|
*/
|
|
1657
1900
|
toRight(parameters) {
|
|
1658
|
-
return parameters.
|
|
1901
|
+
return parameters.getResolvedParameterValue(parameterDef);
|
|
1659
1902
|
},
|
|
1660
1903
|
/**
|
|
1661
1904
|
* @param {?} value
|
|
@@ -1663,64 +1906,14 @@ class RouteParameterBindings extends GarbageCollector {
|
|
|
1663
1906
|
* @return {?}
|
|
1664
1907
|
*/
|
|
1665
1908
|
toLeft(value, currentParameters) {
|
|
1666
|
-
return currentParameters.replace(
|
|
1909
|
+
return currentParameters.replace(parameterDef, value);
|
|
1667
1910
|
}
|
|
1668
1911
|
}));
|
|
1669
1912
|
}
|
|
1670
|
-
/**
|
|
1671
|
-
* @private
|
|
1672
|
-
* @template T
|
|
1673
|
-
* @param {?} parameter
|
|
1674
|
-
* @return {?}
|
|
1675
|
-
*/
|
|
1676
|
-
getModelFor(parameter) {
|
|
1677
|
-
return this.component[parameter.propertyName];
|
|
1678
|
-
}
|
|
1679
|
-
}
|
|
1680
|
-
if (false) {
|
|
1681
|
-
/** @type {?} */
|
|
1682
|
-
RouteParameterBindings.prototype._incomingRouteChange;
|
|
1683
|
-
/**
|
|
1684
|
-
* @type {?}
|
|
1685
|
-
* @private
|
|
1686
|
-
*/
|
|
1687
|
-
RouteParameterBindings.prototype.txo;
|
|
1688
|
-
/**
|
|
1689
|
-
* @type {?}
|
|
1690
|
-
* @private
|
|
1691
|
-
*/
|
|
1692
|
-
RouteParameterBindings.prototype.resolvedParameters;
|
|
1693
|
-
/**
|
|
1694
|
-
* @type {?}
|
|
1695
|
-
* @private
|
|
1696
|
-
*/
|
|
1697
|
-
RouteParameterBindings.prototype.component;
|
|
1698
|
-
}
|
|
1699
|
-
(function (RouteParameterBindings) {
|
|
1700
|
-
RouteParameterBindings.ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');
|
|
1701
|
-
})(RouteParameterBindings || (RouteParameterBindings = {}));
|
|
1702
|
-
|
|
1703
|
-
/**
|
|
1704
|
-
* @fileoverview added by tsickle
|
|
1705
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1706
|
-
*/
|
|
1707
|
-
// RAKE: making this Symbol(...) broke things.
|
|
1708
|
-
/** @type {?} */
|
|
1709
|
-
const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';
|
|
1710
|
-
class PlaceComponent extends DisposableComponent {
|
|
1711
|
-
/**
|
|
1712
|
-
* @param {?} activatedRoute
|
|
1713
|
-
* @param {?} placeService
|
|
1714
|
-
*/
|
|
1715
|
-
constructor(activatedRoute, placeService) {
|
|
1716
|
-
super();
|
|
1717
|
-
this.activatedRoute = activatedRoute;
|
|
1718
|
-
this.routeBindingMediator = this.registerDisposable(new RouteParameterBindings(this, placeService));
|
|
1719
|
-
}
|
|
1720
1913
|
/**
|
|
1721
1914
|
* @return {?}
|
|
1722
1915
|
*/
|
|
1723
|
-
get
|
|
1916
|
+
get placeDefinition() {
|
|
1724
1917
|
return PlaceComponent.getDefinition((/** @type {?} */ ((/** @type {?} */ (this.constructor)))));
|
|
1725
1918
|
}
|
|
1726
1919
|
/**
|
|
@@ -1736,10 +1929,10 @@ class PlaceComponent extends DisposableComponent {
|
|
|
1736
1929
|
}
|
|
1737
1930
|
}
|
|
1738
1931
|
__decorate([
|
|
1739
|
-
Memoize(),
|
|
1932
|
+
Memoize$1(),
|
|
1740
1933
|
__metadata("design:type", PlaceComponent.Definition),
|
|
1741
1934
|
__metadata("design:paramtypes", [])
|
|
1742
|
-
], PlaceComponent.prototype, "
|
|
1935
|
+
], PlaceComponent.prototype, "placeDefinition", null);
|
|
1743
1936
|
__decorate([
|
|
1744
1937
|
Trace(),
|
|
1745
1938
|
__metadata("design:type", Function),
|
|
@@ -1747,11 +1940,13 @@ __decorate([
|
|
|
1747
1940
|
__metadata("design:returntype", void 0)
|
|
1748
1941
|
], PlaceComponent.prototype, "onPlaceReady", null);
|
|
1749
1942
|
if (false) {
|
|
1943
|
+
/** @type {?} */
|
|
1944
|
+
PlaceComponent.prototype._incomingRouteChange;
|
|
1750
1945
|
/**
|
|
1751
1946
|
* @type {?}
|
|
1752
1947
|
* @private
|
|
1753
1948
|
*/
|
|
1754
|
-
PlaceComponent.prototype.
|
|
1949
|
+
PlaceComponent.prototype.resolvedParameters;
|
|
1755
1950
|
/** @type {?} */
|
|
1756
1951
|
PlaceComponent.prototype.activatedRoute;
|
|
1757
1952
|
}
|
|
@@ -1768,13 +1963,24 @@ if (false) {
|
|
|
1768
1963
|
this.order = options.order;
|
|
1769
1964
|
this.data = options.data;
|
|
1770
1965
|
this.authenticate = isNil(options.authenticate) || options.authenticate;
|
|
1966
|
+
this.children = (options.children || []).map((/**
|
|
1967
|
+
* @param {?} c
|
|
1968
|
+
* @return {?}
|
|
1969
|
+
*/
|
|
1970
|
+
c => PlaceComponent.getDefinition(c).component));
|
|
1971
|
+
}
|
|
1972
|
+
/**
|
|
1973
|
+
* @return {?}
|
|
1974
|
+
*/
|
|
1975
|
+
getRouteParameters() {
|
|
1976
|
+
return Klass.get(this.component).getMetadataList(ROUTE_PARAMETER_LIST_KEY);
|
|
1771
1977
|
}
|
|
1772
1978
|
/**
|
|
1773
|
-
* @param {?}
|
|
1979
|
+
* @param {?} constructable
|
|
1774
1980
|
* @return {?}
|
|
1775
1981
|
*/
|
|
1776
|
-
isDescriptorForType(
|
|
1777
|
-
return lang.constructorChain(
|
|
1982
|
+
isDescriptorForType(constructable) {
|
|
1983
|
+
return lang.constructorChain(constructable).includes(PlaceComponent);
|
|
1778
1984
|
}
|
|
1779
1985
|
/**
|
|
1780
1986
|
* @param {?} placeComponent
|
|
@@ -1815,6 +2021,12 @@ if (false) {
|
|
|
1815
2021
|
}
|
|
1816
2022
|
}
|
|
1817
2023
|
}
|
|
2024
|
+
__decorate([
|
|
2025
|
+
Memoize$1(),
|
|
2026
|
+
__metadata("design:type", Function),
|
|
2027
|
+
__metadata("design:paramtypes", []),
|
|
2028
|
+
__metadata("design:returntype", Array)
|
|
2029
|
+
], Definition.prototype, "getRouteParameters", null);
|
|
1818
2030
|
PlaceComponent.Definition = Definition;
|
|
1819
2031
|
if (false) {
|
|
1820
2032
|
/** @type {?} */
|
|
@@ -1826,6 +2038,8 @@ if (false) {
|
|
|
1826
2038
|
/** @type {?} */
|
|
1827
2039
|
Definition.prototype.data;
|
|
1828
2040
|
/** @type {?} */
|
|
2041
|
+
Definition.prototype.children;
|
|
2042
|
+
/** @type {?} */
|
|
1829
2043
|
Definition.prototype.component;
|
|
1830
2044
|
}
|
|
1831
2045
|
/**
|
|
@@ -1842,15 +2056,24 @@ if (false) {
|
|
|
1842
2056
|
Options.prototype.data;
|
|
1843
2057
|
/** @type {?|undefined} */
|
|
1844
2058
|
Options.prototype.authenticate;
|
|
2059
|
+
/** @type {?|undefined} */
|
|
2060
|
+
Options.prototype.children;
|
|
2061
|
+
}
|
|
2062
|
+
/**
|
|
2063
|
+
* @record
|
|
2064
|
+
*/
|
|
2065
|
+
function ChildOptions() { }
|
|
2066
|
+
PlaceComponent.ChildOptions = ChildOptions;
|
|
2067
|
+
if (false) {
|
|
2068
|
+
/** @type {?} */
|
|
2069
|
+
ChildOptions.prototype.parent;
|
|
1845
2070
|
}
|
|
1846
2071
|
/**
|
|
1847
2072
|
* @param {?} klass
|
|
1848
2073
|
* @return {?}
|
|
1849
2074
|
*/
|
|
1850
2075
|
function getDefinition(klass) {
|
|
1851
|
-
|
|
1852
|
-
const placeOptions = Reflect.getMetadata(DEFINITION_META_DATA_KEY, klass);
|
|
1853
|
-
return new Definition(klass, placeOptions);
|
|
2076
|
+
return Reflect.getMetadata(DEFINITION_META_DATA_KEY, klass);
|
|
1854
2077
|
}
|
|
1855
2078
|
PlaceComponent.getDefinition = getDefinition;
|
|
1856
2079
|
/**
|
|
@@ -1859,7 +2082,7 @@ if (false) {
|
|
|
1859
2082
|
* @return {?}
|
|
1860
2083
|
*/
|
|
1861
2084
|
function injectDefinition(klass, options) {
|
|
1862
|
-
Reflect.defineMetadata(DEFINITION_META_DATA_KEY, options, klass);
|
|
2085
|
+
Reflect.defineMetadata(DEFINITION_META_DATA_KEY, new Definition(klass, options), klass);
|
|
1863
2086
|
}
|
|
1864
2087
|
PlaceComponent.injectDefinition = injectDefinition;
|
|
1865
2088
|
})(PlaceComponent || (PlaceComponent = {}));
|
|
@@ -1868,13 +2091,129 @@ if (false) {
|
|
|
1868
2091
|
* @fileoverview added by tsickle
|
|
1869
2092
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1870
2093
|
*/
|
|
1871
|
-
class
|
|
1872
|
-
|
|
1873
|
-
* @param {?} router
|
|
1874
|
-
*/
|
|
1875
|
-
constructor(router) {
|
|
2094
|
+
class AbstractPlaceNavigationComponent extends DisposableComponent {
|
|
2095
|
+
constructor() {
|
|
1876
2096
|
super();
|
|
1877
|
-
|
|
2097
|
+
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
2098
|
+
this.placeDefinitions = chain(this.placesModel).map((/**
|
|
2099
|
+
* @param {?} c
|
|
2100
|
+
* @return {?}
|
|
2101
|
+
*/
|
|
2102
|
+
c => PlaceComponent.getDefinition(c)));
|
|
2103
|
+
}
|
|
2104
|
+
/**
|
|
2105
|
+
* @param {?} placeDef
|
|
2106
|
+
* @return {?}
|
|
2107
|
+
*/
|
|
2108
|
+
getNavItem(placeDef) {
|
|
2109
|
+
/** @type {?} */
|
|
2110
|
+
const navItem = (/** @type {?} */ (placeDef.getData('navItem')));
|
|
2111
|
+
return {
|
|
2112
|
+
title: (/**
|
|
2113
|
+
* @return {?}
|
|
2114
|
+
*/
|
|
2115
|
+
() => navItem ? navItem.title() : placeDef.searchData(['navTitle', 'title'])),
|
|
2116
|
+
tooltip: (/**
|
|
2117
|
+
* @return {?}
|
|
2118
|
+
*/
|
|
2119
|
+
() => navItem && navItem.tooltip ? navItem.tooltip() : placeDef.getData('navTooltip', null)),
|
|
2120
|
+
icon: (/**
|
|
2121
|
+
* @return {?}
|
|
2122
|
+
*/
|
|
2123
|
+
() => navItem && navItem.icon ? navItem.icon() : placeDef.getData('navIcon', null))
|
|
2124
|
+
};
|
|
2125
|
+
}
|
|
2126
|
+
/**
|
|
2127
|
+
* @return {?}
|
|
2128
|
+
*/
|
|
2129
|
+
ngOnInit() {
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
AbstractPlaceNavigationComponent.propDecorators = {
|
|
2133
|
+
places: [{ type: Input }],
|
|
2134
|
+
placesModel: [{ type: Input }]
|
|
2135
|
+
};
|
|
2136
|
+
__decorate([
|
|
2137
|
+
StoreInListModel('placesModel'),
|
|
2138
|
+
__metadata("design:type", Array)
|
|
2139
|
+
], AbstractPlaceNavigationComponent.prototype, "places", void 0);
|
|
2140
|
+
__decorate([
|
|
2141
|
+
UseDelegate(),
|
|
2142
|
+
__metadata("design:type", ListModel)
|
|
2143
|
+
], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
|
|
2144
|
+
__decorate([
|
|
2145
|
+
Memoize(),
|
|
2146
|
+
__metadata("design:type", Function),
|
|
2147
|
+
__metadata("design:paramtypes", [PlaceComponent.Definition]),
|
|
2148
|
+
__metadata("design:returntype", Object)
|
|
2149
|
+
], AbstractPlaceNavigationComponent.prototype, "getNavItem", null);
|
|
2150
|
+
if (false) {
|
|
2151
|
+
/** @type {?} */
|
|
2152
|
+
AbstractPlaceNavigationComponent.prototype.places;
|
|
2153
|
+
/** @type {?} */
|
|
2154
|
+
AbstractPlaceNavigationComponent.prototype.placesModel;
|
|
2155
|
+
/** @type {?} */
|
|
2156
|
+
AbstractPlaceNavigationComponent.prototype.placeDefinitions;
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
/**
|
|
2160
|
+
* @fileoverview added by tsickle
|
|
2161
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2162
|
+
*/
|
|
2163
|
+
class ListPlaceNavComponent extends AbstractPlaceNavigationComponent {
|
|
2164
|
+
constructor() {
|
|
2165
|
+
super();
|
|
2166
|
+
this.expanded = true;
|
|
2167
|
+
}
|
|
2168
|
+
/**
|
|
2169
|
+
* @return {?}
|
|
2170
|
+
*/
|
|
2171
|
+
expandMenu() {
|
|
2172
|
+
this.expanded = true;
|
|
2173
|
+
}
|
|
2174
|
+
/**
|
|
2175
|
+
* @return {?}
|
|
2176
|
+
*/
|
|
2177
|
+
collapseMenu() {
|
|
2178
|
+
this.expanded = false;
|
|
2179
|
+
}
|
|
2180
|
+
/**
|
|
2181
|
+
* @return {?}
|
|
2182
|
+
*/
|
|
2183
|
+
toggleMenu() {
|
|
2184
|
+
this.expanded = !this.expanded;
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
ListPlaceNavComponent.decorators = [
|
|
2188
|
+
{ type: Component, args: [{
|
|
2189
|
+
selector: 'angular-ui-powerups-list-place-nav',
|
|
2190
|
+
template: "<mat-nav-list class=\"app-menu\">\n <a mat-list-item *ngFor=\"let place of placeDefinitions.value\"\n [routerLink]='place.path'\n routerLinkActive #rla=\"routerLinkActive\"\n [matTooltip]=\"getNavItem(place).tooltip()\">\n <mat-icon *ngIf=\"getNavItem(place).icon()\">{{getNavItem(place).icon()}}</mat-icon>\n <span class=\"expanded-only\">{{getNavItem(place).title()}}</span>\n </a>\n</mat-nav-list>\n",
|
|
2191
|
+
styles: [":host{display:flex;flex-direction:column;--expanded-width:235px;--nav-item-width:var(--nav-bar-height);width:var(--nav-item-width);transition:width 125ms linear}:host.expanded{width:var(--expanded-width);max-width:var(--expanded-width)}.expanded-only{max-width:0;overflow:hidden}.collapsed-only{max-width:100%;overflow:hidden}.header{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;height:var(--nav-bar-height);border-bottom:var(--pinstripe-border);cursor:pointer}.header .menu{flex:1}.header button{color:inherit;width:var(--nav-item-width);height:var(--nav-bar-height)}mat-nav-list{flex:1;display:flex;flex-direction:column}.mat-list-item{width:var(--nav-item-width);height:var(--nav-bar-height);color:inherit}mat-icon{color:inherit}mat-icon.flip-horizontal{transform:scaleX(-1)}:host-context(.expanded) .expanded-only{max-width:100%}:host-context(.expanded) .collapsed-only{max-width:0}:host-context(.expanded) .mat-list-item mat-icon{margin-right:12px}:host-context(.expanded) .mat-list-item span{text-wrap:none;white-space:nowrap}a[ng-reflect-router-link=manage-instruments] mat-icon{transform:rotate(90deg)}.app-menu{padding-top:0}"]
|
|
2192
|
+
}] }
|
|
2193
|
+
];
|
|
2194
|
+
/** @nocollapse */
|
|
2195
|
+
ListPlaceNavComponent.ctorParameters = () => [];
|
|
2196
|
+
ListPlaceNavComponent.propDecorators = {
|
|
2197
|
+
expanded: [{ type: HostBinding, args: ['class.expanded',] }]
|
|
2198
|
+
};
|
|
2199
|
+
if (false) {
|
|
2200
|
+
/** @type {?} */
|
|
2201
|
+
ListPlaceNavComponent.prototype.expanded;
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
/**
|
|
2205
|
+
* @fileoverview added by tsickle
|
|
2206
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2207
|
+
*/
|
|
2208
|
+
class PlaceService extends GarbageCollector {
|
|
2209
|
+
/**
|
|
2210
|
+
* @param {?} router
|
|
2211
|
+
* @param {?} injector
|
|
2212
|
+
*/
|
|
2213
|
+
constructor(router, injector) {
|
|
2214
|
+
super();
|
|
2215
|
+
this.router = router;
|
|
2216
|
+
this.injector = injector;
|
|
1878
2217
|
this._activePlaces = new MutableListModel();
|
|
1879
2218
|
}
|
|
1880
2219
|
/**
|
|
@@ -1911,10 +2250,19 @@ class PlaceService extends GarbageCollector {
|
|
|
1911
2250
|
/** @type {?} */
|
|
1912
2251
|
const path = routeId ? [relativePath, routeId, params.next.getFormattedParameters()] : [relativePath, params.next.getFormattedParameters()];
|
|
1913
2252
|
this.router.navigate(path, {
|
|
1914
|
-
relativeTo: params.
|
|
2253
|
+
relativeTo: params.activatedRoute
|
|
1915
2254
|
});
|
|
1916
2255
|
}
|
|
1917
2256
|
}
|
|
2257
|
+
/**
|
|
2258
|
+
* @param {?} snapshot
|
|
2259
|
+
* @return {?}
|
|
2260
|
+
*/
|
|
2261
|
+
sanitise(snapshot) {
|
|
2262
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2263
|
+
return snapshot;
|
|
2264
|
+
});
|
|
2265
|
+
}
|
|
1918
2266
|
}
|
|
1919
2267
|
PlaceService.decorators = [
|
|
1920
2268
|
{ type: Injectable, args: [{
|
|
@@ -1923,9 +2271,10 @@ PlaceService.decorators = [
|
|
|
1923
2271
|
];
|
|
1924
2272
|
/** @nocollapse */
|
|
1925
2273
|
PlaceService.ctorParameters = () => [
|
|
1926
|
-
{ type: Router }
|
|
2274
|
+
{ type: Router },
|
|
2275
|
+
{ type: Injector }
|
|
1927
2276
|
];
|
|
1928
|
-
/** @nocollapse */ PlaceService.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceService_Factory() { return new PlaceService(ɵɵinject(Router)); }, token: PlaceService, providedIn: "root" });
|
|
2277
|
+
/** @nocollapse */ PlaceService.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceService_Factory() { return new PlaceService(ɵɵinject(Router), ɵɵinject(INJECTOR)); }, token: PlaceService, providedIn: "root" });
|
|
1929
2278
|
__decorate([
|
|
1930
2279
|
Trace(),
|
|
1931
2280
|
__metadata("design:type", Function),
|
|
@@ -1944,6 +2293,12 @@ __decorate([
|
|
|
1944
2293
|
__metadata("design:paramtypes", [Object]),
|
|
1945
2294
|
__metadata("design:returntype", void 0)
|
|
1946
2295
|
], PlaceService.prototype, "notifyRouteParametersChanged", null);
|
|
2296
|
+
__decorate([
|
|
2297
|
+
Trace(),
|
|
2298
|
+
__metadata("design:type", Function),
|
|
2299
|
+
__metadata("design:paramtypes", [ParameterSnapshot]),
|
|
2300
|
+
__metadata("design:returntype", Promise)
|
|
2301
|
+
], PlaceService.prototype, "sanitise", null);
|
|
1947
2302
|
if (false) {
|
|
1948
2303
|
/**
|
|
1949
2304
|
* @type {?}
|
|
@@ -1955,6 +2310,11 @@ if (false) {
|
|
|
1955
2310
|
* @protected
|
|
1956
2311
|
*/
|
|
1957
2312
|
PlaceService.prototype.router;
|
|
2313
|
+
/**
|
|
2314
|
+
* @type {?}
|
|
2315
|
+
* @protected
|
|
2316
|
+
*/
|
|
2317
|
+
PlaceService.prototype.injector;
|
|
1958
2318
|
}
|
|
1959
2319
|
|
|
1960
2320
|
/**
|
|
@@ -1997,11 +2357,18 @@ const right = [
|
|
|
1997
2357
|
})
|
|
1998
2358
|
])
|
|
1999
2359
|
];
|
|
2360
|
+
/**
|
|
2361
|
+
* @param {?} duration
|
|
2362
|
+
* @return {?}
|
|
2363
|
+
*/
|
|
2364
|
+
function leftRightPlaceAnimation(duration) {
|
|
2365
|
+
return trigger('routeAnimations', [
|
|
2366
|
+
transition(':increment', right, { params: { duration: duration } }),
|
|
2367
|
+
transition(':decrement', left, { params: { duration: duration } })
|
|
2368
|
+
]);
|
|
2369
|
+
}
|
|
2000
2370
|
/** @type {?} */
|
|
2001
|
-
const LEFT_RIGHT_PLACE_ANIMATION =
|
|
2002
|
-
transition(':increment', right, { params: { duration: '.3s' } }),
|
|
2003
|
-
transition(':decrement', left, { params: { duration: '.3s' } })
|
|
2004
|
-
]);
|
|
2371
|
+
const LEFT_RIGHT_PLACE_ANIMATION = leftRightPlaceAnimation("0.3s");
|
|
2005
2372
|
|
|
2006
2373
|
/**
|
|
2007
2374
|
* @fileoverview added by tsickle
|
|
@@ -2099,51 +2466,20 @@ if (false) {
|
|
|
2099
2466
|
* @fileoverview added by tsickle
|
|
2100
2467
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2101
2468
|
*/
|
|
2102
|
-
class TabbedPlaceNavigationComponent extends
|
|
2469
|
+
class TabbedPlaceNavigationComponent extends AbstractPlaceNavigationComponent {
|
|
2103
2470
|
constructor() {
|
|
2104
2471
|
super();
|
|
2105
|
-
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
2106
|
-
this.orderedPlaces = chain(this.placesModel).map((/**
|
|
2107
|
-
* @param {?} c
|
|
2108
|
-
* @return {?}
|
|
2109
|
-
*/
|
|
2110
|
-
c => PlaceComponent.getDefinition(c))).sortBy('order');
|
|
2111
|
-
}
|
|
2112
|
-
/**
|
|
2113
|
-
* @return {?}
|
|
2114
|
-
*/
|
|
2115
|
-
ngOnInit() {
|
|
2116
2472
|
}
|
|
2117
2473
|
}
|
|
2118
2474
|
TabbedPlaceNavigationComponent.decorators = [
|
|
2119
2475
|
{ type: Component, args: [{
|
|
2120
2476
|
selector: 'angular-ui-powerups-tabbed-place-navigation',
|
|
2121
|
-
template: "<nav mat-tab-nav-bar>\n <a mat-tab-link *ngFor=\"let
|
|
2477
|
+
template: "<nav mat-tab-nav-bar>\n <a mat-tab-link *ngFor=\"let place of placeDefinitions.value\"\n [routerLink]='place.path'\n routerLinkActive #rla=\"routerLinkActive\"\n [active]=\"rla.isActive\"\n [matTooltip]=\"getNavItem(place).tooltip()\">\n <mat-icon *ngIf=\"getNavItem(place).icon()\">{{getNavItem(place).icon()}}</mat-icon>\n <span>{{getNavItem(place).title()}}</span>\n </a>\n</nav>\n",
|
|
2122
2478
|
styles: [""]
|
|
2123
2479
|
}] }
|
|
2124
2480
|
];
|
|
2125
2481
|
/** @nocollapse */
|
|
2126
2482
|
TabbedPlaceNavigationComponent.ctorParameters = () => [];
|
|
2127
|
-
TabbedPlaceNavigationComponent.propDecorators = {
|
|
2128
|
-
places: [{ type: Input }],
|
|
2129
|
-
placesModel: [{ type: Input }]
|
|
2130
|
-
};
|
|
2131
|
-
__decorate([
|
|
2132
|
-
StoreInListModel('placesModel'),
|
|
2133
|
-
__metadata("design:type", Array)
|
|
2134
|
-
], TabbedPlaceNavigationComponent.prototype, "places", void 0);
|
|
2135
|
-
__decorate([
|
|
2136
|
-
UseDelegate(),
|
|
2137
|
-
__metadata("design:type", ListModel)
|
|
2138
|
-
], TabbedPlaceNavigationComponent.prototype, "placesModel", void 0);
|
|
2139
|
-
if (false) {
|
|
2140
|
-
/** @type {?} */
|
|
2141
|
-
TabbedPlaceNavigationComponent.prototype.places;
|
|
2142
|
-
/** @type {?} */
|
|
2143
|
-
TabbedPlaceNavigationComponent.prototype.placesModel;
|
|
2144
|
-
/** @type {?} */
|
|
2145
|
-
TabbedPlaceNavigationComponent.prototype.orderedPlaces;
|
|
2146
|
-
}
|
|
2147
2483
|
|
|
2148
2484
|
/**
|
|
2149
2485
|
* @fileoverview added by tsickle
|
|
@@ -2167,14 +2503,16 @@ PlaceModule.decorators = [
|
|
|
2167
2503
|
EmptyStateComponent,
|
|
2168
2504
|
BusyOverlayComponent,
|
|
2169
2505
|
PlaceOutletComponent,
|
|
2170
|
-
TabbedPlaceNavigationComponent
|
|
2506
|
+
TabbedPlaceNavigationComponent,
|
|
2507
|
+
ListPlaceNavComponent
|
|
2171
2508
|
],
|
|
2172
2509
|
entryComponents: [BusyOverlayComponent],
|
|
2173
2510
|
exports: [
|
|
2174
2511
|
BusyOverlayComponent,
|
|
2175
2512
|
PlaceOutletComponent,
|
|
2176
2513
|
EmptyStateComponent,
|
|
2177
|
-
TabbedPlaceNavigationComponent
|
|
2514
|
+
TabbedPlaceNavigationComponent,
|
|
2515
|
+
ListPlaceNavComponent
|
|
2178
2516
|
],
|
|
2179
2517
|
providers: [
|
|
2180
2518
|
PlaceService
|
|
@@ -2196,11 +2534,10 @@ AngularUiPowerupsModule.decorators = [
|
|
|
2196
2534
|
NumberInputComponent,
|
|
2197
2535
|
StringInputComponent,
|
|
2198
2536
|
PasswordInputComponent,
|
|
2199
|
-
SelectInputComponent
|
|
2537
|
+
SelectInputComponent
|
|
2200
2538
|
],
|
|
2201
2539
|
imports: [
|
|
2202
2540
|
CommonModule,
|
|
2203
|
-
BrowserModule,
|
|
2204
2541
|
BrowserAnimationsModule,
|
|
2205
2542
|
FormsModule,
|
|
2206
2543
|
MatInputModule,
|
|
@@ -2217,7 +2554,7 @@ AngularUiPowerupsModule.decorators = [
|
|
|
2217
2554
|
PasswordInputComponent,
|
|
2218
2555
|
SelectInputComponent,
|
|
2219
2556
|
InteractionModule,
|
|
2220
|
-
PlaceModule
|
|
2557
|
+
PlaceModule
|
|
2221
2558
|
]
|
|
2222
2559
|
},] }
|
|
2223
2560
|
];
|
|
@@ -2566,14 +2903,37 @@ if (false) {
|
|
|
2566
2903
|
/**
|
|
2567
2904
|
* @record
|
|
2568
2905
|
*/
|
|
2569
|
-
function
|
|
2906
|
+
function NavItem() { }
|
|
2907
|
+
if (false) {
|
|
2908
|
+
/**
|
|
2909
|
+
* @return {?}
|
|
2910
|
+
*/
|
|
2911
|
+
NavItem.prototype.title = function () { };
|
|
2912
|
+
/**
|
|
2913
|
+
* @return {?}
|
|
2914
|
+
*/
|
|
2915
|
+
NavItem.prototype.icon = function () { };
|
|
2916
|
+
/**
|
|
2917
|
+
* @return {?}
|
|
2918
|
+
*/
|
|
2919
|
+
NavItem.prototype.tooltip = function () { };
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
/**
|
|
2923
|
+
* @fileoverview added by tsickle
|
|
2924
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2925
|
+
*/
|
|
2926
|
+
/**
|
|
2927
|
+
* @record
|
|
2928
|
+
*/
|
|
2929
|
+
function PlaceComponentLike() { }
|
|
2570
2930
|
if (false) {
|
|
2571
2931
|
/** @type {?} */
|
|
2572
|
-
|
|
2932
|
+
PlaceComponentLike.prototype.activatedRoute;
|
|
2573
2933
|
/**
|
|
2574
2934
|
* @return {?}
|
|
2575
2935
|
*/
|
|
2576
|
-
|
|
2936
|
+
PlaceComponentLike.prototype.onPlaceReady = function () { };
|
|
2577
2937
|
}
|
|
2578
2938
|
|
|
2579
2939
|
/**
|
|
@@ -2583,13 +2943,13 @@ if (false) {
|
|
|
2583
2943
|
/**
|
|
2584
2944
|
* @record
|
|
2585
2945
|
*/
|
|
2586
|
-
function
|
|
2946
|
+
function PlaceUpdatesService() { }
|
|
2587
2947
|
if (false) {
|
|
2588
2948
|
/**
|
|
2589
2949
|
* @param {?} params
|
|
2590
2950
|
* @return {?}
|
|
2591
2951
|
*/
|
|
2592
|
-
|
|
2952
|
+
PlaceUpdatesService.prototype.notifyRouteParametersChanged = function (params) { };
|
|
2593
2953
|
}
|
|
2594
2954
|
|
|
2595
2955
|
/**
|
|
@@ -2613,6 +2973,28 @@ function Place(options) {
|
|
|
2613
2973
|
});
|
|
2614
2974
|
}
|
|
2615
2975
|
|
|
2976
|
+
/**
|
|
2977
|
+
* @fileoverview added by tsickle
|
|
2978
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2979
|
+
*/
|
|
2980
|
+
/**
|
|
2981
|
+
* @record
|
|
2982
|
+
*/
|
|
2983
|
+
function Visit() { }
|
|
2984
|
+
if (false) {
|
|
2985
|
+
/** @type {?} */
|
|
2986
|
+
Visit.prototype.placeDefinition;
|
|
2987
|
+
/**
|
|
2988
|
+
* @return {?}
|
|
2989
|
+
*/
|
|
2990
|
+
Visit.prototype.getRouteId = function () { };
|
|
2991
|
+
/**
|
|
2992
|
+
* @param {?} name
|
|
2993
|
+
* @return {?}
|
|
2994
|
+
*/
|
|
2995
|
+
Visit.prototype.getRouteParameter = function (name) { };
|
|
2996
|
+
}
|
|
2997
|
+
|
|
2616
2998
|
/**
|
|
2617
2999
|
* @fileoverview added by tsickle
|
|
2618
3000
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -2634,7 +3016,16 @@ class LeavePlaceGuard {
|
|
|
2634
3016
|
* @return {?}
|
|
2635
3017
|
*/
|
|
2636
3018
|
canDeactivate(component, currentRoute, currentState, nextState) {
|
|
2637
|
-
|
|
3019
|
+
// HACK: this will break with child routes...
|
|
3020
|
+
/** @type {?} */
|
|
3021
|
+
let path = `/${component.placeDefinition.path}`;
|
|
3022
|
+
console.log({ path: path, next: nextState.url });
|
|
3023
|
+
if (!nextState.url.startsWith(path)) {
|
|
3024
|
+
return component.canDeactivate();
|
|
3025
|
+
}
|
|
3026
|
+
else {
|
|
3027
|
+
return true;
|
|
3028
|
+
}
|
|
2638
3029
|
}
|
|
2639
3030
|
}
|
|
2640
3031
|
LeavePlaceGuard.decorators = [
|
|
@@ -2665,341 +3056,135 @@ if (false) {
|
|
|
2665
3056
|
* @fileoverview added by tsickle
|
|
2666
3057
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2667
3058
|
*/
|
|
2668
|
-
|
|
2669
|
-
* @abstract
|
|
2670
|
-
* @template T, S
|
|
2671
|
-
*/
|
|
2672
|
-
class Sanitiser {
|
|
3059
|
+
class PlaceRouteGuard {
|
|
2673
3060
|
/**
|
|
2674
|
-
* @param {?}
|
|
2675
|
-
* @param {?}
|
|
2676
|
-
* @param {?} sanitiser
|
|
3061
|
+
* @param {?} placeService
|
|
3062
|
+
* @param {?} router
|
|
2677
3063
|
*/
|
|
2678
|
-
constructor(
|
|
2679
|
-
this.
|
|
2680
|
-
this.
|
|
2681
|
-
this.sanitiser = sanitiser;
|
|
3064
|
+
constructor(placeService, router) {
|
|
3065
|
+
this.placeService = placeService;
|
|
3066
|
+
this.router = router;
|
|
2682
3067
|
}
|
|
2683
3068
|
/**
|
|
3069
|
+
* @param {?} route
|
|
3070
|
+
* @param {?} state
|
|
2684
3071
|
* @return {?}
|
|
2685
3072
|
*/
|
|
2686
|
-
|
|
2687
|
-
|
|
3073
|
+
canActivate(route, state) {
|
|
3074
|
+
// Implement this when adding child routes.
|
|
3075
|
+
// TODO: there are really two types of snapshot, ones with id's and ones without.
|
|
3076
|
+
// Id snapshot are repesented by 2 url segments
|
|
3077
|
+
// ID => [{'/basePath', params}, {'id', params}]
|
|
3078
|
+
// NO ID => [{'/basePath', params}]
|
|
3079
|
+
console.log({ urlSegments: route.url });
|
|
3080
|
+
// const snapshot = ParameterSnapshot.create(PlaceComponent.getDefinition(route.component as Constructable<PlaceComponent>), route.paramMap);
|
|
3081
|
+
// return this.placeService.sanitise(snapshot).then(sanitised => {
|
|
3082
|
+
// if (sanitised.hasChanged(snapshot)) {
|
|
3083
|
+
// return this.router.createUrlTree(snapshot.updateUrl(route.url))
|
|
3084
|
+
// } else {
|
|
3085
|
+
// return true;
|
|
3086
|
+
// }
|
|
3087
|
+
// });
|
|
3088
|
+
return true;
|
|
2688
3089
|
}
|
|
3090
|
+
}
|
|
3091
|
+
PlaceRouteGuard.decorators = [
|
|
3092
|
+
{ type: Injectable, args: [{
|
|
3093
|
+
providedIn: 'root'
|
|
3094
|
+
},] }
|
|
3095
|
+
];
|
|
3096
|
+
/** @nocollapse */
|
|
3097
|
+
PlaceRouteGuard.ctorParameters = () => [
|
|
3098
|
+
{ type: PlaceService },
|
|
3099
|
+
{ type: Router }
|
|
3100
|
+
];
|
|
3101
|
+
/** @nocollapse */ PlaceRouteGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouteGuard_Factory() { return new PlaceRouteGuard(ɵɵinject(PlaceService), ɵɵinject(Router)); }, token: PlaceRouteGuard, providedIn: "root" });
|
|
3102
|
+
if (false) {
|
|
2689
3103
|
/**
|
|
2690
|
-
* @
|
|
3104
|
+
* @type {?}
|
|
3105
|
+
* @private
|
|
2691
3106
|
*/
|
|
2692
|
-
|
|
2693
|
-
return !isNil(this.initialValue) && this.hasChanged(this.initialValue, this.sanitisedValue);
|
|
2694
|
-
}
|
|
3107
|
+
PlaceRouteGuard.prototype.placeService;
|
|
2695
3108
|
/**
|
|
2696
|
-
* @
|
|
3109
|
+
* @type {?}
|
|
3110
|
+
* @private
|
|
2697
3111
|
*/
|
|
2698
|
-
|
|
2699
|
-
|
|
3112
|
+
PlaceRouteGuard.prototype.router;
|
|
3113
|
+
}
|
|
3114
|
+
|
|
3115
|
+
/**
|
|
3116
|
+
* @fileoverview added by tsickle
|
|
3117
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3118
|
+
*/
|
|
3119
|
+
/**
|
|
3120
|
+
* @template T, S
|
|
3121
|
+
*/
|
|
3122
|
+
class DefaultParameterSanitiser {
|
|
3123
|
+
/**
|
|
3124
|
+
* @param {?} def
|
|
3125
|
+
* @param {?} placeService
|
|
3126
|
+
* @param {?} options
|
|
3127
|
+
*/
|
|
3128
|
+
constructor(def, placeService, options) {
|
|
3129
|
+
this.def = def;
|
|
3130
|
+
this.placeService = placeService;
|
|
3131
|
+
this.remember = isNil(options.remember) ? false : options.remember;
|
|
3132
|
+
this.defaultValue = isNil(options.defaultValue) ? null : options.defaultValue;
|
|
2700
3133
|
}
|
|
2701
3134
|
/**
|
|
3135
|
+
* @param {?} value
|
|
3136
|
+
* @param {?} visit
|
|
2702
3137
|
* @return {?}
|
|
2703
3138
|
*/
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
if (this.
|
|
2707
|
-
|
|
2708
|
-
this._sanitisedValue = yield this.sanitiser.sanitise(this.initialValue);
|
|
2709
|
-
if (this.initialValue !== this._sanitisedValue) {
|
|
2710
|
-
return false;
|
|
2711
|
-
}
|
|
3139
|
+
sanitise(value, visit) {
|
|
3140
|
+
if (this.isBlank(value)) {
|
|
3141
|
+
if (this.remember) {
|
|
3142
|
+
// value = null;
|
|
2712
3143
|
}
|
|
2713
|
-
return
|
|
2714
|
-
}
|
|
3144
|
+
return this.isBlank(value) && !isNil(this.defaultValue) ? this.defaultValue : value;
|
|
3145
|
+
}
|
|
3146
|
+
else {
|
|
3147
|
+
return value;
|
|
3148
|
+
}
|
|
2715
3149
|
}
|
|
2716
|
-
}
|
|
2717
|
-
if (false) {
|
|
2718
3150
|
/**
|
|
2719
|
-
* @type {?}
|
|
2720
3151
|
* @private
|
|
3152
|
+
* @param {?} value
|
|
3153
|
+
* @return {?}
|
|
2721
3154
|
*/
|
|
2722
|
-
|
|
2723
|
-
/**
|
|
2724
|
-
* @type {?}
|
|
2725
|
-
* @private
|
|
2726
|
-
*/
|
|
2727
|
-
Sanitiser.prototype._sanitisedValue;
|
|
2728
|
-
/** @type {?} */
|
|
2729
|
-
Sanitiser.prototype.parameterDef;
|
|
2730
|
-
/** @type {?} */
|
|
2731
|
-
Sanitiser.prototype.snapshot;
|
|
2732
|
-
/** @type {?} */
|
|
2733
|
-
Sanitiser.prototype.sanitiser;
|
|
2734
|
-
/**
|
|
2735
|
-
* @abstract
|
|
2736
|
-
* @protected
|
|
2737
|
-
* @param {?} snapshot
|
|
2738
|
-
* @return {?}
|
|
2739
|
-
*/
|
|
2740
|
-
Sanitiser.prototype.readFrom = function (snapshot) { };
|
|
2741
|
-
/**
|
|
2742
|
-
* @abstract
|
|
2743
|
-
* @protected
|
|
2744
|
-
* @param {?} initialValue
|
|
2745
|
-
* @param {?} sanitisedValue
|
|
2746
|
-
* @return {?}
|
|
2747
|
-
*/
|
|
2748
|
-
Sanitiser.prototype.hasChanged = function (initialValue, sanitisedValue) { };
|
|
2749
|
-
/**
|
|
2750
|
-
* @abstract
|
|
2751
|
-
* @param {?} dest
|
|
2752
|
-
* @return {?}
|
|
2753
|
-
*/
|
|
2754
|
-
Sanitiser.prototype.injectRouteParam = function (dest) { };
|
|
2755
|
-
}
|
|
2756
|
-
class RouteParameterSanitiser {
|
|
2757
|
-
/**
|
|
2758
|
-
* @param {?} parameterDefs
|
|
2759
|
-
* @param {?} snapshot
|
|
2760
|
-
* @param {?} injector
|
|
2761
|
-
*/
|
|
2762
|
-
constructor(parameterDefs, snapshot, injector) {
|
|
2763
|
-
this.parameterDefs = parameterDefs;
|
|
2764
|
-
this.snapshot = snapshot;
|
|
2765
|
-
this.injector = injector;
|
|
2766
|
-
this.parameterSanitisers = [];
|
|
3155
|
+
isBlank(value) {
|
|
2767
3156
|
/** @type {?} */
|
|
2768
|
-
const
|
|
2769
|
-
|
|
2770
|
-
* @return {?}
|
|
2771
|
-
*/
|
|
2772
|
-
def => {
|
|
2773
|
-
return def.isArray ?
|
|
2774
|
-
new Sanitiser.Array(def, snapshot, this.getSanitiser(def)) :
|
|
2775
|
-
new Sanitiser.Value(def, snapshot, this.getSanitiser(def));
|
|
2776
|
-
}));
|
|
2777
|
-
this.routeIdSanitiser = sanitisers.find((/**
|
|
2778
|
-
* @param {?} p
|
|
2779
|
-
* @return {?}
|
|
2780
|
-
*/
|
|
2781
|
-
p => p.isRouteId()));
|
|
2782
|
-
this.parameterSanitisers = sanitisers.filter((/**
|
|
2783
|
-
* @param {?} p
|
|
2784
|
-
* @return {?}
|
|
2785
|
-
*/
|
|
2786
|
-
p => !p.isRouteId()));
|
|
2787
|
-
}
|
|
2788
|
-
/**
|
|
2789
|
-
* @return {?}
|
|
2790
|
-
*/
|
|
2791
|
-
sanitise() {
|
|
2792
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2793
|
-
if (this.routeIdSanitiser) {
|
|
2794
|
-
yield this.routeIdSanitiser.sanitize();
|
|
2795
|
-
if (this.routeIdSanitiser.valueChanged) {
|
|
2796
|
-
// if the route id isn't ok we redirect immediately as the query params may need to be sanitised in the
|
|
2797
|
-
// context of the route id.
|
|
2798
|
-
return false;
|
|
2799
|
-
}
|
|
2800
|
-
}
|
|
2801
|
-
for (const sanitiser of this.parameterSanitisers) {
|
|
2802
|
-
yield sanitiser.sanitize();
|
|
2803
|
-
}
|
|
2804
|
-
return !this.parameterSanitisers.find((/**
|
|
2805
|
-
* @param {?} s
|
|
2806
|
-
* @return {?}
|
|
2807
|
-
*/
|
|
2808
|
-
s => s.valueChanged));
|
|
2809
|
-
});
|
|
2810
|
-
}
|
|
2811
|
-
/**
|
|
2812
|
-
* @param {?} router
|
|
2813
|
-
* @return {?}
|
|
2814
|
-
*/
|
|
2815
|
-
redirect(router) {
|
|
2816
|
-
assert.isTruthy(this.parameterSanitisers.length !== 0);
|
|
2817
|
-
if (this.routeIdSanitiser.valueChanged) {
|
|
2818
|
-
return router.navigate(['..', this.routeIdSanitiser.sanitisedValue]);
|
|
2819
|
-
}
|
|
2820
|
-
else {
|
|
2821
|
-
/** @type {?} */
|
|
2822
|
-
const routeParams = {};
|
|
2823
|
-
this.parameterSanitisers.forEach((/**
|
|
2824
|
-
* @param {?} s
|
|
2825
|
-
* @return {?}
|
|
2826
|
-
*/
|
|
2827
|
-
s => s.injectRouteParam(routeParams)));
|
|
2828
|
-
return router.navigate(['.', routeParams]);
|
|
2829
|
-
}
|
|
2830
|
-
}
|
|
2831
|
-
/**
|
|
2832
|
-
* @private
|
|
2833
|
-
* @template T, S
|
|
2834
|
-
* @param {?} def
|
|
2835
|
-
* @return {?}
|
|
2836
|
-
*/
|
|
2837
|
-
getSanitiser(def) {
|
|
2838
|
-
return def.sanitiser ? this.injector.get(def.sanitiser, new def.sanitiser()) : null;
|
|
3157
|
+
const isNil$1 = isNil(value);
|
|
3158
|
+
return this.def.isArray ? !isNil$1 || value['length'] < 1 : isNil$1;
|
|
2839
3159
|
}
|
|
2840
3160
|
}
|
|
2841
3161
|
__decorate([
|
|
2842
|
-
|
|
3162
|
+
Trace(),
|
|
2843
3163
|
__metadata("design:type", Function),
|
|
2844
|
-
__metadata("design:paramtypes", [Object]),
|
|
3164
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
2845
3165
|
__metadata("design:returntype", Object)
|
|
2846
|
-
],
|
|
3166
|
+
], DefaultParameterSanitiser.prototype, "sanitise", null);
|
|
2847
3167
|
if (false) {
|
|
2848
3168
|
/**
|
|
2849
3169
|
* @type {?}
|
|
2850
3170
|
* @private
|
|
2851
3171
|
*/
|
|
2852
|
-
|
|
3172
|
+
DefaultParameterSanitiser.prototype.remember;
|
|
2853
3173
|
/**
|
|
2854
3174
|
* @type {?}
|
|
2855
3175
|
* @private
|
|
2856
3176
|
*/
|
|
2857
|
-
|
|
2858
|
-
/** @type {?} */
|
|
2859
|
-
RouteParameterSanitiser.prototype.parameterDefs;
|
|
2860
|
-
/** @type {?} */
|
|
2861
|
-
RouteParameterSanitiser.prototype.snapshot;
|
|
2862
|
-
/** @type {?} */
|
|
2863
|
-
RouteParameterSanitiser.prototype.injector;
|
|
2864
|
-
}
|
|
2865
|
-
(function (Sanitiser) {
|
|
2866
|
-
/**
|
|
2867
|
-
* @template T
|
|
2868
|
-
*/
|
|
2869
|
-
class Value extends Sanitiser {
|
|
2870
|
-
/**
|
|
2871
|
-
* @param {?} snapshot
|
|
2872
|
-
* @return {?}
|
|
2873
|
-
*/
|
|
2874
|
-
readFrom(snapshot) {
|
|
2875
|
-
/** @type {?} */
|
|
2876
|
-
const rawValue = this.parameterDef.isRouteId ?
|
|
2877
|
-
snapshot.paramMap.get(this.parameterDef.name) :
|
|
2878
|
-
snapshot.queryParamMap.get(this.parameterDef.name);
|
|
2879
|
-
return this.parameterDef.type.parse(rawValue);
|
|
2880
|
-
}
|
|
2881
|
-
/**
|
|
2882
|
-
* @protected
|
|
2883
|
-
* @param {?} initialValue
|
|
2884
|
-
* @param {?} sanitisedValue
|
|
2885
|
-
* @return {?}
|
|
2886
|
-
*/
|
|
2887
|
-
hasChanged(initialValue, sanitisedValue) {
|
|
2888
|
-
return initialValue !== sanitisedValue;
|
|
2889
|
-
}
|
|
2890
|
-
/**
|
|
2891
|
-
* @param {?} dest
|
|
2892
|
-
* @return {?}
|
|
2893
|
-
*/
|
|
2894
|
-
injectRouteParam(dest) {
|
|
2895
|
-
dest[this.parameterDef.name] = this.parameterDef.type.format(this.sanitisedValue);
|
|
2896
|
-
}
|
|
2897
|
-
}
|
|
2898
|
-
Sanitiser.Value = Value;
|
|
2899
|
-
/**
|
|
2900
|
-
* @template T
|
|
2901
|
-
*/
|
|
2902
|
-
class Array extends Sanitiser {
|
|
2903
|
-
/**
|
|
2904
|
-
* @param {?} snapshot
|
|
2905
|
-
* @return {?}
|
|
2906
|
-
*/
|
|
2907
|
-
readFrom(snapshot) {
|
|
2908
|
-
/** @type {?} */
|
|
2909
|
-
const rawValues = snapshot.queryParamMap.getAll(this.parameterDef.name);
|
|
2910
|
-
return rawValues.map((/**
|
|
2911
|
-
* @param {?} value
|
|
2912
|
-
* @return {?}
|
|
2913
|
-
*/
|
|
2914
|
-
value => this.parameterDef.type.parse(value)));
|
|
2915
|
-
}
|
|
2916
|
-
/**
|
|
2917
|
-
* @protected
|
|
2918
|
-
* @param {?} initialValue
|
|
2919
|
-
* @param {?} sanitisedValue
|
|
2920
|
-
* @return {?}
|
|
2921
|
-
*/
|
|
2922
|
-
hasChanged(initialValue, sanitisedValue) {
|
|
2923
|
-
return initialValue !== sanitisedValue;
|
|
2924
|
-
}
|
|
2925
|
-
/**
|
|
2926
|
-
* @param {?} dest
|
|
2927
|
-
* @return {?}
|
|
2928
|
-
*/
|
|
2929
|
-
injectRouteParam(dest) {
|
|
2930
|
-
dest[this.parameterDef.name] = this.sanitisedValue.map((/**
|
|
2931
|
-
* @param {?} v
|
|
2932
|
-
* @return {?}
|
|
2933
|
-
*/
|
|
2934
|
-
v => this.parameterDef.type.format(v)));
|
|
2935
|
-
}
|
|
2936
|
-
}
|
|
2937
|
-
Sanitiser.Array = Array;
|
|
2938
|
-
})(Sanitiser || (Sanitiser = {}));
|
|
2939
|
-
|
|
2940
|
-
/**
|
|
2941
|
-
* @fileoverview added by tsickle
|
|
2942
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2943
|
-
*/
|
|
2944
|
-
class PlaceRouteGuard {
|
|
2945
|
-
/**
|
|
2946
|
-
* @param {?} router
|
|
2947
|
-
* @param {?} injector
|
|
2948
|
-
*/
|
|
2949
|
-
constructor(router, injector) {
|
|
2950
|
-
this.router = router;
|
|
2951
|
-
this.injector = injector;
|
|
2952
|
-
}
|
|
2953
|
-
/**
|
|
2954
|
-
* @param {?} route
|
|
2955
|
-
* @param {?} state
|
|
2956
|
-
* @return {?}
|
|
2957
|
-
*/
|
|
2958
|
-
canActivate(route, state) {
|
|
2959
|
-
/** @type {?} */
|
|
2960
|
-
const routeParameters = Klass.get(route.component).getMetadataList(RouteParameterBindings.ROUTE_PARAMETER_LIST_KEY);
|
|
2961
|
-
/** @type {?} */
|
|
2962
|
-
const sanitiser = new RouteParameterSanitiser(routeParameters, route, this.injector);
|
|
2963
|
-
return sanitiser.sanitise().then((/**
|
|
2964
|
-
* @param {?} proceed
|
|
2965
|
-
* @return {?}
|
|
2966
|
-
*/
|
|
2967
|
-
proceed => {
|
|
2968
|
-
if (!proceed) {
|
|
2969
|
-
sanitiser.redirect(this.router);
|
|
2970
|
-
}
|
|
2971
|
-
return proceed;
|
|
2972
|
-
}));
|
|
2973
|
-
}
|
|
2974
|
-
}
|
|
2975
|
-
PlaceRouteGuard.decorators = [
|
|
2976
|
-
{ type: Injectable, args: [{
|
|
2977
|
-
providedIn: 'root'
|
|
2978
|
-
},] }
|
|
2979
|
-
];
|
|
2980
|
-
/** @nocollapse */
|
|
2981
|
-
PlaceRouteGuard.ctorParameters = () => [
|
|
2982
|
-
{ type: Router },
|
|
2983
|
-
{ type: Injector }
|
|
2984
|
-
];
|
|
2985
|
-
/** @nocollapse */ PlaceRouteGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouteGuard_Factory() { return new PlaceRouteGuard(ɵɵinject(Router), ɵɵinject(INJECTOR)); }, token: PlaceRouteGuard, providedIn: "root" });
|
|
2986
|
-
__decorate([
|
|
2987
|
-
Trace(),
|
|
2988
|
-
__metadata("design:type", Function),
|
|
2989
|
-
__metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot]),
|
|
2990
|
-
__metadata("design:returntype", Object)
|
|
2991
|
-
], PlaceRouteGuard.prototype, "canActivate", null);
|
|
2992
|
-
if (false) {
|
|
3177
|
+
DefaultParameterSanitiser.prototype.defaultValue;
|
|
2993
3178
|
/**
|
|
2994
3179
|
* @type {?}
|
|
2995
3180
|
* @private
|
|
2996
3181
|
*/
|
|
2997
|
-
|
|
3182
|
+
DefaultParameterSanitiser.prototype.def;
|
|
2998
3183
|
/**
|
|
2999
3184
|
* @type {?}
|
|
3000
3185
|
* @private
|
|
3001
3186
|
*/
|
|
3002
|
-
|
|
3187
|
+
DefaultParameterSanitiser.prototype.placeService;
|
|
3003
3188
|
}
|
|
3004
3189
|
|
|
3005
3190
|
/**
|
|
@@ -3030,6 +3215,10 @@ if (false) {
|
|
|
3030
3215
|
/** @type {?|undefined} */
|
|
3031
3216
|
ParameterOptions.prototype.optional;
|
|
3032
3217
|
/** @type {?|undefined} */
|
|
3218
|
+
ParameterOptions.prototype.remember;
|
|
3219
|
+
/** @type {?|undefined} */
|
|
3220
|
+
ParameterOptions.prototype.defaultValue;
|
|
3221
|
+
/** @type {?|undefined} */
|
|
3033
3222
|
ParameterOptions.prototype.sanitiser;
|
|
3034
3223
|
}
|
|
3035
3224
|
/**
|
|
@@ -3043,7 +3232,11 @@ if (false) {
|
|
|
3043
3232
|
/** @type {?|undefined} */
|
|
3044
3233
|
ListParameterOptions.prototype.optional;
|
|
3045
3234
|
/** @type {?|undefined} */
|
|
3046
|
-
ListParameterOptions.prototype.
|
|
3235
|
+
ListParameterOptions.prototype.remember;
|
|
3236
|
+
/** @type {?|undefined} */
|
|
3237
|
+
ListParameterOptions.prototype.defaultValue;
|
|
3238
|
+
/** @type {?|undefined} */
|
|
3239
|
+
ListParameterOptions.prototype.sanitiser;
|
|
3047
3240
|
}
|
|
3048
3241
|
/**
|
|
3049
3242
|
* @template T
|
|
@@ -3061,7 +3254,7 @@ function RouteId(type, options) {
|
|
|
3061
3254
|
(prototype, propertyKey) => {
|
|
3062
3255
|
/** @type {?} */
|
|
3063
3256
|
const param = createDefinition(propertyKey, type, options, true);
|
|
3064
|
-
Klass.get(prototype).addToOwnMetadataList(
|
|
3257
|
+
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
3065
3258
|
UseDelegate()(prototype, propertyKey);
|
|
3066
3259
|
});
|
|
3067
3260
|
}
|
|
@@ -3081,7 +3274,7 @@ function RouteParameter(type, options) {
|
|
|
3081
3274
|
(prototype, propertyKey) => {
|
|
3082
3275
|
/** @type {?} */
|
|
3083
3276
|
const param = createDefinition(propertyKey, type, options, false);
|
|
3084
|
-
Klass.get(prototype).addToOwnMetadataList(
|
|
3277
|
+
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
3085
3278
|
UseDelegate()(prototype, propertyKey);
|
|
3086
3279
|
});
|
|
3087
3280
|
}
|
|
@@ -3101,7 +3294,7 @@ function RouteParameterList(elementType, options) {
|
|
|
3101
3294
|
(prototype, propertyKey) => {
|
|
3102
3295
|
/** @type {?} */
|
|
3103
3296
|
const param = createArrayDefinition(propertyKey, elementType, options);
|
|
3104
|
-
Klass.get(prototype).addToOwnMetadataList(
|
|
3297
|
+
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
3105
3298
|
UseDelegate()(prototype, propertyKey);
|
|
3106
3299
|
});
|
|
3107
3300
|
}
|
|
@@ -3146,7 +3339,7 @@ function createArrayDefinition(propertyName, type, options) {
|
|
|
3146
3339
|
name: opts.getOptional('as', propertyNameAsString),
|
|
3147
3340
|
propertyName: propertyNameAsString,
|
|
3148
3341
|
type: assert.notNil(type),
|
|
3149
|
-
sanitiser: opts.getOptional('
|
|
3342
|
+
sanitiser: opts.getOptional('sanitiser', null),
|
|
3150
3343
|
isRouteId: false,
|
|
3151
3344
|
isArray: true
|
|
3152
3345
|
};
|
|
@@ -3159,7 +3352,7 @@ function createArrayDefinition(propertyName, type, options) {
|
|
|
3159
3352
|
*/
|
|
3160
3353
|
/**
|
|
3161
3354
|
* @record
|
|
3162
|
-
* @template
|
|
3355
|
+
* @template T, S
|
|
3163
3356
|
*/
|
|
3164
3357
|
function ParameterDefinition() { }
|
|
3165
3358
|
if (false) {
|
|
@@ -3189,10 +3382,25 @@ function ParameterSanitiser() { }
|
|
|
3189
3382
|
if (false) {
|
|
3190
3383
|
/**
|
|
3191
3384
|
* @param {?} value
|
|
3385
|
+
* @param {?=} visit
|
|
3192
3386
|
* @return {?}
|
|
3193
3387
|
*/
|
|
3194
|
-
ParameterSanitiser.prototype.sanitise = function (value) { };
|
|
3388
|
+
ParameterSanitiser.prototype.sanitise = function (value, visit) { };
|
|
3195
3389
|
}
|
|
3390
|
+
(function (ParameterSanitiser) {
|
|
3391
|
+
/**
|
|
3392
|
+
* @record
|
|
3393
|
+
* @template T
|
|
3394
|
+
*/
|
|
3395
|
+
function Options() { }
|
|
3396
|
+
ParameterSanitiser.Options = Options;
|
|
3397
|
+
if (false) {
|
|
3398
|
+
/** @type {?|undefined} */
|
|
3399
|
+
Options.prototype.remember;
|
|
3400
|
+
/** @type {?|undefined} */
|
|
3401
|
+
Options.prototype.defaultValue;
|
|
3402
|
+
}
|
|
3403
|
+
})(ParameterSanitiser || (ParameterSanitiser = {}));
|
|
3196
3404
|
|
|
3197
3405
|
/**
|
|
3198
3406
|
* @fileoverview added by tsickle
|
|
@@ -3230,7 +3438,7 @@ var ParameterType;
|
|
|
3230
3438
|
* @return {?}
|
|
3231
3439
|
*/
|
|
3232
3440
|
parse(value) {
|
|
3233
|
-
return +value;
|
|
3441
|
+
return isNil(value) || isEmpty(value) ? null : +value;
|
|
3234
3442
|
}
|
|
3235
3443
|
}
|
|
3236
3444
|
class BooleanType {
|
|
@@ -3259,23 +3467,310 @@ var ParameterType;
|
|
|
3259
3467
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3260
3468
|
*/
|
|
3261
3469
|
/**
|
|
3262
|
-
* @
|
|
3263
|
-
* @template T
|
|
3470
|
+
* @template T, S
|
|
3264
3471
|
*/
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3472
|
+
class Sanitiser {
|
|
3473
|
+
/**
|
|
3474
|
+
* @param {?} parameterDef
|
|
3475
|
+
* @param {?} snapshot
|
|
3476
|
+
* @param {?} sanitiser
|
|
3477
|
+
*/
|
|
3478
|
+
constructor(parameterDef, snapshot, sanitiser) {
|
|
3479
|
+
this.parameterDef = parameterDef;
|
|
3480
|
+
this.snapshot = snapshot;
|
|
3481
|
+
this.sanitiser = sanitiser;
|
|
3482
|
+
}
|
|
3483
|
+
/**
|
|
3484
|
+
* @return {?}
|
|
3485
|
+
*/
|
|
3486
|
+
isRouteId() {
|
|
3487
|
+
return this.parameterDef.isRouteId;
|
|
3488
|
+
}
|
|
3489
|
+
/**
|
|
3490
|
+
* @return {?}
|
|
3491
|
+
*/
|
|
3492
|
+
get valueChanged() {
|
|
3493
|
+
return !isNil(this.initialValue) && this.hasChanged(this.initialValue, this.sanitisedValue);
|
|
3494
|
+
}
|
|
3495
|
+
/**
|
|
3496
|
+
* @return {?}
|
|
3497
|
+
*/
|
|
3498
|
+
get sanitisedValue() {
|
|
3499
|
+
return this._sanitisedValue;
|
|
3500
|
+
}
|
|
3501
|
+
/**
|
|
3502
|
+
* @protected
|
|
3503
|
+
* @param {?} snapshot
|
|
3504
|
+
* @return {?}
|
|
3505
|
+
*/
|
|
3506
|
+
readFrom(snapshot) {
|
|
3507
|
+
return lang.abstractMethod(this.constructor);
|
|
3508
|
+
}
|
|
3509
|
+
/**
|
|
3510
|
+
* @protected
|
|
3511
|
+
* @param {?} initialValue
|
|
3512
|
+
* @param {?} sanitisedValue
|
|
3513
|
+
* @return {?}
|
|
3514
|
+
*/
|
|
3515
|
+
hasChanged(initialValue, sanitisedValue) {
|
|
3516
|
+
return lang.abstractMethod(this.constructor);
|
|
3517
|
+
}
|
|
3518
|
+
/**
|
|
3519
|
+
* @param {?} dest
|
|
3520
|
+
* @return {?}
|
|
3521
|
+
*/
|
|
3522
|
+
injectRouteParam(dest) {
|
|
3523
|
+
lang.abstractMethod(this.constructor);
|
|
3524
|
+
}
|
|
3525
|
+
/**
|
|
3526
|
+
* @return {?}
|
|
3527
|
+
*/
|
|
3528
|
+
sanitize() {
|
|
3529
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3530
|
+
if (this.sanitiser) {
|
|
3531
|
+
this.initialValue = this.readFrom(this.snapshot);
|
|
3532
|
+
this._sanitisedValue = yield this.sanitiser.sanitise(this.initialValue);
|
|
3533
|
+
if (this.initialValue !== this._sanitisedValue) {
|
|
3534
|
+
return false;
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
return true;
|
|
3538
|
+
});
|
|
3539
|
+
}
|
|
3278
3540
|
}
|
|
3541
|
+
if (false) {
|
|
3542
|
+
/**
|
|
3543
|
+
* @type {?}
|
|
3544
|
+
* @private
|
|
3545
|
+
*/
|
|
3546
|
+
Sanitiser.prototype.initialValue;
|
|
3547
|
+
/**
|
|
3548
|
+
* @type {?}
|
|
3549
|
+
* @private
|
|
3550
|
+
*/
|
|
3551
|
+
Sanitiser.prototype._sanitisedValue;
|
|
3552
|
+
/** @type {?} */
|
|
3553
|
+
Sanitiser.prototype.parameterDef;
|
|
3554
|
+
/** @type {?} */
|
|
3555
|
+
Sanitiser.prototype.snapshot;
|
|
3556
|
+
/** @type {?} */
|
|
3557
|
+
Sanitiser.prototype.sanitiser;
|
|
3558
|
+
}
|
|
3559
|
+
class RouteParameterSanitiser {
|
|
3560
|
+
/**
|
|
3561
|
+
* @param {?} parameterDefs
|
|
3562
|
+
* @param {?} snapshot
|
|
3563
|
+
* @param {?} placeService
|
|
3564
|
+
* @param {?} injector
|
|
3565
|
+
*/
|
|
3566
|
+
constructor(parameterDefs, snapshot, placeService, injector) {
|
|
3567
|
+
this.parameterDefs = parameterDefs;
|
|
3568
|
+
this.snapshot = snapshot;
|
|
3569
|
+
this.placeService = placeService;
|
|
3570
|
+
this.injector = injector;
|
|
3571
|
+
this.parameterSanitisers = [];
|
|
3572
|
+
/** @type {?} */
|
|
3573
|
+
const sanitisers = parameterDefs.map((/**
|
|
3574
|
+
* @param {?} def
|
|
3575
|
+
* @return {?}
|
|
3576
|
+
*/
|
|
3577
|
+
def => {
|
|
3578
|
+
return def.isArray ?
|
|
3579
|
+
new Sanitiser.Array(def, snapshot, this.getSanitiser(def)) :
|
|
3580
|
+
new Sanitiser.Value(def, snapshot, this.getSanitiser(def));
|
|
3581
|
+
}));
|
|
3582
|
+
this.routeIdSanitiser = sanitisers.find((/**
|
|
3583
|
+
* @param {?} p
|
|
3584
|
+
* @return {?}
|
|
3585
|
+
*/
|
|
3586
|
+
p => p.isRouteId()));
|
|
3587
|
+
this.parameterSanitisers = sanitisers.filter((/**
|
|
3588
|
+
* @param {?} p
|
|
3589
|
+
* @return {?}
|
|
3590
|
+
*/
|
|
3591
|
+
p => !p.isRouteId()));
|
|
3592
|
+
}
|
|
3593
|
+
/**
|
|
3594
|
+
* @return {?}
|
|
3595
|
+
*/
|
|
3596
|
+
sanitise() {
|
|
3597
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3598
|
+
if (this.routeIdSanitiser) {
|
|
3599
|
+
yield this.routeIdSanitiser.sanitize();
|
|
3600
|
+
if (this.routeIdSanitiser.valueChanged) {
|
|
3601
|
+
// if the route id isn't ok we redirect immediately as the query params may need to be sanitised in the
|
|
3602
|
+
// context of the route id.
|
|
3603
|
+
return false;
|
|
3604
|
+
}
|
|
3605
|
+
}
|
|
3606
|
+
for (const sanitiser of this.parameterSanitisers) {
|
|
3607
|
+
yield sanitiser.sanitize();
|
|
3608
|
+
}
|
|
3609
|
+
return !this.parameterSanitisers.find((/**
|
|
3610
|
+
* @param {?} s
|
|
3611
|
+
* @return {?}
|
|
3612
|
+
*/
|
|
3613
|
+
s => s.valueChanged));
|
|
3614
|
+
});
|
|
3615
|
+
}
|
|
3616
|
+
/**
|
|
3617
|
+
* @private
|
|
3618
|
+
* @template T, S
|
|
3619
|
+
* @param {?} def
|
|
3620
|
+
* @return {?}
|
|
3621
|
+
*/
|
|
3622
|
+
getSanitiser(def) {
|
|
3623
|
+
if (def.sanitiser) {
|
|
3624
|
+
if (this.isSanitiserContructor(def.sanitiser)) {
|
|
3625
|
+
return this.injector.get(def.sanitiser, new def.sanitiser());
|
|
3626
|
+
}
|
|
3627
|
+
else {
|
|
3628
|
+
return new DefaultParameterSanitiser(def, this.placeService, def.sanitiser);
|
|
3629
|
+
}
|
|
3630
|
+
}
|
|
3631
|
+
else {
|
|
3632
|
+
return null;
|
|
3633
|
+
}
|
|
3634
|
+
}
|
|
3635
|
+
/**
|
|
3636
|
+
* @return {?}
|
|
3637
|
+
*/
|
|
3638
|
+
routeIdHasChanged() {
|
|
3639
|
+
assert.isTruthy(this.parameterSanitisers.length !== 0);
|
|
3640
|
+
return this.routeIdSanitiser && this.routeIdSanitiser.valueChanged;
|
|
3641
|
+
}
|
|
3642
|
+
/**
|
|
3643
|
+
* @return {?}
|
|
3644
|
+
*/
|
|
3645
|
+
getRedirectParams() {
|
|
3646
|
+
if (this.routeIdHasChanged()) {
|
|
3647
|
+
return [this.routeIdSanitiser.sanitisedValue];
|
|
3648
|
+
}
|
|
3649
|
+
else {
|
|
3650
|
+
/** @type {?} */
|
|
3651
|
+
const routeParams = {};
|
|
3652
|
+
this.parameterSanitisers.forEach((/**
|
|
3653
|
+
* @param {?} s
|
|
3654
|
+
* @return {?}
|
|
3655
|
+
*/
|
|
3656
|
+
s => s.injectRouteParam(routeParams)));
|
|
3657
|
+
return [routeParams];
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
/**
|
|
3661
|
+
* @private
|
|
3662
|
+
* @template S
|
|
3663
|
+
* @param {?} value
|
|
3664
|
+
* @return {?}
|
|
3665
|
+
*/
|
|
3666
|
+
isSanitiserContructor(value) {
|
|
3667
|
+
return isFunction(value) && lang.constructorChain((/** @type {?} */ ((/** @type {?} */ (value))))).includes(Sanitiser);
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
__decorate([
|
|
3671
|
+
Memoize(),
|
|
3672
|
+
__metadata("design:type", Function),
|
|
3673
|
+
__metadata("design:paramtypes", [Object]),
|
|
3674
|
+
__metadata("design:returntype", Object)
|
|
3675
|
+
], RouteParameterSanitiser.prototype, "getSanitiser", null);
|
|
3676
|
+
__decorate([
|
|
3677
|
+
Trace(),
|
|
3678
|
+
__metadata("design:type", Function),
|
|
3679
|
+
__metadata("design:paramtypes", []),
|
|
3680
|
+
__metadata("design:returntype", Array)
|
|
3681
|
+
], RouteParameterSanitiser.prototype, "getRedirectParams", null);
|
|
3682
|
+
if (false) {
|
|
3683
|
+
/**
|
|
3684
|
+
* @type {?}
|
|
3685
|
+
* @private
|
|
3686
|
+
*/
|
|
3687
|
+
RouteParameterSanitiser.prototype.routeIdSanitiser;
|
|
3688
|
+
/**
|
|
3689
|
+
* @type {?}
|
|
3690
|
+
* @private
|
|
3691
|
+
*/
|
|
3692
|
+
RouteParameterSanitiser.prototype.parameterSanitisers;
|
|
3693
|
+
/** @type {?} */
|
|
3694
|
+
RouteParameterSanitiser.prototype.parameterDefs;
|
|
3695
|
+
/** @type {?} */
|
|
3696
|
+
RouteParameterSanitiser.prototype.snapshot;
|
|
3697
|
+
/** @type {?} */
|
|
3698
|
+
RouteParameterSanitiser.prototype.placeService;
|
|
3699
|
+
/** @type {?} */
|
|
3700
|
+
RouteParameterSanitiser.prototype.injector;
|
|
3701
|
+
}
|
|
3702
|
+
(function (Sanitiser) {
|
|
3703
|
+
/**
|
|
3704
|
+
* @template T
|
|
3705
|
+
*/
|
|
3706
|
+
class Value extends Sanitiser {
|
|
3707
|
+
/**
|
|
3708
|
+
* @param {?} snapshot
|
|
3709
|
+
* @return {?}
|
|
3710
|
+
*/
|
|
3711
|
+
readFrom(snapshot) {
|
|
3712
|
+
/** @type {?} */
|
|
3713
|
+
const rawValue = snapshot.paramMap.get(this.parameterDef.name);
|
|
3714
|
+
return this.parameterDef.type.parse(rawValue);
|
|
3715
|
+
}
|
|
3716
|
+
/**
|
|
3717
|
+
* @protected
|
|
3718
|
+
* @param {?} initialValue
|
|
3719
|
+
* @param {?} sanitisedValue
|
|
3720
|
+
* @return {?}
|
|
3721
|
+
*/
|
|
3722
|
+
hasChanged(initialValue, sanitisedValue) {
|
|
3723
|
+
return initialValue !== sanitisedValue;
|
|
3724
|
+
}
|
|
3725
|
+
/**
|
|
3726
|
+
* @param {?} dest
|
|
3727
|
+
* @return {?}
|
|
3728
|
+
*/
|
|
3729
|
+
injectRouteParam(dest) {
|
|
3730
|
+
dest[this.parameterDef.name] = this.parameterDef.type.format(this.sanitisedValue);
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3733
|
+
Sanitiser.Value = Value;
|
|
3734
|
+
/**
|
|
3735
|
+
* @template T
|
|
3736
|
+
*/
|
|
3737
|
+
class Array extends Sanitiser {
|
|
3738
|
+
/**
|
|
3739
|
+
* @param {?} snapshot
|
|
3740
|
+
* @return {?}
|
|
3741
|
+
*/
|
|
3742
|
+
readFrom(snapshot) {
|
|
3743
|
+
/** @type {?} */
|
|
3744
|
+
const rawValues = snapshot.paramMap.getAll(this.parameterDef.name);
|
|
3745
|
+
return rawValues.map((/**
|
|
3746
|
+
* @param {?} value
|
|
3747
|
+
* @return {?}
|
|
3748
|
+
*/
|
|
3749
|
+
value => this.parameterDef.type.parse(value)));
|
|
3750
|
+
}
|
|
3751
|
+
/**
|
|
3752
|
+
* @protected
|
|
3753
|
+
* @param {?} initialValue
|
|
3754
|
+
* @param {?} sanitisedValue
|
|
3755
|
+
* @return {?}
|
|
3756
|
+
*/
|
|
3757
|
+
hasChanged(initialValue, sanitisedValue) {
|
|
3758
|
+
return initialValue !== sanitisedValue;
|
|
3759
|
+
}
|
|
3760
|
+
/**
|
|
3761
|
+
* @param {?} dest
|
|
3762
|
+
* @return {?}
|
|
3763
|
+
*/
|
|
3764
|
+
injectRouteParam(dest) {
|
|
3765
|
+
dest[this.parameterDef.name] = this.sanitisedValue.map((/**
|
|
3766
|
+
* @param {?} v
|
|
3767
|
+
* @return {?}
|
|
3768
|
+
*/
|
|
3769
|
+
v => this.parameterDef.type.format(v)));
|
|
3770
|
+
}
|
|
3771
|
+
}
|
|
3772
|
+
Sanitiser.Array = Array;
|
|
3773
|
+
})(Sanitiser || (Sanitiser = {}));
|
|
3279
3774
|
|
|
3280
3775
|
/**
|
|
3281
3776
|
* @fileoverview added by tsickle
|
|
@@ -3297,5 +3792,5 @@ class VisitSnapshot {
|
|
|
3297
3792
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3298
3793
|
*/
|
|
3299
3794
|
|
|
3300
|
-
export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective, INTERACTION_CONTEXT, InteractionContext, InteractionModule, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, NumberInputComponent, ParameterType, PasswordInputComponent, Place, PlaceComponent, PlaceModule, PlaceOutletComponent, PlaceRouteGuard, PlaceService, Point,
|
|
3795
|
+
export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DefaultParameterSanitiser, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective, INTERACTION_CONTEXT, InteractionContext, InteractionModule, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NumberInputComponent, ParameterSnapshot, ParameterType, PasswordInputComponent, Place, PlaceComponent, PlaceModule, PlaceOutletComponent, PlaceRouteGuard, PlaceService, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, RouteParameter, RouteParameterList, RouteParameterSanitiser, Sanitiser, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, leftRightPlaceAnimation, slideDownAndUpAnimation, CommandDirective as ɵa, FocusBindingDirective as ɵb, DialogInteractionService as ɵbb, InteractionContext as ɵbc, DisposableComponent as ɵc, NumberInputComponent as ɵd, AbstractInputComponent as ɵe, StringInputComponent as ɵf, PasswordInputComponent as ɵg, SelectInputComponent as ɵh, PlaceModule as ɵi, EmptyStateComponent as ɵj, BusyOverlayComponent as ɵk, PlaceOutletComponent as ɵl, leftRightPlaceAnimation as ɵm, LEFT_RIGHT_PLACE_ANIMATION as ɵn, PlaceService as ɵo, TabbedPlaceNavigationComponent as ɵp, AbstractPlaceNavigationComponent as ɵq, ListPlaceNavComponent as ɵr, InteractionModule as ɵs, ActivityContainerComponent as ɵt, ActivityOutletComponent as ɵu, ConfirmationDialogComponent as ɵv, AbstractActivity as ɵw, ACTIVITY_DATA as ɵx, AlertDialogComponent as ɵz };
|
|
3301
3796
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|