@coolon/angular-ui-powerups 0.0.72 → 0.0.75
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 +1793 -1331
- 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 +35 -32
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +35 -32
- package/esm2015/index.js +2 -2
- package/esm2015/lib/angular-ui-powerups.module.js +8 -22
- package/esm2015/lib/components/components.module.js +47 -0
- package/esm2015/lib/components/forms/number-input/number-input.component.js +2 -2
- package/esm2015/lib/components/forms/password-input/password-input.component.js +2 -2
- package/esm2015/lib/components/forms/select-input/select-input.component.js +2 -2
- package/esm2015/lib/components/forms/string-input/string-input.component.js +2 -2
- package/esm2015/lib/components/index.js +2 -1
- package/esm2015/lib/components/noop/noop.component.js +2 -2
- package/esm2015/lib/directives/directives.module.js +36 -0
- package/esm2015/lib/directives/index.js +2 -1
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +72 -49
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.js +2 -2
- package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.js +3 -3
- package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +3 -3
- package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +3 -3
- package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +128 -0
- package/esm2015/lib/interaction/components/interaction-outlet/interaction-outlet.component.js +2 -2
- package/esm2015/lib/interaction/index.js +2 -1
- package/esm2015/lib/interaction/interaction.module.js +6 -3
- package/esm2015/lib/interaction/services/dialog-interaction.service.js +10 -7
- package/esm2015/lib/place/components/abstract-place-navigation.component.js +38 -3
- package/esm2015/lib/place/components/busy-overlay/busy-overlay.component.js +2 -2
- package/esm2015/lib/place/components/empty-state/empty-state.component.js +3 -3
- package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js +3 -3
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +73 -33
- package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +3 -3
- package/esm2015/lib/place/index.js +2 -2
- package/esm2015/lib/place/place-component.js +3 -1
- package/esm2015/lib/place/place-definition.js +2 -6
- package/esm2015/lib/place/place-router.js +7 -9
- package/esm2015/lib/place/place.decorator.js +2 -4
- package/esm2015/lib/place/place.module.js +4 -2
- package/esm2015/lib/place/route/guards/enter-place-guard.service.js +283 -0
- package/esm2015/lib/place/route/guards/leave-place.guard.js +73 -53
- package/esm2015/lib/place/visit.js +10 -1
- package/esm2015/public_api.js +5 -5
- package/esm5/coolon-angular-ui-powerups.js +35 -32
- package/esm5/index.js +2 -2
- package/esm5/lib/angular-ui-powerups.module.js +8 -22
- package/esm5/lib/components/components.module.js +51 -0
- package/esm5/lib/components/forms/number-input/number-input.component.js +2 -2
- package/esm5/lib/components/forms/password-input/password-input.component.js +2 -2
- package/esm5/lib/components/forms/select-input/select-input.component.js +2 -2
- package/esm5/lib/components/forms/string-input/string-input.component.js +2 -2
- package/esm5/lib/components/index.js +2 -1
- package/esm5/lib/components/noop/noop.component.js +2 -2
- package/esm5/lib/directives/directives.module.js +40 -0
- package/esm5/lib/directives/index.js +2 -1
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +80 -50
- package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.js +2 -2
- package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js +3 -3
- package/esm5/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +3 -3
- package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +3 -3
- package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +171 -0
- package/esm5/lib/interaction/components/interaction-outlet/interaction-outlet.component.js +2 -2
- package/esm5/lib/interaction/index.js +2 -1
- package/esm5/lib/interaction/interaction.module.js +6 -3
- package/esm5/lib/interaction/services/dialog-interaction.service.js +10 -7
- package/esm5/lib/place/components/abstract-place-navigation.component.js +38 -3
- package/esm5/lib/place/components/busy-overlay/busy-overlay.component.js +2 -2
- package/esm5/lib/place/components/empty-state/empty-state.component.js +3 -3
- package/esm5/lib/place/components/list-place-nav/list-place-nav.component.js +3 -3
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js +85 -39
- package/esm5/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +3 -3
- package/esm5/lib/place/index.js +2 -2
- package/esm5/lib/place/place-component.js +3 -1
- package/esm5/lib/place/place-definition.js +2 -5
- package/esm5/lib/place/place-router.js +11 -10
- package/esm5/lib/place/place.decorator.js +2 -4
- package/esm5/lib/place/place.module.js +4 -2
- package/esm5/lib/place/route/guards/enter-place-guard.service.js +319 -0
- package/esm5/lib/place/route/guards/leave-place.guard.js +75 -11
- package/esm5/lib/place/visit.js +13 -1
- package/esm5/public_api.js +5 -5
- package/fesm2015/coolon-angular-ui-powerups.js +1308 -970
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +1747 -1292
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/components.module.d.ts +2 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/directives/directives.module.d.ts +2 -0
- package/lib/directives/index.d.ts +1 -0
- package/lib/interaction/components/activity-container/activity-container.component.d.ts +9 -6
- package/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.d.ts +21 -0
- package/lib/interaction/index.d.ts +1 -0
- package/lib/place/components/abstract-place-navigation.component.d.ts +7 -1
- package/lib/place/components/place-outlet/place-outlet.component.d.ts +8 -5
- package/lib/place/index.d.ts +1 -1
- package/lib/place/place-component.d.ts +2 -0
- package/lib/place/place-definition.d.ts +1 -2
- package/lib/place/place.decorator.d.ts +0 -1
- package/lib/place/route/guards/{place-route.guard.d.ts → enter-place-guard.service.d.ts} +6 -4
- package/lib/place/visit.d.ts +2 -0
- package/package.json +1 -1
- package/schematics/place-routes/place-builder.js +0 -1
- package/schematics/place-routes/place-builder.js.map +1 -1
- package/schematics/place-routes/place-class-scanner.js +0 -1
- package/schematics/place-routes/place-class-scanner.js.map +1 -1
- package/schematics/place-routes/place-def.d.ts +0 -2
- package/schematics/place-routes/place-def.js +12 -11
- package/schematics/place-routes/place-def.js.map +1 -1
- package/schematics/place-routes/templates/place-routes.ts.template +1 -1
- package/styles/styles.scss +7 -2
- package/esm2015/lib/place/route/guards/place-route.guard.js +0 -243
- package/esm5/lib/place/route/guards/place-route.guard.js +0 -273
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { DOCUMENT,
|
|
2
|
-
import {
|
|
1
|
+
import { DOCUMENT, CommonModule, Location } from '@angular/common';
|
|
2
|
+
import { Directive, ElementRef, Inject, Input, HostListener, NgZone, NgModule, EventEmitter, Output, Component, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, Optional, ɵɵdefineInjectable, ɵɵinject, SkipSelf, HostBinding, INJECTOR } from '@angular/core';
|
|
3
3
|
import { FormsModule } from '@angular/forms';
|
|
4
|
-
import { MatDialog, MatButtonModule, MatDialogModule, MatTabsModule
|
|
5
|
-
import { MatTabsModule
|
|
4
|
+
import { MatInputModule, MatFormFieldModule, MatSelectModule, MatDialog, MatButtonModule, MatDialogModule, MatTabsModule as MatTabsModule$1, MatProgressSpinnerModule } from '@angular/material';
|
|
5
|
+
import { MatTabsModule } from '@angular/material/tabs';
|
|
6
6
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
7
|
+
import { GarbageCollector, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingValueModel, MutableStream, MutableListModel, DelegatingListModel, StoreInValueModel, Binding, MutableValueModel, Trace, Guard as Guard$1, Command, OptionsHelper, ValueHolder } from '@coolon/pectin';
|
|
7
8
|
import { __decorate, __metadata, __awaiter } from 'tslib';
|
|
8
|
-
import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingValueModel, MutableStream, MutableListModel, DelegatingListModel, StoreInValueModel, Binding, MutableValueModel, Trace, Guard as Guard$1, OptionsHelper, ValueHolder } from '@coolon/pectin';
|
|
9
9
|
import { PortalModule } from '@angular/cdk/portal';
|
|
10
|
-
import { Router, RouterModule, NavigationStart, NavigationEnd, NavigationError,
|
|
10
|
+
import { Router, RouterModule, UrlSegment, NavigationStart, NavigationEnd, NavigationError, ActivatedRouteSnapshot, RouterStateSnapshot, UrlSerializer } from '@angular/router';
|
|
11
11
|
import ___default, { last, isNil, isEqual } from 'lodash';
|
|
12
12
|
import { assert as assert$1, Opts, Klass } from '@coolon/typescript-utilities';
|
|
13
13
|
import { MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS, MatDialog as MatDialog$1 } from '@angular/material/dialog';
|
|
14
|
-
import { v1 } from 'uuid';
|
|
15
14
|
import { MatIconModule } from '@angular/material/icon';
|
|
16
15
|
import { MatListModule } from '@angular/material/list';
|
|
17
16
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
@@ -25,98 +24,179 @@ import ResizeObserver from 'resize-observer-polyfill';
|
|
|
25
24
|
* @fileoverview added by tsickle
|
|
26
25
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
27
26
|
*/
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* @template P
|
|
29
|
+
*/
|
|
30
|
+
class CommandDirective extends GarbageCollector {
|
|
31
|
+
/**
|
|
32
|
+
* @param {?} elementRef
|
|
33
|
+
*/
|
|
34
|
+
constructor(elementRef) {
|
|
35
|
+
super();
|
|
36
|
+
this.elementRef = elementRef;
|
|
37
|
+
this._commandParameterProvided = false;
|
|
38
|
+
}
|
|
29
39
|
/**
|
|
40
|
+
* @param {?} value
|
|
30
41
|
* @return {?}
|
|
31
42
|
*/
|
|
32
|
-
|
|
33
|
-
this.
|
|
43
|
+
set commandParameter(value) {
|
|
44
|
+
this._commandParameterProvided = true;
|
|
45
|
+
this._commandParameter = value;
|
|
34
46
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*/
|
|
41
|
-
/**
|
|
42
|
-
* @abstract
|
|
43
|
-
* @template T
|
|
44
|
-
*/
|
|
45
|
-
class AbstractInputComponent extends DisposableComponent {
|
|
46
|
-
constructor() {
|
|
47
|
-
super();
|
|
48
|
-
this.valueModel = new DelegatingFormValueModel();
|
|
49
|
-
// TODO: fix this.
|
|
50
|
-
// tslint:disable-next-line:no-output-native
|
|
51
|
-
this.focus = new EventEmitter();
|
|
52
|
-
// tslint:disable-next-line:no-output-native
|
|
53
|
-
this.blur = new EventEmitter();
|
|
54
|
-
// tslint:disable-next-line:no-output-native
|
|
55
|
-
this.enterKey = new EventEmitter();
|
|
56
|
-
// tslint:disable-next-line:no-output-native
|
|
57
|
-
this.escapeKey = new EventEmitter();
|
|
58
|
-
/** @type {?} */
|
|
59
|
-
const self = this;
|
|
60
|
-
this.errorStateMatcher = {
|
|
61
|
-
/**
|
|
62
|
-
* @param {?} control
|
|
63
|
-
* @param {?} form
|
|
64
|
-
* @return {?}
|
|
65
|
-
*/
|
|
66
|
-
isErrorState(control, form) {
|
|
67
|
-
return self.hasErrors();
|
|
68
|
-
}
|
|
69
|
-
};
|
|
47
|
+
/**
|
|
48
|
+
* @return {?}
|
|
49
|
+
*/
|
|
50
|
+
get commandParameter() {
|
|
51
|
+
return this._commandParameter;
|
|
70
52
|
}
|
|
71
53
|
/**
|
|
72
|
-
* @param {?} model
|
|
73
54
|
* @return {?}
|
|
74
55
|
*/
|
|
75
|
-
|
|
76
|
-
this.
|
|
56
|
+
ngOnInit() {
|
|
57
|
+
assert.notNil(this.pectinCommand);
|
|
58
|
+
if (this.pectinCommand instanceof UnaryCommand) {
|
|
59
|
+
if (!this._commandParameterProvided) {
|
|
60
|
+
lang.illegalState('UnaryCommands required the command parameter to be specified.');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
if (this._commandParameterProvided) {
|
|
65
|
+
lang.illegalState('command parameters are only supported by UnaryCommands');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
77
68
|
}
|
|
78
69
|
/**
|
|
79
70
|
* @return {?}
|
|
80
71
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
72
|
+
ngAfterViewInit() {
|
|
73
|
+
// for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now
|
|
74
|
+
// we need to do this.
|
|
75
|
+
const { chain } = Dsl.disposeWith(this);
|
|
76
|
+
chain(this.pectinCommand.enabled).subscribe((/**
|
|
77
|
+
* @param {?} enabled
|
|
78
|
+
* @return {?}
|
|
79
|
+
*/
|
|
80
|
+
enabled => {
|
|
81
|
+
if (enabled) {
|
|
82
|
+
this.elementRef.nativeElement.removeAttribute('disabled');
|
|
83
|
+
if (this.elementRef.nativeElement.tagName === 'A') {
|
|
84
|
+
this.elementRef.nativeElement.setAttribute('href', 'javascript:void');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
this.elementRef.nativeElement.setAttribute('disabled', 'disabled');
|
|
89
|
+
if (this.elementRef.nativeElement.tagName === 'A') {
|
|
90
|
+
this.elementRef.nativeElement.removeAttribute('href');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}));
|
|
83
94
|
}
|
|
84
95
|
/**
|
|
85
96
|
* @return {?}
|
|
86
97
|
*/
|
|
87
|
-
|
|
88
|
-
this.
|
|
89
|
-
this.focus.emit();
|
|
98
|
+
ngOnDestroy() {
|
|
99
|
+
this.dispose();
|
|
90
100
|
}
|
|
91
101
|
/**
|
|
102
|
+
* @param {?} $event
|
|
92
103
|
* @return {?}
|
|
93
104
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
105
|
+
notifyClick($event) {
|
|
106
|
+
$event.preventDefault();
|
|
107
|
+
$event.stopPropagation();
|
|
108
|
+
if (this.pectinCommand.enabled.value) {
|
|
109
|
+
if (this.pectinCommand instanceof UnaryCommand) {
|
|
110
|
+
this.pectinCommand.withContext({ event: $event }).execute(this.commandParameter);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
this.pectinCommand.withContext({ event: $event }).execute();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
console.warn('disabled command clicked, ignoring.');
|
|
118
|
+
}
|
|
97
119
|
}
|
|
120
|
+
}
|
|
121
|
+
CommandDirective.decorators = [
|
|
122
|
+
{ type: Directive, args: [{
|
|
123
|
+
// tslint:disable-next-line:directive-selector
|
|
124
|
+
selector: '[pectinCommand]'
|
|
125
|
+
},] }
|
|
126
|
+
];
|
|
127
|
+
/** @nocollapse */
|
|
128
|
+
CommandDirective.ctorParameters = () => [
|
|
129
|
+
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
|
|
130
|
+
];
|
|
131
|
+
CommandDirective.propDecorators = {
|
|
132
|
+
pectinCommand: [{ type: Input }],
|
|
133
|
+
commandParameter: [{ type: Input }],
|
|
134
|
+
notifyClick: [{ type: HostListener, args: ['click', ['$event'],] }]
|
|
135
|
+
};
|
|
136
|
+
if (false) {
|
|
137
|
+
/** @type {?} */
|
|
138
|
+
CommandDirective.prototype.pectinCommand;
|
|
139
|
+
/**
|
|
140
|
+
* @type {?}
|
|
141
|
+
* @private
|
|
142
|
+
*/
|
|
143
|
+
CommandDirective.prototype._commandParameter;
|
|
144
|
+
/**
|
|
145
|
+
* @type {?}
|
|
146
|
+
* @private
|
|
147
|
+
*/
|
|
148
|
+
CommandDirective.prototype._commandParameterProvided;
|
|
149
|
+
/**
|
|
150
|
+
* @type {?}
|
|
151
|
+
* @private
|
|
152
|
+
*/
|
|
153
|
+
CommandDirective.prototype.elementRef;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @fileoverview added by tsickle
|
|
158
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
159
|
+
*/
|
|
160
|
+
class DisposableComponent extends GarbageCollector {
|
|
98
161
|
/**
|
|
99
162
|
* @return {?}
|
|
100
163
|
*/
|
|
101
|
-
|
|
102
|
-
this.
|
|
103
|
-
|
|
164
|
+
ngOnDestroy() {
|
|
165
|
+
this.dispose();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @fileoverview added by tsickle
|
|
171
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
172
|
+
*/
|
|
173
|
+
class FocusBindingDirective extends DisposableComponent {
|
|
174
|
+
/**
|
|
175
|
+
* @param {?} el
|
|
176
|
+
* @param {?} ngZone
|
|
177
|
+
* @param {?} document
|
|
178
|
+
*/
|
|
179
|
+
constructor(el, ngZone, document) {
|
|
180
|
+
super();
|
|
181
|
+
this.el = el;
|
|
182
|
+
this.ngZone = ngZone;
|
|
183
|
+
// @see https://stackoverflow.com/questions/49513359/could-not-resolve-type-document-in-angular5/53715642#53715642
|
|
184
|
+
this.document = (/** @type {?} */ (document));
|
|
104
185
|
}
|
|
105
186
|
/**
|
|
106
187
|
* @return {?}
|
|
107
188
|
*/
|
|
108
|
-
|
|
109
|
-
this.
|
|
110
|
-
|
|
189
|
+
onFocusIn() {
|
|
190
|
+
if (this.hasBinding()) {
|
|
191
|
+
this.pectinFocusBinding.focusContext.notifyFocusIn();
|
|
192
|
+
}
|
|
111
193
|
}
|
|
112
194
|
/**
|
|
113
|
-
* @protected
|
|
114
|
-
* @param {?} command
|
|
115
195
|
* @return {?}
|
|
116
196
|
*/
|
|
117
|
-
|
|
118
|
-
if (
|
|
119
|
-
|
|
197
|
+
onFocusOut() {
|
|
198
|
+
if (this.hasBinding()) {
|
|
199
|
+
this.pectinFocusBinding.focusContext.notifyFocusOut();
|
|
120
200
|
}
|
|
121
201
|
}
|
|
122
202
|
/**
|
|
@@ -127,49 +207,304 @@ class AbstractInputComponent extends DisposableComponent {
|
|
|
127
207
|
/**
|
|
128
208
|
* @return {?}
|
|
129
209
|
*/
|
|
130
|
-
|
|
131
|
-
|
|
210
|
+
ngAfterViewInit() {
|
|
211
|
+
// TODO: Make this also track the current enabled/disabled state.
|
|
212
|
+
if (this.hasBinding()) {
|
|
213
|
+
const { chain } = Dsl.disposeWith(this);
|
|
214
|
+
chain(this.pectinFocusBinding.focusContext.focused).subscribe((/**
|
|
215
|
+
* @param {?} focused
|
|
216
|
+
* @return {?}
|
|
217
|
+
*/
|
|
218
|
+
(focused) => {
|
|
219
|
+
if (focused && !this.alreadyHasFocus()) {
|
|
220
|
+
this.tryAndFocus();
|
|
221
|
+
}
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
Logger.get(this).warn('pectinFocusBinding was nil');
|
|
226
|
+
}
|
|
132
227
|
}
|
|
133
228
|
/**
|
|
229
|
+
* @private
|
|
134
230
|
* @return {?}
|
|
135
231
|
*/
|
|
136
|
-
|
|
137
|
-
return this.
|
|
232
|
+
hasBinding() {
|
|
233
|
+
return !!this.pectinFocusBinding && !!this.pectinFocusBinding.focusContext;
|
|
138
234
|
}
|
|
235
|
+
// Hook method for debugging via tracing.
|
|
139
236
|
/**
|
|
140
237
|
* @return {?}
|
|
141
238
|
*/
|
|
142
|
-
|
|
143
|
-
return
|
|
239
|
+
alreadyHasFocus() {
|
|
240
|
+
return this.isFocused(this.focusTarget);
|
|
144
241
|
}
|
|
242
|
+
// Hook method for debugging via tracing.
|
|
145
243
|
/**
|
|
244
|
+
* @param {?} element
|
|
146
245
|
* @return {?}
|
|
147
246
|
*/
|
|
148
|
-
|
|
149
|
-
return this.
|
|
247
|
+
isFocused(element) {
|
|
248
|
+
return this.document.activeElement === element;
|
|
150
249
|
}
|
|
151
250
|
/**
|
|
251
|
+
* @param {?=} retries
|
|
152
252
|
* @return {?}
|
|
153
253
|
*/
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
254
|
+
tryAndFocus(retries = 5) {
|
|
255
|
+
if (this.modelShouldStillHaveFocus() && this.canFocus()) {
|
|
256
|
+
if (!this.alreadyHasFocus()) {
|
|
257
|
+
this.focusTarget.focus();
|
|
258
|
+
}
|
|
259
|
+
// if we didn't get the focus we try again later.
|
|
260
|
+
if (!this.alreadyHasFocus()) {
|
|
261
|
+
Logger.get(this).log(`focus failed, trying ${retries} more times`);
|
|
262
|
+
if (retries > 0) {
|
|
263
|
+
// try again on the next paint
|
|
264
|
+
// TODO: is there an angular way of doing this without calling a window function.
|
|
265
|
+
requestAnimationFrame((/**
|
|
266
|
+
* @return {?}
|
|
267
|
+
*/
|
|
268
|
+
() => {
|
|
269
|
+
this.tryAndFocus(retries - 1);
|
|
270
|
+
}));
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
Logger.get(this).warn(`Tried to focus but gave up as the component wasn't enabled or visible.`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* @return {?}
|
|
280
|
+
*/
|
|
281
|
+
get focusTarget() {
|
|
282
|
+
return this.focusBindingTarget || this.el.nativeElement;
|
|
283
|
+
}
|
|
284
|
+
// Hook method for debugging via tracing.
|
|
285
|
+
/**
|
|
286
|
+
* @return {?}
|
|
287
|
+
*/
|
|
288
|
+
modelShouldStillHaveFocus() {
|
|
289
|
+
return this.hasBinding() && this.pectinFocusBinding.focusContext.focused.value;
|
|
290
|
+
}
|
|
291
|
+
// Hook method for debugging via tracing.
|
|
292
|
+
/**
|
|
293
|
+
* @return {?}
|
|
294
|
+
*/
|
|
295
|
+
canFocus() {
|
|
296
|
+
/** @type {?} */
|
|
297
|
+
const dimension = this.focusTarget.getBoundingClientRect();
|
|
298
|
+
/** @type {?} */
|
|
299
|
+
const hasSize = dimension.height >= 0 && dimension.height >= 0;
|
|
300
|
+
// tslint:disable-next-line:no-string-literal
|
|
301
|
+
return hasSize && !this.focusTarget['disabled'];
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
FocusBindingDirective.decorators = [
|
|
305
|
+
{ type: Directive, args: [{
|
|
306
|
+
// tslint:disable-next-line:directive-selector
|
|
307
|
+
selector: '[pectinFocusBinding]'
|
|
308
|
+
},] }
|
|
309
|
+
];
|
|
310
|
+
/** @nocollapse */
|
|
311
|
+
FocusBindingDirective.ctorParameters = () => [
|
|
312
|
+
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
|
|
313
|
+
{ type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
|
|
314
|
+
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
|
|
315
|
+
];
|
|
316
|
+
FocusBindingDirective.propDecorators = {
|
|
317
|
+
pectinFocusBinding: [{ type: Input }],
|
|
318
|
+
focusBindingTarget: [{ type: Input }],
|
|
319
|
+
onFocusIn: [{ type: HostListener, args: ['focusin',] }],
|
|
320
|
+
onFocusOut: [{ type: HostListener, args: ['focusout',] }]
|
|
321
|
+
};
|
|
322
|
+
if (false) {
|
|
323
|
+
/**
|
|
324
|
+
* @type {?}
|
|
325
|
+
* @private
|
|
326
|
+
*/
|
|
327
|
+
FocusBindingDirective.prototype.document;
|
|
328
|
+
/** @type {?} */
|
|
329
|
+
FocusBindingDirective.prototype.pectinFocusBinding;
|
|
330
|
+
/** @type {?} */
|
|
331
|
+
FocusBindingDirective.prototype.focusBindingTarget;
|
|
332
|
+
/**
|
|
333
|
+
* @type {?}
|
|
334
|
+
* @private
|
|
335
|
+
*/
|
|
336
|
+
FocusBindingDirective.prototype.el;
|
|
337
|
+
/**
|
|
338
|
+
* @type {?}
|
|
339
|
+
* @private
|
|
340
|
+
*/
|
|
341
|
+
FocusBindingDirective.prototype.ngZone;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* @fileoverview added by tsickle
|
|
346
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
347
|
+
*/
|
|
348
|
+
class DirectivesModule {
|
|
349
|
+
}
|
|
350
|
+
DirectivesModule.decorators = [
|
|
351
|
+
{ type: NgModule, args: [{
|
|
352
|
+
declarations: [
|
|
353
|
+
CommandDirective,
|
|
354
|
+
FocusBindingDirective
|
|
355
|
+
],
|
|
356
|
+
imports: [
|
|
357
|
+
CommonModule,
|
|
358
|
+
BrowserAnimationsModule,
|
|
359
|
+
FormsModule,
|
|
360
|
+
MatInputModule,
|
|
361
|
+
MatFormFieldModule,
|
|
362
|
+
MatSelectModule,
|
|
363
|
+
MatTabsModule
|
|
364
|
+
],
|
|
365
|
+
exports: [
|
|
366
|
+
CommandDirective,
|
|
367
|
+
FocusBindingDirective
|
|
368
|
+
]
|
|
369
|
+
},] }
|
|
370
|
+
];
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* @fileoverview added by tsickle
|
|
374
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
375
|
+
*/
|
|
376
|
+
/**
|
|
377
|
+
* @abstract
|
|
378
|
+
* @template T
|
|
379
|
+
*/
|
|
380
|
+
class AbstractInputComponent extends DisposableComponent {
|
|
381
|
+
constructor() {
|
|
382
|
+
super();
|
|
383
|
+
this.valueModel = new DelegatingFormValueModel();
|
|
384
|
+
// TODO: fix this.
|
|
385
|
+
// tslint:disable-next-line:no-output-native
|
|
386
|
+
this.focus = new EventEmitter();
|
|
387
|
+
// tslint:disable-next-line:no-output-native
|
|
388
|
+
this.blur = new EventEmitter();
|
|
389
|
+
// tslint:disable-next-line:no-output-native
|
|
390
|
+
this.enterKey = new EventEmitter();
|
|
391
|
+
// tslint:disable-next-line:no-output-native
|
|
392
|
+
this.escapeKey = new EventEmitter();
|
|
393
|
+
/** @type {?} */
|
|
394
|
+
const self = this;
|
|
395
|
+
this.errorStateMatcher = {
|
|
396
|
+
/**
|
|
397
|
+
* @param {?} control
|
|
398
|
+
* @param {?} form
|
|
399
|
+
* @return {?}
|
|
400
|
+
*/
|
|
401
|
+
isErrorState(control, form) {
|
|
402
|
+
return self.hasErrors();
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* @param {?} model
|
|
408
|
+
* @return {?}
|
|
409
|
+
*/
|
|
410
|
+
set userValueModel(model) {
|
|
411
|
+
this.valueModel.setDelegate(model);
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* @return {?}
|
|
415
|
+
*/
|
|
416
|
+
notifyClick() {
|
|
417
|
+
this.safelyInvoke(this.clickCommand);
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* @return {?}
|
|
421
|
+
*/
|
|
422
|
+
notifyFocusIn() {
|
|
423
|
+
this.safelyInvoke(this.focusCommand);
|
|
424
|
+
this.focus.emit();
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* @return {?}
|
|
428
|
+
*/
|
|
429
|
+
notifyFocusOut() {
|
|
430
|
+
this.safelyInvoke(this.blurCommand);
|
|
431
|
+
this.blur.emit();
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* @return {?}
|
|
435
|
+
*/
|
|
436
|
+
notifyEnterKey() {
|
|
437
|
+
this.safelyInvoke(this.enterCommand);
|
|
438
|
+
this.enterKey.emit();
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* @return {?}
|
|
442
|
+
*/
|
|
443
|
+
notifyEscapeKey() {
|
|
444
|
+
this.safelyInvoke(this.escapeCommand);
|
|
445
|
+
this.escapeKey.emit();
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* @protected
|
|
449
|
+
* @param {?} command
|
|
450
|
+
* @return {?}
|
|
451
|
+
*/
|
|
452
|
+
safelyInvoke(command) {
|
|
453
|
+
if (command && command.enabled.value) {
|
|
454
|
+
command.execute();
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* @return {?}
|
|
459
|
+
*/
|
|
460
|
+
ngOnInit() {
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* @return {?}
|
|
464
|
+
*/
|
|
465
|
+
isEnabled() {
|
|
466
|
+
return this.enabled.value;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* @return {?}
|
|
470
|
+
*/
|
|
471
|
+
get enabled() {
|
|
472
|
+
return this.valueModel.enabled;
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* @return {?}
|
|
476
|
+
*/
|
|
477
|
+
hasErrors() {
|
|
478
|
+
return !this.errorList.query().isEmpty();
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* @return {?}
|
|
482
|
+
*/
|
|
483
|
+
get errorList() {
|
|
484
|
+
return this.valueModel.errorList;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* @return {?}
|
|
488
|
+
*/
|
|
489
|
+
get firstError() {
|
|
490
|
+
return this.hasErrors() ? this.errorList.value[0] : null;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
AbstractInputComponent.propDecorators = {
|
|
494
|
+
userValueModel: [{ type: Input, args: ['valueModel',] }],
|
|
495
|
+
label: [{ type: Input }],
|
|
496
|
+
floatLabel: [{ type: Input }],
|
|
497
|
+
hint: [{ type: Input }],
|
|
498
|
+
placeholder: [{ type: Input }],
|
|
499
|
+
focusCommand: [{ type: Input, args: ['command.focus',] }],
|
|
500
|
+
blurCommand: [{ type: Input, args: ['command.blur',] }],
|
|
501
|
+
enterCommand: [{ type: Input, args: ['command.enter',] }],
|
|
502
|
+
escapeCommand: [{ type: Input, args: ['command.escape',] }],
|
|
503
|
+
clickCommand: [{ type: Input, args: ['command.click',] }],
|
|
504
|
+
focus: [{ type: Output }],
|
|
505
|
+
blur: [{ type: Output }],
|
|
506
|
+
enterKey: [{ type: Output }],
|
|
507
|
+
escapeKey: [{ type: Output }],
|
|
173
508
|
notifyClick: [{ type: HostListener, args: ['click',] }],
|
|
174
509
|
notifyFocusIn: [{ type: HostListener, args: ['focusin',] }],
|
|
175
510
|
notifyFocusOut: [{ type: HostListener, args: ['focusout',] }]
|
|
@@ -228,7 +563,7 @@ class NumberInputComponent extends AbstractInputComponent {
|
|
|
228
563
|
}
|
|
229
564
|
NumberInputComponent.decorators = [
|
|
230
565
|
{ type: Component, args: [{
|
|
231
|
-
selector: '
|
|
566
|
+
selector: 'aup-number-input',
|
|
232
567
|
template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input type=\"number\"\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",
|
|
233
568
|
styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
|
|
234
569
|
}] }
|
|
@@ -252,7 +587,7 @@ class PasswordInputComponent extends AbstractInputComponent {
|
|
|
252
587
|
}
|
|
253
588
|
PasswordInputComponent.decorators = [
|
|
254
589
|
{ type: Component, args: [{
|
|
255
|
-
selector: '
|
|
590
|
+
selector: 'aup-password-input',
|
|
256
591
|
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
592
|
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
593
|
}] }
|
|
@@ -284,7 +619,7 @@ class SelectInputComponent extends AbstractInputComponent {
|
|
|
284
619
|
}
|
|
285
620
|
SelectInputComponent.decorators = [
|
|
286
621
|
{ type: Component, args: [{
|
|
287
|
-
selector: '
|
|
622
|
+
selector: 'aup-select-input',
|
|
288
623
|
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
624
|
styles: [":host{display:inline-block}mat-form-field{width:100%}"]
|
|
290
625
|
}] }
|
|
@@ -332,7 +667,7 @@ class StringInputComponent extends AbstractInputComponent {
|
|
|
332
667
|
}
|
|
333
668
|
StringInputComponent.decorators = [
|
|
334
669
|
{ type: Component, args: [{
|
|
335
|
-
selector: '
|
|
670
|
+
selector: 'aup-string-input',
|
|
336
671
|
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
672
|
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
673
|
}] }
|
|
@@ -350,7 +685,7 @@ class NoopComponent {
|
|
|
350
685
|
}
|
|
351
686
|
NoopComponent.decorators = [
|
|
352
687
|
{ type: Component, args: [{
|
|
353
|
-
selector: '
|
|
688
|
+
selector: 'aup-noop',
|
|
354
689
|
template: "",
|
|
355
690
|
styles: [":host{display:block}"]
|
|
356
691
|
}] }
|
|
@@ -362,309 +697,36 @@ NoopComponent.ctorParameters = () => [];
|
|
|
362
697
|
* @fileoverview added by tsickle
|
|
363
698
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
364
699
|
*/
|
|
365
|
-
|
|
366
|
-
* @template P
|
|
367
|
-
*/
|
|
368
|
-
class CommandDirective extends GarbageCollector {
|
|
369
|
-
/**
|
|
370
|
-
* @param {?} elementRef
|
|
371
|
-
*/
|
|
372
|
-
constructor(elementRef) {
|
|
373
|
-
super();
|
|
374
|
-
this.elementRef = elementRef;
|
|
375
|
-
this._commandParameterProvided = false;
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* @param {?} value
|
|
379
|
-
* @return {?}
|
|
380
|
-
*/
|
|
381
|
-
set commandParameter(value) {
|
|
382
|
-
this._commandParameterProvided = true;
|
|
383
|
-
this._commandParameter = value;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* @return {?}
|
|
387
|
-
*/
|
|
388
|
-
get commandParameter() {
|
|
389
|
-
return this._commandParameter;
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* @return {?}
|
|
393
|
-
*/
|
|
394
|
-
ngOnInit() {
|
|
395
|
-
assert.notNil(this.pectinCommand);
|
|
396
|
-
if (this.pectinCommand instanceof UnaryCommand) {
|
|
397
|
-
if (!this._commandParameterProvided) {
|
|
398
|
-
lang.illegalState('UnaryCommands required the command parameter to be specified.');
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
else {
|
|
402
|
-
if (this._commandParameterProvided) {
|
|
403
|
-
lang.illegalState('command parameters are only supported by UnaryCommands');
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* @return {?}
|
|
409
|
-
*/
|
|
410
|
-
ngAfterViewInit() {
|
|
411
|
-
// for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now
|
|
412
|
-
// we need to do this.
|
|
413
|
-
const { chain } = Dsl.disposeWith(this);
|
|
414
|
-
chain(this.pectinCommand.enabled).subscribe((/**
|
|
415
|
-
* @param {?} enabled
|
|
416
|
-
* @return {?}
|
|
417
|
-
*/
|
|
418
|
-
enabled => {
|
|
419
|
-
if (enabled) {
|
|
420
|
-
this.elementRef.nativeElement.removeAttribute('disabled');
|
|
421
|
-
if (this.elementRef.nativeElement.tagName === 'A') {
|
|
422
|
-
this.elementRef.nativeElement.setAttribute('href', 'javascript:void');
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
else {
|
|
426
|
-
this.elementRef.nativeElement.setAttribute('disabled', 'disabled');
|
|
427
|
-
if (this.elementRef.nativeElement.tagName === 'A') {
|
|
428
|
-
this.elementRef.nativeElement.removeAttribute('href');
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}));
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* @return {?}
|
|
435
|
-
*/
|
|
436
|
-
ngOnDestroy() {
|
|
437
|
-
this.dispose();
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* @param {?} $event
|
|
441
|
-
* @return {?}
|
|
442
|
-
*/
|
|
443
|
-
notifyClick($event) {
|
|
444
|
-
$event.preventDefault();
|
|
445
|
-
$event.stopPropagation();
|
|
446
|
-
if (this.pectinCommand.enabled.value) {
|
|
447
|
-
if (this.pectinCommand instanceof UnaryCommand) {
|
|
448
|
-
this.pectinCommand.withContext({ event: $event }).execute(this.commandParameter);
|
|
449
|
-
}
|
|
450
|
-
else {
|
|
451
|
-
this.pectinCommand.withContext({ event: $event }).execute();
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
else {
|
|
455
|
-
console.warn('disabled command clicked, ignoring.');
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
CommandDirective.decorators = [
|
|
460
|
-
{ type: Directive, args: [{
|
|
461
|
-
// tslint:disable-next-line:directive-selector
|
|
462
|
-
selector: '[pectinCommand]'
|
|
463
|
-
},] }
|
|
464
|
-
];
|
|
465
|
-
/** @nocollapse */
|
|
466
|
-
CommandDirective.ctorParameters = () => [
|
|
467
|
-
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
|
|
468
|
-
];
|
|
469
|
-
CommandDirective.propDecorators = {
|
|
470
|
-
pectinCommand: [{ type: Input }],
|
|
471
|
-
commandParameter: [{ type: Input }],
|
|
472
|
-
notifyClick: [{ type: HostListener, args: ['click', ['$event'],] }]
|
|
473
|
-
};
|
|
474
|
-
if (false) {
|
|
475
|
-
/** @type {?} */
|
|
476
|
-
CommandDirective.prototype.pectinCommand;
|
|
477
|
-
/**
|
|
478
|
-
* @type {?}
|
|
479
|
-
* @private
|
|
480
|
-
*/
|
|
481
|
-
CommandDirective.prototype._commandParameter;
|
|
482
|
-
/**
|
|
483
|
-
* @type {?}
|
|
484
|
-
* @private
|
|
485
|
-
*/
|
|
486
|
-
CommandDirective.prototype._commandParameterProvided;
|
|
487
|
-
/**
|
|
488
|
-
* @type {?}
|
|
489
|
-
* @private
|
|
490
|
-
*/
|
|
491
|
-
CommandDirective.prototype.elementRef;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
/**
|
|
495
|
-
* @fileoverview added by tsickle
|
|
496
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
497
|
-
*/
|
|
498
|
-
class FocusBindingDirective extends DisposableComponent {
|
|
499
|
-
/**
|
|
500
|
-
* @param {?} el
|
|
501
|
-
* @param {?} ngZone
|
|
502
|
-
* @param {?} document
|
|
503
|
-
*/
|
|
504
|
-
constructor(el, ngZone, document) {
|
|
505
|
-
super();
|
|
506
|
-
this.el = el;
|
|
507
|
-
this.ngZone = ngZone;
|
|
508
|
-
// @see https://stackoverflow.com/questions/49513359/could-not-resolve-type-document-in-angular5/53715642#53715642
|
|
509
|
-
this.document = (/** @type {?} */ (document));
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* @return {?}
|
|
513
|
-
*/
|
|
514
|
-
onFocusIn() {
|
|
515
|
-
if (this.hasBinding()) {
|
|
516
|
-
this.pectinFocusBinding.focusContext.notifyFocusIn();
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* @return {?}
|
|
521
|
-
*/
|
|
522
|
-
onFocusOut() {
|
|
523
|
-
if (this.hasBinding()) {
|
|
524
|
-
this.pectinFocusBinding.focusContext.notifyFocusOut();
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
/**
|
|
528
|
-
* @return {?}
|
|
529
|
-
*/
|
|
530
|
-
ngOnInit() {
|
|
531
|
-
}
|
|
532
|
-
/**
|
|
533
|
-
* @return {?}
|
|
534
|
-
*/
|
|
535
|
-
ngAfterViewInit() {
|
|
536
|
-
// TODO: Make this also track the current enabled/disabled state.
|
|
537
|
-
if (this.hasBinding()) {
|
|
538
|
-
const { chain } = Dsl.disposeWith(this);
|
|
539
|
-
chain(this.pectinFocusBinding.focusContext.focused).subscribe((/**
|
|
540
|
-
* @param {?} focused
|
|
541
|
-
* @return {?}
|
|
542
|
-
*/
|
|
543
|
-
(focused) => {
|
|
544
|
-
if (focused && !this.alreadyHasFocus()) {
|
|
545
|
-
this.tryAndFocus();
|
|
546
|
-
}
|
|
547
|
-
}));
|
|
548
|
-
}
|
|
549
|
-
else {
|
|
550
|
-
Logger.get(this).warn('pectinFocusBinding was nil');
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* @private
|
|
555
|
-
* @return {?}
|
|
556
|
-
*/
|
|
557
|
-
hasBinding() {
|
|
558
|
-
return !!this.pectinFocusBinding && !!this.pectinFocusBinding.focusContext;
|
|
559
|
-
}
|
|
560
|
-
// Hook method for debugging via tracing.
|
|
561
|
-
/**
|
|
562
|
-
* @return {?}
|
|
563
|
-
*/
|
|
564
|
-
alreadyHasFocus() {
|
|
565
|
-
return this.isFocused(this.focusTarget);
|
|
566
|
-
}
|
|
567
|
-
// Hook method for debugging via tracing.
|
|
568
|
-
/**
|
|
569
|
-
* @param {?} element
|
|
570
|
-
* @return {?}
|
|
571
|
-
*/
|
|
572
|
-
isFocused(element) {
|
|
573
|
-
return this.document.activeElement === element;
|
|
574
|
-
}
|
|
575
|
-
/**
|
|
576
|
-
* @param {?=} retries
|
|
577
|
-
* @return {?}
|
|
578
|
-
*/
|
|
579
|
-
tryAndFocus(retries = 5) {
|
|
580
|
-
if (this.modelShouldStillHaveFocus() && this.canFocus()) {
|
|
581
|
-
if (!this.alreadyHasFocus()) {
|
|
582
|
-
this.focusTarget.focus();
|
|
583
|
-
}
|
|
584
|
-
// if we didn't get the focus we try again later.
|
|
585
|
-
if (!this.alreadyHasFocus()) {
|
|
586
|
-
Logger.get(this).log(`focus failed, trying ${retries} more times`);
|
|
587
|
-
if (retries > 0) {
|
|
588
|
-
// try again on the next paint
|
|
589
|
-
// TODO: is there an angular way of doing this without calling a window function.
|
|
590
|
-
requestAnimationFrame((/**
|
|
591
|
-
* @return {?}
|
|
592
|
-
*/
|
|
593
|
-
() => {
|
|
594
|
-
this.tryAndFocus(retries - 1);
|
|
595
|
-
}));
|
|
596
|
-
}
|
|
597
|
-
else {
|
|
598
|
-
Logger.get(this).warn(`Tried to focus but gave up as the component wasn't enabled or visible.`);
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
/**
|
|
604
|
-
* @return {?}
|
|
605
|
-
*/
|
|
606
|
-
get focusTarget() {
|
|
607
|
-
return this.focusBindingTarget || this.el.nativeElement;
|
|
608
|
-
}
|
|
609
|
-
// Hook method for debugging via tracing.
|
|
610
|
-
/**
|
|
611
|
-
* @return {?}
|
|
612
|
-
*/
|
|
613
|
-
modelShouldStillHaveFocus() {
|
|
614
|
-
return this.hasBinding() && this.pectinFocusBinding.focusContext.focused.value;
|
|
615
|
-
}
|
|
616
|
-
// Hook method for debugging via tracing.
|
|
617
|
-
/**
|
|
618
|
-
* @return {?}
|
|
619
|
-
*/
|
|
620
|
-
canFocus() {
|
|
621
|
-
/** @type {?} */
|
|
622
|
-
const dimension = this.focusTarget.getBoundingClientRect();
|
|
623
|
-
/** @type {?} */
|
|
624
|
-
const hasSize = dimension.height >= 0 && dimension.height >= 0;
|
|
625
|
-
// tslint:disable-next-line:no-string-literal
|
|
626
|
-
return hasSize && !this.focusTarget['disabled'];
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
FocusBindingDirective.decorators = [
|
|
630
|
-
{ type: Directive, args: [{
|
|
631
|
-
// tslint:disable-next-line:directive-selector
|
|
632
|
-
selector: '[pectinFocusBinding]'
|
|
633
|
-
},] }
|
|
634
|
-
];
|
|
635
|
-
/** @nocollapse */
|
|
636
|
-
FocusBindingDirective.ctorParameters = () => [
|
|
637
|
-
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
|
|
638
|
-
{ type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
|
|
639
|
-
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
|
|
640
|
-
];
|
|
641
|
-
FocusBindingDirective.propDecorators = {
|
|
642
|
-
pectinFocusBinding: [{ type: Input }],
|
|
643
|
-
focusBindingTarget: [{ type: Input }],
|
|
644
|
-
onFocusIn: [{ type: HostListener, args: ['focusin',] }],
|
|
645
|
-
onFocusOut: [{ type: HostListener, args: ['focusout',] }]
|
|
646
|
-
};
|
|
647
|
-
if (false) {
|
|
648
|
-
/**
|
|
649
|
-
* @type {?}
|
|
650
|
-
* @private
|
|
651
|
-
*/
|
|
652
|
-
FocusBindingDirective.prototype.document;
|
|
653
|
-
/** @type {?} */
|
|
654
|
-
FocusBindingDirective.prototype.pectinFocusBinding;
|
|
655
|
-
/** @type {?} */
|
|
656
|
-
FocusBindingDirective.prototype.focusBindingTarget;
|
|
657
|
-
/**
|
|
658
|
-
* @type {?}
|
|
659
|
-
* @private
|
|
660
|
-
*/
|
|
661
|
-
FocusBindingDirective.prototype.el;
|
|
662
|
-
/**
|
|
663
|
-
* @type {?}
|
|
664
|
-
* @private
|
|
665
|
-
*/
|
|
666
|
-
FocusBindingDirective.prototype.ngZone;
|
|
700
|
+
class ComponentsModule {
|
|
667
701
|
}
|
|
702
|
+
ComponentsModule.decorators = [
|
|
703
|
+
{ type: NgModule, args: [{
|
|
704
|
+
declarations: [
|
|
705
|
+
NumberInputComponent,
|
|
706
|
+
StringInputComponent,
|
|
707
|
+
PasswordInputComponent,
|
|
708
|
+
SelectInputComponent,
|
|
709
|
+
NoopComponent
|
|
710
|
+
],
|
|
711
|
+
imports: [
|
|
712
|
+
CommonModule,
|
|
713
|
+
BrowserAnimationsModule,
|
|
714
|
+
FormsModule,
|
|
715
|
+
MatInputModule,
|
|
716
|
+
MatFormFieldModule,
|
|
717
|
+
MatSelectModule,
|
|
718
|
+
MatTabsModule,
|
|
719
|
+
DirectivesModule
|
|
720
|
+
],
|
|
721
|
+
exports: [
|
|
722
|
+
NumberInputComponent,
|
|
723
|
+
StringInputComponent,
|
|
724
|
+
PasswordInputComponent,
|
|
725
|
+
SelectInputComponent,
|
|
726
|
+
NoopComponent
|
|
727
|
+
]
|
|
728
|
+
},] }
|
|
729
|
+
];
|
|
668
730
|
|
|
669
731
|
/**
|
|
670
732
|
* @fileoverview added by tsickle
|
|
@@ -902,7 +964,7 @@ class ActivityOutletComponent {
|
|
|
902
964
|
}
|
|
903
965
|
ActivityOutletComponent.decorators = [
|
|
904
966
|
{ type: Component, args: [{
|
|
905
|
-
selector: '
|
|
967
|
+
selector: 'aup-activity-outlet',
|
|
906
968
|
template: '',
|
|
907
969
|
styles: [":host{display:block}"]
|
|
908
970
|
}] }
|
|
@@ -980,9 +1042,9 @@ class AlertDialogComponent extends AbstractActivity {
|
|
|
980
1042
|
}
|
|
981
1043
|
AlertDialogComponent.decorators = [
|
|
982
1044
|
{ type: Component, args: [{
|
|
983
|
-
selector: '
|
|
1045
|
+
selector: 'aup-alert-dialog',
|
|
984
1046
|
template: "<h3 matDialogTitle *ngIf=\"alert.title\">{{alert.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of alert.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-raised-button color=\"primary\" (click)=\"done()\" data-cy=\"close-button\">{{alert.ok()}}</button>\n</p>\n",
|
|
985
|
-
styles: [":host{display:block;padding:var(--
|
|
1047
|
+
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
|
|
986
1048
|
}] }
|
|
987
1049
|
];
|
|
988
1050
|
/** @nocollapse */
|
|
@@ -1048,9 +1110,9 @@ class ConfirmThenDialogComponent extends AbstractActivity {
|
|
|
1048
1110
|
}
|
|
1049
1111
|
ConfirmThenDialogComponent.decorators = [
|
|
1050
1112
|
{ type: Component, args: [{
|
|
1051
|
-
selector: '
|
|
1113
|
+
selector: 'aup-confirmation-dialog',
|
|
1052
1114
|
template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"onConfirm()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</p>\n\n",
|
|
1053
|
-
styles: [":host{display:block;padding:var(--
|
|
1115
|
+
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
|
|
1054
1116
|
}] }
|
|
1055
1117
|
];
|
|
1056
1118
|
/** @nocollapse */
|
|
@@ -1108,9 +1170,9 @@ class ConfirmationDialogComponent extends AbstractActivity {
|
|
|
1108
1170
|
}
|
|
1109
1171
|
ConfirmationDialogComponent.decorators = [
|
|
1110
1172
|
{ type: Component, args: [{
|
|
1111
|
-
selector: '
|
|
1173
|
+
selector: 'aup-confirmation-dialog',
|
|
1112
1174
|
template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"done()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</p>\n\n",
|
|
1113
|
-
styles: [":host{display:block;padding:var(--
|
|
1175
|
+
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
|
|
1114
1176
|
}] }
|
|
1115
1177
|
];
|
|
1116
1178
|
/** @nocollapse */
|
|
@@ -1217,52 +1279,59 @@ if (false) {
|
|
|
1217
1279
|
class ActivityContainerComponent extends InteractionContext {
|
|
1218
1280
|
constructor() {
|
|
1219
1281
|
super();
|
|
1220
|
-
this.
|
|
1282
|
+
this.throttledNestedActivityFinishEvents = new MutableStream();
|
|
1283
|
+
// tslint:disable-next-line:no-output-rename
|
|
1284
|
+
this.initialActivityOutletContextEvent = new EventEmitter();
|
|
1285
|
+
this.dynamicHeight = false;
|
|
1221
1286
|
this.activityTabs = new MutableListModel();
|
|
1222
|
-
this.finished = false;
|
|
1223
1287
|
this._activityList = new MutableListModel();
|
|
1224
1288
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
1225
|
-
chain(this.
|
|
1289
|
+
chain(this.throttledNestedActivityFinishEvents).throttle(50).subscribe((/**
|
|
1226
1290
|
* @return {?}
|
|
1227
1291
|
*/
|
|
1228
|
-
() => this.
|
|
1292
|
+
() => this.onNestedActivityFinished()));
|
|
1229
1293
|
}
|
|
1230
1294
|
/**
|
|
1231
1295
|
* @param {?} initialContext
|
|
1232
1296
|
* @return {?}
|
|
1233
1297
|
*/
|
|
1234
1298
|
set initialActivityOutletContext(initialContext) {
|
|
1235
|
-
assert.isNil(this.
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1299
|
+
assert.isNil(this._initialActivityOutletContext);
|
|
1300
|
+
/** @type {?} */
|
|
1301
|
+
const self = this;
|
|
1302
|
+
if (initialContext) {
|
|
1303
|
+
this._initialActivityOutletContext = initialContext;
|
|
1304
|
+
this.activityTabs.push(new TabContext(initialContext.activityData, initialContext.activityClass, this, {
|
|
1305
|
+
onDone: (/**
|
|
1306
|
+
* @param {?} result
|
|
1307
|
+
* @return {?}
|
|
1308
|
+
*/
|
|
1309
|
+
(result) => {
|
|
1310
|
+
self.finishInitialActivity();
|
|
1311
|
+
initialContext.onDone(result);
|
|
1312
|
+
}),
|
|
1313
|
+
onCancel: (/**
|
|
1314
|
+
* @param {?} error
|
|
1315
|
+
* @return {?}
|
|
1316
|
+
*/
|
|
1317
|
+
(error) => {
|
|
1318
|
+
self.finishInitialActivity();
|
|
1319
|
+
initialContext.onCancel(error);
|
|
1320
|
+
})
|
|
1321
|
+
}));
|
|
1322
|
+
}
|
|
1254
1323
|
}
|
|
1255
1324
|
/**
|
|
1256
1325
|
* @return {?}
|
|
1257
1326
|
*/
|
|
1258
1327
|
get initialActivityOutletContext() {
|
|
1259
|
-
return this.
|
|
1328
|
+
return this._initialActivityOutletContext;
|
|
1260
1329
|
}
|
|
1261
1330
|
/**
|
|
1262
1331
|
* @return {?}
|
|
1263
1332
|
*/
|
|
1264
1333
|
isActive() {
|
|
1265
|
-
return this.
|
|
1334
|
+
return this._activityList.length > 0;
|
|
1266
1335
|
}
|
|
1267
1336
|
/**
|
|
1268
1337
|
* @return {?}
|
|
@@ -1270,6 +1339,12 @@ class ActivityContainerComponent extends InteractionContext {
|
|
|
1270
1339
|
get activityList() {
|
|
1271
1340
|
return this._activityList.readonly;
|
|
1272
1341
|
}
|
|
1342
|
+
/**
|
|
1343
|
+
* @return {?}
|
|
1344
|
+
*/
|
|
1345
|
+
get isFinished() {
|
|
1346
|
+
return !this._initialActivityOutletContext;
|
|
1347
|
+
}
|
|
1273
1348
|
/**
|
|
1274
1349
|
* @return {?}
|
|
1275
1350
|
*/
|
|
@@ -1316,7 +1391,7 @@ class ActivityContainerComponent extends InteractionContext {
|
|
|
1316
1391
|
*/
|
|
1317
1392
|
function (result) {
|
|
1318
1393
|
resolve(result);
|
|
1319
|
-
self.
|
|
1394
|
+
self.throttledNestedActivityFinishEvents.publish({});
|
|
1320
1395
|
}),
|
|
1321
1396
|
onCancel: (/**
|
|
1322
1397
|
* @param {?} error
|
|
@@ -1324,7 +1399,7 @@ class ActivityContainerComponent extends InteractionContext {
|
|
|
1324
1399
|
*/
|
|
1325
1400
|
function (error) {
|
|
1326
1401
|
reject(error);
|
|
1327
|
-
self.
|
|
1402
|
+
self.throttledNestedActivityFinishEvents.publish({});
|
|
1328
1403
|
})
|
|
1329
1404
|
});
|
|
1330
1405
|
self.activityTabs.push(context);
|
|
@@ -1359,27 +1434,34 @@ class ActivityContainerComponent extends InteractionContext {
|
|
|
1359
1434
|
data: data
|
|
1360
1435
|
});
|
|
1361
1436
|
}
|
|
1437
|
+
/**
|
|
1438
|
+
* @private
|
|
1439
|
+
* @return {?}
|
|
1440
|
+
*/
|
|
1441
|
+
finishInitialActivity() {
|
|
1442
|
+
this._initialActivityOutletContext = null;
|
|
1443
|
+
this.activityTabs.value = [];
|
|
1444
|
+
this._activityList.value = [];
|
|
1445
|
+
this.initialActivityOutletContextEvent.emit(null);
|
|
1446
|
+
}
|
|
1362
1447
|
// @Trace()
|
|
1363
1448
|
/**
|
|
1364
1449
|
* @private
|
|
1365
1450
|
* @return {?}
|
|
1366
1451
|
*/
|
|
1367
|
-
|
|
1452
|
+
onNestedActivityFinished() {
|
|
1368
1453
|
// don't do anything if job already queued up.
|
|
1369
|
-
if (
|
|
1370
|
-
|
|
1371
|
-
this.cleanupStaleActivities();
|
|
1372
|
-
}
|
|
1373
|
-
this.updateActivityList();
|
|
1454
|
+
if (this.synchroniseSelectedTabIndex()) {
|
|
1455
|
+
this.cleanupStaleNestedActivities();
|
|
1374
1456
|
}
|
|
1457
|
+
this.updateActivityList();
|
|
1375
1458
|
}
|
|
1376
1459
|
// @Trace()
|
|
1377
1460
|
/**
|
|
1378
1461
|
* @private
|
|
1379
1462
|
* @return {?}
|
|
1380
1463
|
*/
|
|
1381
|
-
|
|
1382
|
-
// clean up old tabs
|
|
1464
|
+
cleanupStaleNestedActivities() {
|
|
1383
1465
|
if (this.tabs.selectedIndex < this.activityTabs.length - 1) {
|
|
1384
1466
|
this.activityTabs.runInTransaction((/**
|
|
1385
1467
|
* @param {?} draft
|
|
@@ -1415,7 +1497,7 @@ class ActivityContainerComponent extends InteractionContext {
|
|
|
1415
1497
|
*/
|
|
1416
1498
|
onAnimationFinished() {
|
|
1417
1499
|
this.getSelectedOutlet().component.onActivityReady();
|
|
1418
|
-
this.
|
|
1500
|
+
this.cleanupStaleNestedActivities();
|
|
1419
1501
|
this.updateActivityList();
|
|
1420
1502
|
}
|
|
1421
1503
|
/**
|
|
@@ -1443,16 +1525,17 @@ class ActivityContainerComponent extends InteractionContext {
|
|
|
1443
1525
|
}
|
|
1444
1526
|
ActivityContainerComponent.decorators = [
|
|
1445
1527
|
{ type: Component, args: [{
|
|
1446
|
-
selector: '
|
|
1447
|
-
template: "<mat-tab-group #tabs no-tab-header [dynamicHeight]=\"
|
|
1448
|
-
styles: [":host{display:
|
|
1528
|
+
selector: 'aup-activity-container',
|
|
1529
|
+
template: "<mat-tab-group #tabs no-tab-header [dynamicHeight]=\"dynamicHeight\" [class.full-height-tabs]=\"!dynamicHeight\">\n <mat-tab *ngFor=\"let tab of activityTabs.value\">\n <aup-activity-outlet [interactionContext]=\"this\" [activityContext]=\"tab\"></aup-activity-outlet>\n </mat-tab>\n</mat-tab-group>\n",
|
|
1530
|
+
styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}"]
|
|
1449
1531
|
}] }
|
|
1450
1532
|
];
|
|
1451
1533
|
/** @nocollapse */
|
|
1452
1534
|
ActivityContainerComponent.ctorParameters = () => [];
|
|
1453
1535
|
ActivityContainerComponent.propDecorators = {
|
|
1454
|
-
parentInteractionContext: [{ type: Input }],
|
|
1455
1536
|
initialActivityOutletContext: [{ type: Input }],
|
|
1537
|
+
initialActivityOutletContextEvent: [{ type: Output, args: ['initialActivityOutletContext',] }],
|
|
1538
|
+
dynamicHeight: [{ type: Input }],
|
|
1456
1539
|
tabs: [{ type: ViewChild, args: ['tabs', { static: true },] }],
|
|
1457
1540
|
outlets: [{ type: ViewChildren, args: [ActivityOutletComponent,] }]
|
|
1458
1541
|
};
|
|
@@ -1461,9 +1544,16 @@ if (false) {
|
|
|
1461
1544
|
* @type {?}
|
|
1462
1545
|
* @private
|
|
1463
1546
|
*/
|
|
1464
|
-
ActivityContainerComponent.prototype.
|
|
1547
|
+
ActivityContainerComponent.prototype.throttledNestedActivityFinishEvents;
|
|
1548
|
+
/**
|
|
1549
|
+
* @type {?}
|
|
1550
|
+
* @private
|
|
1551
|
+
*/
|
|
1552
|
+
ActivityContainerComponent.prototype._initialActivityOutletContext;
|
|
1553
|
+
/** @type {?} */
|
|
1554
|
+
ActivityContainerComponent.prototype.initialActivityOutletContextEvent;
|
|
1465
1555
|
/** @type {?} */
|
|
1466
|
-
ActivityContainerComponent.prototype.
|
|
1556
|
+
ActivityContainerComponent.prototype.dynamicHeight;
|
|
1467
1557
|
/** @type {?} */
|
|
1468
1558
|
ActivityContainerComponent.prototype.tabs;
|
|
1469
1559
|
/** @type {?} */
|
|
@@ -1474,12 +1564,129 @@ if (false) {
|
|
|
1474
1564
|
* @type {?}
|
|
1475
1565
|
* @private
|
|
1476
1566
|
*/
|
|
1477
|
-
ActivityContainerComponent.prototype.
|
|
1567
|
+
ActivityContainerComponent.prototype._activityList;
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
/**
|
|
1571
|
+
* @fileoverview added by tsickle
|
|
1572
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1573
|
+
*/
|
|
1574
|
+
/**
|
|
1575
|
+
* @template D, R, E
|
|
1576
|
+
*/
|
|
1577
|
+
class InplaceInteractionContextComponent extends InteractionContext {
|
|
1578
|
+
constructor() {
|
|
1579
|
+
super();
|
|
1580
|
+
}
|
|
1581
|
+
/**
|
|
1582
|
+
* @return {?}
|
|
1583
|
+
*/
|
|
1584
|
+
ngOnInit() {
|
|
1585
|
+
}
|
|
1586
|
+
/**
|
|
1587
|
+
* @return {?}
|
|
1588
|
+
*/
|
|
1589
|
+
get activityList() {
|
|
1590
|
+
return this.interactionContext.activityList;
|
|
1591
|
+
}
|
|
1478
1592
|
/**
|
|
1479
|
-
* @
|
|
1480
|
-
* @private
|
|
1593
|
+
* @return {?}
|
|
1481
1594
|
*/
|
|
1482
|
-
|
|
1595
|
+
isActive() {
|
|
1596
|
+
return this.interactionContext.isActive();
|
|
1597
|
+
}
|
|
1598
|
+
/**
|
|
1599
|
+
* @param {?} alert
|
|
1600
|
+
* @return {?}
|
|
1601
|
+
*/
|
|
1602
|
+
alert(alert) {
|
|
1603
|
+
// TODO: Test disableClose === false
|
|
1604
|
+
return this._startActivity(AlertDialogComponent, alert);
|
|
1605
|
+
}
|
|
1606
|
+
/**
|
|
1607
|
+
* @param {?} confirm
|
|
1608
|
+
* @return {?}
|
|
1609
|
+
*/
|
|
1610
|
+
confirm(confirm) {
|
|
1611
|
+
return this._startActivity(ConfirmationDialogComponent, confirm);
|
|
1612
|
+
}
|
|
1613
|
+
/**
|
|
1614
|
+
* @template D1, R1, E1
|
|
1615
|
+
* @param {?} confirm
|
|
1616
|
+
* @param {?} activityType
|
|
1617
|
+
* @param {?=} data
|
|
1618
|
+
* @return {?}
|
|
1619
|
+
*/
|
|
1620
|
+
confirmThen(confirm, activityType, data) {
|
|
1621
|
+
return this._startActivity(ConfirmThenDialogComponent, {
|
|
1622
|
+
confirm,
|
|
1623
|
+
activityType: activityType,
|
|
1624
|
+
data: data
|
|
1625
|
+
});
|
|
1626
|
+
}
|
|
1627
|
+
/**
|
|
1628
|
+
* @template D1, R1, E1
|
|
1629
|
+
* @param {?} activityType
|
|
1630
|
+
* @param {?=} data
|
|
1631
|
+
* @return {?}
|
|
1632
|
+
*/
|
|
1633
|
+
startActivity(activityType, data) {
|
|
1634
|
+
return this._startActivity(activityType, data);
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* @protected
|
|
1638
|
+
* @template D1, R1, E1
|
|
1639
|
+
* @param {?} activityType
|
|
1640
|
+
* @param {?=} data
|
|
1641
|
+
* @return {?}
|
|
1642
|
+
*/
|
|
1643
|
+
_startActivity(activityType, data) {
|
|
1644
|
+
/** @type {?} */
|
|
1645
|
+
const self = this;
|
|
1646
|
+
return new Promise((/**
|
|
1647
|
+
* @param {?} resolve
|
|
1648
|
+
* @param {?} reject
|
|
1649
|
+
* @return {?}
|
|
1650
|
+
*/
|
|
1651
|
+
(resolve, reject) => {
|
|
1652
|
+
this.interactionContext.initialActivityOutletContext = {
|
|
1653
|
+
activityClass: activityType,
|
|
1654
|
+
activityData: data,
|
|
1655
|
+
/**
|
|
1656
|
+
* @param {?} result
|
|
1657
|
+
* @return {?}
|
|
1658
|
+
*/
|
|
1659
|
+
onDone(result) {
|
|
1660
|
+
resolve(result);
|
|
1661
|
+
},
|
|
1662
|
+
/**
|
|
1663
|
+
* @param {?} error
|
|
1664
|
+
* @return {?}
|
|
1665
|
+
*/
|
|
1666
|
+
onCancel(error) {
|
|
1667
|
+
reject(error);
|
|
1668
|
+
}
|
|
1669
|
+
};
|
|
1670
|
+
}));
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
InplaceInteractionContextComponent.decorators = [
|
|
1674
|
+
{ type: Component, args: [{
|
|
1675
|
+
selector: 'aup-inplace-interaction-context',
|
|
1676
|
+
template: "<mat-tab-group no-tab-header [selectedIndex]=\"isActive() ? 1 : 0\" full-height-tabs [dynamicHeight]=\"false\">\n <mat-tab>\n <ng-content></ng-content>\n </mat-tab>\n <mat-tab>\n <aup-activity-container #activityContainer\n [(initialActivityOutletContext)]=\"initialActivityContext\"\n [dynamicHeight]=\"false\"></aup-activity-container>\n </mat-tab>\n</mat-tab-group>\n\n",
|
|
1677
|
+
styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}"]
|
|
1678
|
+
}] }
|
|
1679
|
+
];
|
|
1680
|
+
/** @nocollapse */
|
|
1681
|
+
InplaceInteractionContextComponent.ctorParameters = () => [];
|
|
1682
|
+
InplaceInteractionContextComponent.propDecorators = {
|
|
1683
|
+
interactionContext: [{ type: ViewChild, args: ["activityContainer", { static: true },] }]
|
|
1684
|
+
};
|
|
1685
|
+
if (false) {
|
|
1686
|
+
/** @type {?} */
|
|
1687
|
+
InplaceInteractionContextComponent.prototype.interactionContext;
|
|
1688
|
+
/** @type {?} */
|
|
1689
|
+
InplaceInteractionContextComponent.prototype.initialActivityContext;
|
|
1483
1690
|
}
|
|
1484
1691
|
|
|
1485
1692
|
/**
|
|
@@ -1492,7 +1699,7 @@ class InteractionOutletComponent {
|
|
|
1492
1699
|
}
|
|
1493
1700
|
InteractionOutletComponent.decorators = [
|
|
1494
1701
|
{ type: Component, args: [{
|
|
1495
|
-
selector: '
|
|
1702
|
+
selector: 'aup-interaction-outlet',
|
|
1496
1703
|
template: "<router-outlet name=\"interaction-context\"></router-outlet>\n",
|
|
1497
1704
|
styles: [":host{display:block}"]
|
|
1498
1705
|
}] }
|
|
@@ -1563,7 +1770,7 @@ class DialogInteractionService extends InteractionContext {
|
|
|
1563
1770
|
* @return {?}
|
|
1564
1771
|
*/
|
|
1565
1772
|
isActive() {
|
|
1566
|
-
return
|
|
1773
|
+
return this._activityList.length > 0;
|
|
1567
1774
|
}
|
|
1568
1775
|
/**
|
|
1569
1776
|
* @return {?}
|
|
@@ -1606,7 +1813,8 @@ class DialogInteractionService extends InteractionContext {
|
|
|
1606
1813
|
* @return {?}
|
|
1607
1814
|
*/
|
|
1608
1815
|
() => {
|
|
1609
|
-
|
|
1816
|
+
console.log('###### STARTING');
|
|
1817
|
+
// this.currentActivityId = uuid.v1();
|
|
1610
1818
|
// this.location.go(this.router.routerState.snapshot.url, "aup");
|
|
1611
1819
|
/** @type {?} */
|
|
1612
1820
|
const self = this;
|
|
@@ -1626,7 +1834,6 @@ class DialogInteractionService extends InteractionContext {
|
|
|
1626
1834
|
(resolve, reject) => {
|
|
1627
1835
|
/** @type {?} */
|
|
1628
1836
|
const activityContainer = matDialogRef.componentInstance;
|
|
1629
|
-
activityContainer.parentInteractionContext = this;
|
|
1630
1837
|
self.safelyUpdateActivityListDelegate(activityContainer.activityList);
|
|
1631
1838
|
activityContainer.initialActivityOutletContext = {
|
|
1632
1839
|
activityClass: activityType,
|
|
@@ -1648,13 +1855,16 @@ class DialogInteractionService extends InteractionContext {
|
|
|
1648
1855
|
matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
|
|
1649
1856
|
}
|
|
1650
1857
|
};
|
|
1858
|
+
// we need to check if our onDone/onCancel methods above we called or if we were
|
|
1859
|
+
// closed by the user clicking the backdrop. If the later then we need to reject
|
|
1860
|
+
// our promise.
|
|
1651
1861
|
matDialogRef.afterClosed().subscribe((/**
|
|
1652
1862
|
* @param {?} promiseAlreadyFinished
|
|
1653
1863
|
* @return {?}
|
|
1654
1864
|
*/
|
|
1655
1865
|
promiseAlreadyFinished => {
|
|
1656
1866
|
if (!promiseAlreadyFinished) {
|
|
1657
|
-
reject(
|
|
1867
|
+
reject('auto-closed');
|
|
1658
1868
|
}
|
|
1659
1869
|
}));
|
|
1660
1870
|
matDialogRef.updateSize();
|
|
@@ -1662,7 +1872,8 @@ class DialogInteractionService extends InteractionContext {
|
|
|
1662
1872
|
* @return {?}
|
|
1663
1873
|
*/
|
|
1664
1874
|
() => {
|
|
1665
|
-
|
|
1875
|
+
console.log('###### FINISHED');
|
|
1876
|
+
// this.currentActivityId = null;
|
|
1666
1877
|
self.safelyUpdateActivityListDelegate(null);
|
|
1667
1878
|
}));
|
|
1668
1879
|
}));
|
|
@@ -1765,7 +1976,7 @@ InteractionModule.decorators = [
|
|
|
1765
1976
|
CommonModule,
|
|
1766
1977
|
MatButtonModule,
|
|
1767
1978
|
MatDialogModule,
|
|
1768
|
-
MatTabsModule,
|
|
1979
|
+
MatTabsModule$1,
|
|
1769
1980
|
PortalModule,
|
|
1770
1981
|
RouterModule
|
|
1771
1982
|
],
|
|
@@ -1775,12 +1986,14 @@ InteractionModule.decorators = [
|
|
|
1775
1986
|
ConfirmThenDialogComponent,
|
|
1776
1987
|
AlertDialogComponent,
|
|
1777
1988
|
ActivityOutletComponent,
|
|
1778
|
-
InteractionOutletComponent
|
|
1989
|
+
InteractionOutletComponent,
|
|
1990
|
+
InplaceInteractionContextComponent
|
|
1779
1991
|
],
|
|
1780
1992
|
exports: [
|
|
1781
1993
|
ActivityContainerComponent,
|
|
1782
1994
|
ActivityOutletComponent,
|
|
1783
|
-
InteractionOutletComponent
|
|
1995
|
+
InteractionOutletComponent,
|
|
1996
|
+
InplaceInteractionContextComponent
|
|
1784
1997
|
],
|
|
1785
1998
|
entryComponents: [
|
|
1786
1999
|
ActivityContainerComponent,
|
|
@@ -1809,7 +2022,7 @@ class BusyOverlayComponent {
|
|
|
1809
2022
|
}
|
|
1810
2023
|
BusyOverlayComponent.decorators = [
|
|
1811
2024
|
{ type: Component, args: [{
|
|
1812
|
-
selector: '
|
|
2025
|
+
selector: 'aup-busy-overlay',
|
|
1813
2026
|
template: "<ng-content></ng-content>\n<div class=\"busy-overlay-backdrop\" *ngIf=\"busyModel.value\">\n <mat-progress-spinner mode=\"indeterminate\" [diameter]=\"52\"></mat-progress-spinner>\n</div>\n",
|
|
1814
2027
|
styles: [":host{position:relative}div.busy-overlay-backdrop{position:absolute;background-color:rgba(0,0,0,.2);top:0;left:0;bottom:0;right:0;display:-ms-grid;display:grid;-ms-grid-columns:auto;grid-template-columns:auto;-ms-grid-rows:auto;grid-template-rows:auto;place-content:center}"]
|
|
1815
2028
|
}] }
|
|
@@ -1850,13 +2063,13 @@ class EmptyStateComponent {
|
|
|
1850
2063
|
}
|
|
1851
2064
|
EmptyStateComponent.decorators = [
|
|
1852
2065
|
{ type: Component, args: [{
|
|
1853
|
-
selector: '
|
|
2066
|
+
selector: 'aup-empty-state',
|
|
1854
2067
|
template: `
|
|
1855
2068
|
<div class="container">
|
|
1856
2069
|
<ng-content></ng-content>
|
|
1857
2070
|
</div>
|
|
1858
2071
|
`,
|
|
1859
|
-
styles: [":host{display:flex;flex-direction:column;justify-content:center;align-items:center}.container{padding:var(--
|
|
2072
|
+
styles: [":host{display:flex;flex-direction:column;justify-content:center;align-items:center}.container{padding:var(--aup-default-padding);border:2px dashed rgba(0,0,0,.2);border-radius:5px;font-size:14px;font-weight:300}"]
|
|
1860
2073
|
}] }
|
|
1861
2074
|
];
|
|
1862
2075
|
/** @nocollapse */
|
|
@@ -2099,16 +2312,14 @@ class PlaceDefinition {
|
|
|
2099
2312
|
* @param {?} component
|
|
2100
2313
|
* @param {?} path
|
|
2101
2314
|
* @param {?} authenticate
|
|
2102
|
-
* @param {?} order
|
|
2103
2315
|
* @param {?} data
|
|
2104
2316
|
* @param {?} routeParameters
|
|
2105
2317
|
* @param {?} children
|
|
2106
2318
|
*/
|
|
2107
|
-
constructor(component, path, authenticate,
|
|
2319
|
+
constructor(component, path, authenticate, data, routeParameters, children) {
|
|
2108
2320
|
this.component = component;
|
|
2109
2321
|
this.path = path;
|
|
2110
2322
|
this.authenticate = authenticate;
|
|
2111
|
-
this.order = order;
|
|
2112
2323
|
this.data = data;
|
|
2113
2324
|
this.routeParameters = routeParameters;
|
|
2114
2325
|
this.children = children;
|
|
@@ -2341,8 +2552,6 @@ if (false) {
|
|
|
2341
2552
|
/** @type {?} */
|
|
2342
2553
|
PlaceDefinition.prototype.authenticate;
|
|
2343
2554
|
/** @type {?} */
|
|
2344
|
-
PlaceDefinition.prototype.order;
|
|
2345
|
-
/** @type {?} */
|
|
2346
2555
|
PlaceDefinition.prototype.data;
|
|
2347
2556
|
/** @type {?} */
|
|
2348
2557
|
PlaceDefinition.prototype.routeParameters;
|
|
@@ -2465,6 +2674,8 @@ if (false) {
|
|
|
2465
2674
|
* @private
|
|
2466
2675
|
*/
|
|
2467
2676
|
PlaceComponent.prototype.visit;
|
|
2677
|
+
/** @type {?} */
|
|
2678
|
+
PlaceComponent.prototype.interactionContext;
|
|
2468
2679
|
}
|
|
2469
2680
|
(function (PlaceComponent) {
|
|
2470
2681
|
/**
|
|
@@ -2506,114 +2717,128 @@ if (false) {
|
|
|
2506
2717
|
* @fileoverview added by tsickle
|
|
2507
2718
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2508
2719
|
*/
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2720
|
+
/**
|
|
2721
|
+
* @record
|
|
2722
|
+
*/
|
|
2723
|
+
function Params() { }
|
|
2724
|
+
class Visit {
|
|
2725
|
+
/**
|
|
2726
|
+
* @param {?} placeDefinition
|
|
2727
|
+
* @param {?=} visitParameters
|
|
2728
|
+
*/
|
|
2729
|
+
constructor(placeDefinition, visitParameters = {}) {
|
|
2730
|
+
this.placeDefinition = placeDefinition;
|
|
2731
|
+
this.visitParameters = visitParameters;
|
|
2732
|
+
}
|
|
2733
|
+
// @Trace()
|
|
2734
|
+
/**
|
|
2735
|
+
* @return {?}
|
|
2736
|
+
*/
|
|
2737
|
+
getRouteId() {
|
|
2738
|
+
return this.placeDefinition.getRouteIdFrom(this);
|
|
2739
|
+
}
|
|
2740
|
+
// @Trace()
|
|
2741
|
+
/**
|
|
2742
|
+
* @return {?}
|
|
2743
|
+
*/
|
|
2744
|
+
hasRouteId() {
|
|
2745
|
+
return !isNil(this.getRouteId());
|
|
2746
|
+
}
|
|
2747
|
+
/**
|
|
2748
|
+
* Returns the value of the place parameter with the specified name. The parameter
|
|
2749
|
+
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
2750
|
+
* same as the the ValueModel property name.
|
|
2751
|
+
* @param {?} parameterName the field name of the property model or the `as` option if specified.
|
|
2752
|
+
* @return {?}
|
|
2753
|
+
*/
|
|
2754
|
+
getParameter(parameterName) {
|
|
2755
|
+
return this.visitParameters[parameterName];
|
|
2756
|
+
}
|
|
2757
|
+
// @Trace()
|
|
2758
|
+
/**
|
|
2759
|
+
* @param {?} parameterName
|
|
2760
|
+
* @return {?}
|
|
2761
|
+
*/
|
|
2762
|
+
hasParameter(parameterName) {
|
|
2763
|
+
return Object.keys(this.visitParameters).includes(parameterName);
|
|
2764
|
+
}
|
|
2765
|
+
/**
|
|
2766
|
+
* @template S
|
|
2767
|
+
* @param {?} parameter
|
|
2768
|
+
* @param {?} value
|
|
2769
|
+
* @return {?}
|
|
2770
|
+
*/
|
|
2771
|
+
replace(parameter, value) {
|
|
2772
|
+
return new Visit(this.placeDefinition, Object.assign({}, this.visitParameters, { [parameter.name]: value }));
|
|
2773
|
+
}
|
|
2774
|
+
/**
|
|
2775
|
+
* @template S
|
|
2776
|
+
* @param {?} routeParams
|
|
2777
|
+
* @return {?}
|
|
2778
|
+
*/
|
|
2779
|
+
mergeRouteParameters(routeParams) {
|
|
2780
|
+
// todo: whitelist parameters.
|
|
2781
|
+
/** @type {?} */
|
|
2782
|
+
const routeParameterKeys = Object.keys(routeParams);
|
|
2783
|
+
/** @type {?} */
|
|
2784
|
+
const params = {};
|
|
2785
|
+
this.placeDefinition.getVisitParameterDefs().forEach((/**
|
|
2786
|
+
* @param {?} def
|
|
2515
2787
|
* @return {?}
|
|
2516
2788
|
*/
|
|
2517
|
-
|
|
2789
|
+
def => {
|
|
2790
|
+
if (def.isRouteId || def.isRouteParameter) {
|
|
2791
|
+
if (routeParameterKeys.includes(def.name)) {
|
|
2792
|
+
params[def.name] = routeParams[def.name];
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
else {
|
|
2796
|
+
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
2797
|
+
// defaults and remember sanitisation process.
|
|
2798
|
+
if (this.hasParameter(def.name)) {
|
|
2799
|
+
params[def.name] = this.getParameter(def.name);
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
}));
|
|
2803
|
+
return new Visit(this.placeDefinition, params);
|
|
2518
2804
|
}
|
|
2519
2805
|
/**
|
|
2520
|
-
* @param {?}
|
|
2806
|
+
* @param {?} other
|
|
2521
2807
|
* @return {?}
|
|
2522
2808
|
*/
|
|
2523
|
-
|
|
2809
|
+
hasRoutingChangedFrom(other) {
|
|
2524
2810
|
/** @type {?} */
|
|
2525
|
-
const
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
*/
|
|
2530
|
-
() => navItem ? navItem.title() : placeDef.searchPlaceData(['navTitle', 'title'])),
|
|
2531
|
-
tooltip: (/**
|
|
2532
|
-
* @return {?}
|
|
2533
|
-
*/
|
|
2534
|
-
() => navItem && navItem.tooltip ? navItem.tooltip() : placeDef.getPlaceData('navTooltip', null)),
|
|
2535
|
-
icon: (/**
|
|
2536
|
-
* @return {?}
|
|
2537
|
-
*/
|
|
2538
|
-
() => navItem && navItem.icon ? navItem.icon() : placeDef.getPlaceData('navIcon', null))
|
|
2539
|
-
};
|
|
2540
|
-
}
|
|
2541
|
-
/**
|
|
2542
|
-
* @return {?}
|
|
2543
|
-
*/
|
|
2544
|
-
ngOnInit() {
|
|
2545
|
-
}
|
|
2546
|
-
}
|
|
2547
|
-
AbstractPlaceNavigationComponent.propDecorators = {
|
|
2548
|
-
places: [{ type: Input }],
|
|
2549
|
-
placesModel: [{ type: Input }]
|
|
2550
|
-
};
|
|
2551
|
-
__decorate([
|
|
2552
|
-
StoreInListModel('placesModel'),
|
|
2553
|
-
__metadata("design:type", Array)
|
|
2554
|
-
], AbstractPlaceNavigationComponent.prototype, "places", void 0);
|
|
2555
|
-
__decorate([
|
|
2556
|
-
UseDelegate(),
|
|
2557
|
-
__metadata("design:type", ListModel)
|
|
2558
|
-
], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
|
|
2559
|
-
__decorate([
|
|
2560
|
-
Memoize(),
|
|
2561
|
-
__metadata("design:type", Function),
|
|
2562
|
-
__metadata("design:paramtypes", [PlaceDefinition]),
|
|
2563
|
-
__metadata("design:returntype", Object)
|
|
2564
|
-
], AbstractPlaceNavigationComponent.prototype, "getNav", null);
|
|
2565
|
-
if (false) {
|
|
2566
|
-
/** @type {?} */
|
|
2567
|
-
AbstractPlaceNavigationComponent.prototype.places;
|
|
2568
|
-
/** @type {?} */
|
|
2569
|
-
AbstractPlaceNavigationComponent.prototype.placesModel;
|
|
2570
|
-
/** @type {?} */
|
|
2571
|
-
AbstractPlaceNavigationComponent.prototype.placeDefinitions;
|
|
2572
|
-
}
|
|
2573
|
-
|
|
2574
|
-
/**
|
|
2575
|
-
* @fileoverview added by tsickle
|
|
2576
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2577
|
-
*/
|
|
2578
|
-
class ListPlaceNavComponent extends AbstractPlaceNavigationComponent {
|
|
2579
|
-
constructor() {
|
|
2580
|
-
super();
|
|
2581
|
-
this.expanded = true;
|
|
2582
|
-
}
|
|
2583
|
-
/**
|
|
2584
|
-
* @return {?}
|
|
2585
|
-
*/
|
|
2586
|
-
expandMenu() {
|
|
2587
|
-
this.expanded = true;
|
|
2811
|
+
const samePlace = other.placeDefinition === this.placeDefinition;
|
|
2812
|
+
/** @type {?} */
|
|
2813
|
+
const sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
2814
|
+
return !samePlace || !sameRouteParameters;
|
|
2588
2815
|
}
|
|
2589
2816
|
/**
|
|
2817
|
+
* @param {?} other
|
|
2590
2818
|
* @return {?}
|
|
2591
2819
|
*/
|
|
2592
|
-
|
|
2593
|
-
|
|
2820
|
+
hasChangedFrom(other) {
|
|
2821
|
+
/** @type {?} */
|
|
2822
|
+
const sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
2823
|
+
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
2594
2824
|
}
|
|
2595
2825
|
/**
|
|
2596
2826
|
* @return {?}
|
|
2597
2827
|
*/
|
|
2598
|
-
|
|
2599
|
-
this.
|
|
2828
|
+
getUrlSegments() {
|
|
2829
|
+
return this.placeDefinition.hasRouteId() ?
|
|
2830
|
+
[new UrlSegment(this.placeDefinition.path, {}), new UrlSegment(this.placeDefinition.getFormattedRouteId(this), this.placeDefinition.getFormattedRouteParameters(this))] :
|
|
2831
|
+
[new UrlSegment(this.placeDefinition.path, this.placeDefinition.getFormattedRouteParameters(this))];
|
|
2600
2832
|
}
|
|
2601
2833
|
}
|
|
2602
|
-
ListPlaceNavComponent.decorators = [
|
|
2603
|
-
{ type: Component, args: [{
|
|
2604
|
-
selector: 'angular-ui-powerups-list-place-nav',
|
|
2605
|
-
template: "<mat-nav-list class=\"app-menu\">\n <a mat-list-item *ngFor=\"let place of placeDefinitions.value\"\n [routerLink]='place.path'\n [replaceUrl]=\"true\"\n routerLinkActive #rla=\"routerLinkActive\"\n [matTooltip]=\"getNav(place).tooltip()\">\n <mat-icon *ngIf=\"getNav(place).icon()\">{{getNav(place).icon()}}</mat-icon>\n <span class=\"expanded-only\">{{getNav(place).title()}}</span>\n </a>\n</mat-nav-list>\n",
|
|
2606
|
-
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}"]
|
|
2607
|
-
}] }
|
|
2608
|
-
];
|
|
2609
|
-
/** @nocollapse */
|
|
2610
|
-
ListPlaceNavComponent.ctorParameters = () => [];
|
|
2611
|
-
ListPlaceNavComponent.propDecorators = {
|
|
2612
|
-
expanded: [{ type: HostBinding, args: ['class.expanded',] }]
|
|
2613
|
-
};
|
|
2614
2834
|
if (false) {
|
|
2615
2835
|
/** @type {?} */
|
|
2616
|
-
|
|
2836
|
+
Visit.prototype.placeDefinition;
|
|
2837
|
+
/**
|
|
2838
|
+
* @type {?}
|
|
2839
|
+
* @private
|
|
2840
|
+
*/
|
|
2841
|
+
Visit.prototype.visitParameters;
|
|
2617
2842
|
}
|
|
2618
2843
|
|
|
2619
2844
|
/**
|
|
@@ -2836,126 +3061,6 @@ if (false) {
|
|
|
2836
3061
|
PlaceHistory.prototype.router;
|
|
2837
3062
|
}
|
|
2838
3063
|
|
|
2839
|
-
/**
|
|
2840
|
-
* @fileoverview added by tsickle
|
|
2841
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2842
|
-
*/
|
|
2843
|
-
/**
|
|
2844
|
-
* @record
|
|
2845
|
-
*/
|
|
2846
|
-
function Params() { }
|
|
2847
|
-
class Visit {
|
|
2848
|
-
/**
|
|
2849
|
-
* @param {?} placeDefinition
|
|
2850
|
-
* @param {?=} visitParameters
|
|
2851
|
-
*/
|
|
2852
|
-
constructor(placeDefinition, visitParameters = {}) {
|
|
2853
|
-
this.placeDefinition = placeDefinition;
|
|
2854
|
-
this.visitParameters = visitParameters;
|
|
2855
|
-
}
|
|
2856
|
-
// @Trace()
|
|
2857
|
-
/**
|
|
2858
|
-
* @return {?}
|
|
2859
|
-
*/
|
|
2860
|
-
getRouteId() {
|
|
2861
|
-
return this.placeDefinition.getRouteIdFrom(this);
|
|
2862
|
-
}
|
|
2863
|
-
// @Trace()
|
|
2864
|
-
/**
|
|
2865
|
-
* @return {?}
|
|
2866
|
-
*/
|
|
2867
|
-
hasRouteId() {
|
|
2868
|
-
return !isNil(this.getRouteId());
|
|
2869
|
-
}
|
|
2870
|
-
/**
|
|
2871
|
-
* Returns the value of the place parameter with the specified name. The parameter
|
|
2872
|
-
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
2873
|
-
* same as the the ValueModel property name.
|
|
2874
|
-
* @param {?} parameterName the field name of the property model or the `as` option if specified.
|
|
2875
|
-
* @return {?}
|
|
2876
|
-
*/
|
|
2877
|
-
getParameter(parameterName) {
|
|
2878
|
-
return this.visitParameters[parameterName];
|
|
2879
|
-
}
|
|
2880
|
-
// @Trace()
|
|
2881
|
-
/**
|
|
2882
|
-
* @param {?} parameterName
|
|
2883
|
-
* @return {?}
|
|
2884
|
-
*/
|
|
2885
|
-
hasParameter(parameterName) {
|
|
2886
|
-
return Object.keys(this.visitParameters).includes(parameterName);
|
|
2887
|
-
}
|
|
2888
|
-
/**
|
|
2889
|
-
* @template S
|
|
2890
|
-
* @param {?} parameter
|
|
2891
|
-
* @param {?} value
|
|
2892
|
-
* @return {?}
|
|
2893
|
-
*/
|
|
2894
|
-
replace(parameter, value) {
|
|
2895
|
-
return new Visit(this.placeDefinition, Object.assign({}, this.visitParameters, { [parameter.name]: value }));
|
|
2896
|
-
}
|
|
2897
|
-
/**
|
|
2898
|
-
* @template S
|
|
2899
|
-
* @param {?} routeParams
|
|
2900
|
-
* @return {?}
|
|
2901
|
-
*/
|
|
2902
|
-
mergeRouteParameters(routeParams) {
|
|
2903
|
-
// todo: whitelist parameters.
|
|
2904
|
-
/** @type {?} */
|
|
2905
|
-
const routeParameterKeys = Object.keys(routeParams);
|
|
2906
|
-
/** @type {?} */
|
|
2907
|
-
const params = {};
|
|
2908
|
-
this.placeDefinition.getVisitParameterDefs().forEach((/**
|
|
2909
|
-
* @param {?} def
|
|
2910
|
-
* @return {?}
|
|
2911
|
-
*/
|
|
2912
|
-
def => {
|
|
2913
|
-
if (def.isRouteId || def.isRouteParameter) {
|
|
2914
|
-
if (routeParameterKeys.includes(def.name)) {
|
|
2915
|
-
params[def.name] = routeParams[def.name];
|
|
2916
|
-
}
|
|
2917
|
-
}
|
|
2918
|
-
else {
|
|
2919
|
-
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
2920
|
-
// defaults and remember sanitisation process.
|
|
2921
|
-
if (this.hasParameter(def.name)) {
|
|
2922
|
-
params[def.name] = this.getParameter(def.name);
|
|
2923
|
-
}
|
|
2924
|
-
}
|
|
2925
|
-
}));
|
|
2926
|
-
return new Visit(this.placeDefinition, params);
|
|
2927
|
-
}
|
|
2928
|
-
/**
|
|
2929
|
-
* @param {?} other
|
|
2930
|
-
* @return {?}
|
|
2931
|
-
*/
|
|
2932
|
-
hasRoutingChangedFrom(other) {
|
|
2933
|
-
/** @type {?} */
|
|
2934
|
-
const samePlace = other.placeDefinition === this.placeDefinition;
|
|
2935
|
-
/** @type {?} */
|
|
2936
|
-
const sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
2937
|
-
return !samePlace || !sameRouteParameters;
|
|
2938
|
-
}
|
|
2939
|
-
/**
|
|
2940
|
-
* @param {?} other
|
|
2941
|
-
* @return {?}
|
|
2942
|
-
*/
|
|
2943
|
-
hasChangedFrom(other) {
|
|
2944
|
-
/** @type {?} */
|
|
2945
|
-
const sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
2946
|
-
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
2947
|
-
}
|
|
2948
|
-
}
|
|
2949
|
-
if (false) {
|
|
2950
|
-
/** @type {?} */
|
|
2951
|
-
Visit.prototype.placeDefinition;
|
|
2952
|
-
/**
|
|
2953
|
-
* @type {?}
|
|
2954
|
-
* @private
|
|
2955
|
-
*/
|
|
2956
|
-
Visit.prototype.visitParameters;
|
|
2957
|
-
}
|
|
2958
|
-
|
|
2959
3064
|
/**
|
|
2960
3065
|
* @fileoverview added by tsickle
|
|
2961
3066
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -3055,6 +3160,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
3055
3160
|
})));
|
|
3056
3161
|
});
|
|
3057
3162
|
}
|
|
3163
|
+
// @Trace()
|
|
3058
3164
|
/**
|
|
3059
3165
|
* @param {?} activatedRoute
|
|
3060
3166
|
* @param {?} previous
|
|
@@ -3073,6 +3179,9 @@ class PlaceRouter extends GarbageCollector {
|
|
|
3073
3179
|
* @return {?}
|
|
3074
3180
|
*/
|
|
3075
3181
|
router => {
|
|
3182
|
+
// we have to to use the definition for route id as our redirection always includes
|
|
3183
|
+
// the id in the url segements (but leaves it blank when there's no id). I.e. in the
|
|
3184
|
+
// no id case we're doing the following redirect [<placePath>, ""] -> ["..", <id>]
|
|
3076
3185
|
/** @type {?} */
|
|
3077
3186
|
const relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
|
|
3078
3187
|
/** @type {?} */
|
|
@@ -3081,7 +3190,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
3081
3190
|
...this.createRouteParameters(next),
|
|
3082
3191
|
...this.extractChildPath(activatedRoute.snapshot)
|
|
3083
3192
|
];
|
|
3084
|
-
console.log('### Redirect', commands);
|
|
3193
|
+
console.log('### Push Changes to route Redirect', { commands, relativeTo: activatedRoute.snapshot.url });
|
|
3085
3194
|
return router.navigate(commands, {
|
|
3086
3195
|
relativeTo: activatedRoute
|
|
3087
3196
|
});
|
|
@@ -3189,12 +3298,6 @@ __decorate([
|
|
|
3189
3298
|
__metadata("design:paramtypes", [Visit, Object]),
|
|
3190
3299
|
__metadata("design:returntype", Promise)
|
|
3191
3300
|
], PlaceRouter.prototype, "navigate", null);
|
|
3192
|
-
__decorate([
|
|
3193
|
-
Trace(),
|
|
3194
|
-
__metadata("design:type", Function),
|
|
3195
|
-
__metadata("design:paramtypes", [ActivatedRoute, Visit, Visit]),
|
|
3196
|
-
__metadata("design:returntype", Promise)
|
|
3197
|
-
], PlaceRouter.prototype, "pushVisitChangesToRoute", null);
|
|
3198
3301
|
if (false) {
|
|
3199
3302
|
/**
|
|
3200
3303
|
* @type {?}
|
|
@@ -3310,18 +3413,45 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
3310
3413
|
super();
|
|
3311
3414
|
this.router = router;
|
|
3312
3415
|
this.placeRouter = placeRouter;
|
|
3313
|
-
this.parentOutlet = parentOutlet;
|
|
3314
3416
|
this.animate = true;
|
|
3315
3417
|
this.placeChanged = new EventEmitter();
|
|
3316
3418
|
this._activePlace = new MutableValueModel();
|
|
3419
|
+
this._placeVisit = new MutableValueModel();
|
|
3317
3420
|
this._inOutletUpdate = new Guard$1();
|
|
3318
3421
|
this._activatedRouteModel = new MutableValueModel();
|
|
3319
3422
|
this._placeDefinition = new MutableValueModel();
|
|
3320
|
-
|
|
3321
|
-
* TODO: This is now really a visit
|
|
3322
|
-
*/
|
|
3323
|
-
this._placeVisit = new MutableValueModel();
|
|
3423
|
+
this.isOnInitialPlace = true;
|
|
3324
3424
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
3425
|
+
this.parentOutletModel = new MutableValueModel(parentOutlet);
|
|
3426
|
+
/** @type {?} */
|
|
3427
|
+
const defaultPlaceAnimationOrder = chain(this.parentOutletModel)
|
|
3428
|
+
.pullValueModel((/**
|
|
3429
|
+
* @param {?} o
|
|
3430
|
+
* @return {?}
|
|
3431
|
+
*/
|
|
3432
|
+
o => o.activePlaceModel))
|
|
3433
|
+
.pluck("placeDefinition")
|
|
3434
|
+
.pluckList("children")
|
|
3435
|
+
.pluck("component");
|
|
3436
|
+
/** @type {?} */
|
|
3437
|
+
const activatePlaceType = chain(this.activePlaceModel).map((/**
|
|
3438
|
+
* @param {?} p
|
|
3439
|
+
* @return {?}
|
|
3440
|
+
*/
|
|
3441
|
+
p => (/** @type {?} */ (p.constructor))));
|
|
3442
|
+
this.placeAnimationOrder = chain(this.customPlaceAnimationOrderModel)
|
|
3443
|
+
.otherwise(defaultPlaceAnimationOrder)
|
|
3444
|
+
.indexOf(activatePlaceType)
|
|
3445
|
+
.map((/**
|
|
3446
|
+
* @param {?} order
|
|
3447
|
+
* @return {?}
|
|
3448
|
+
*/
|
|
3449
|
+
order => {
|
|
3450
|
+
// we get -1 on the first load which triggers an animation to the first page, so alway pin it to 0
|
|
3451
|
+
// if we're animating.
|
|
3452
|
+
return this.isOnInitialPlace ? 0 :
|
|
3453
|
+
this.animate ? Math.max(order, 0) : 0;
|
|
3454
|
+
}));
|
|
3325
3455
|
// Push incoming changes into the component
|
|
3326
3456
|
/** @type {?} */
|
|
3327
3457
|
const routeVisit = chain(this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
|
|
@@ -3377,6 +3507,12 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
3377
3507
|
relativeTo: this.parentOutlet ? this.parentOutlet.activatedRouteModel.value : null
|
|
3378
3508
|
});
|
|
3379
3509
|
}
|
|
3510
|
+
/**
|
|
3511
|
+
* @return {?}
|
|
3512
|
+
*/
|
|
3513
|
+
get parentOutlet() {
|
|
3514
|
+
return this.parentOutletModel.value;
|
|
3515
|
+
}
|
|
3380
3516
|
/**
|
|
3381
3517
|
* @param {?} next
|
|
3382
3518
|
* @param {?} previous
|
|
@@ -3399,6 +3535,7 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
3399
3535
|
get activatedRouteModel() {
|
|
3400
3536
|
return this._activatedRouteModel.readonly;
|
|
3401
3537
|
}
|
|
3538
|
+
// @Trace()
|
|
3402
3539
|
/**
|
|
3403
3540
|
* @param {?} routerOutlet
|
|
3404
3541
|
* @param {?} place
|
|
@@ -3424,6 +3561,7 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
3424
3561
|
this.animationDone();
|
|
3425
3562
|
}
|
|
3426
3563
|
}
|
|
3564
|
+
// @Trace()
|
|
3427
3565
|
/**
|
|
3428
3566
|
* @param {?} routerOutlet
|
|
3429
3567
|
* @param {?} $event
|
|
@@ -3434,18 +3572,12 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
3434
3572
|
* @return {?}
|
|
3435
3573
|
*/
|
|
3436
3574
|
() => {
|
|
3575
|
+
this.isOnInitialPlace = false;
|
|
3437
3576
|
this._activePlace.value = null;
|
|
3438
3577
|
this._activatedRouteModel.value = null;
|
|
3439
3578
|
this._placeDefinition.value = null;
|
|
3440
3579
|
}));
|
|
3441
3580
|
}
|
|
3442
|
-
/**
|
|
3443
|
-
* @param {?} outlet
|
|
3444
|
-
* @return {?}
|
|
3445
|
-
*/
|
|
3446
|
-
getPlaceOrder(outlet) {
|
|
3447
|
-
return this.animate && outlet && outlet.activatedRouteData && outlet.activatedRouteData['placeOrder'];
|
|
3448
|
-
}
|
|
3449
3581
|
/**
|
|
3450
3582
|
* @return {?}
|
|
3451
3583
|
*/
|
|
@@ -3457,8 +3589,8 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
3457
3589
|
}
|
|
3458
3590
|
PlaceOutletComponent.decorators = [
|
|
3459
3591
|
{ type: Component, args: [{
|
|
3460
|
-
selector: '
|
|
3461
|
-
template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"
|
|
3592
|
+
selector: 'aup-place-outlet',
|
|
3593
|
+
template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"placeAnimationOrder.value\"\n (@routeAnimations.done)=\"animationDone()\"\n>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated(routerOutlet, $event)\">\n </router-outlet>\n</div>\n\n",
|
|
3462
3594
|
animations: [LEFT_RIGHT_PLACE_ANIMATION],
|
|
3463
3595
|
styles: [":host{display:flex;flex-direction:column;min-height:0}.router-outlet-container{flex:1;display:block;position:relative;min-height:0}router-outlet{display:none}"]
|
|
3464
3596
|
}] }
|
|
@@ -3471,31 +3603,33 @@ PlaceOutletComponent.ctorParameters = () => [
|
|
|
3471
3603
|
];
|
|
3472
3604
|
PlaceOutletComponent.propDecorators = {
|
|
3473
3605
|
animate: [{ type: Input }],
|
|
3606
|
+
customPlaceAnimationOrderModel: [{ type: Input, args: ['placeAnimationOrderModel',] }],
|
|
3607
|
+
customPlaceAnimationOrder: [{ type: Input, args: ['placeAnimationOrder',] }],
|
|
3474
3608
|
placeChanged: [{ type: Output }],
|
|
3475
3609
|
routerOut: [{ type: ViewChild, args: ['routeOutlet', { static: true },] }]
|
|
3476
3610
|
};
|
|
3477
3611
|
__decorate([
|
|
3478
|
-
|
|
3479
|
-
__metadata("design:type",
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
__metadata("design:type", Function),
|
|
3486
|
-
__metadata("design:paramtypes", [RouterOutlet, PlaceComponent]),
|
|
3487
|
-
__metadata("design:returntype", void 0)
|
|
3488
|
-
], PlaceOutletComponent.prototype, "onOutletActivated", null);
|
|
3612
|
+
UseDelegate(),
|
|
3613
|
+
__metadata("design:type", ListModel)
|
|
3614
|
+
], PlaceOutletComponent.prototype, "customPlaceAnimationOrderModel", void 0);
|
|
3615
|
+
__decorate([
|
|
3616
|
+
StoreInListModel("customPlaceAnimationOrderModel"),
|
|
3617
|
+
__metadata("design:type", Array)
|
|
3618
|
+
], PlaceOutletComponent.prototype, "customPlaceAnimationOrder", void 0);
|
|
3489
3619
|
__decorate([
|
|
3490
3620
|
Trace(),
|
|
3491
3621
|
__metadata("design:type", Function),
|
|
3492
|
-
__metadata("design:paramtypes", [
|
|
3622
|
+
__metadata("design:paramtypes", [Visit]),
|
|
3493
3623
|
__metadata("design:returntype", void 0)
|
|
3494
|
-
], PlaceOutletComponent.prototype, "
|
|
3624
|
+
], PlaceOutletComponent.prototype, "navigate", null);
|
|
3495
3625
|
if (false) {
|
|
3496
3626
|
/** @type {?} */
|
|
3497
3627
|
PlaceOutletComponent.prototype.animate;
|
|
3498
3628
|
/** @type {?} */
|
|
3629
|
+
PlaceOutletComponent.prototype.customPlaceAnimationOrderModel;
|
|
3630
|
+
/** @type {?} */
|
|
3631
|
+
PlaceOutletComponent.prototype.customPlaceAnimationOrder;
|
|
3632
|
+
/** @type {?} */
|
|
3499
3633
|
PlaceOutletComponent.prototype.placeChanged;
|
|
3500
3634
|
/** @type {?} */
|
|
3501
3635
|
PlaceOutletComponent.prototype.routerOut;
|
|
@@ -3504,6 +3638,11 @@ if (false) {
|
|
|
3504
3638
|
* @private
|
|
3505
3639
|
*/
|
|
3506
3640
|
PlaceOutletComponent.prototype._activePlace;
|
|
3641
|
+
/**
|
|
3642
|
+
* @type {?}
|
|
3643
|
+
* @private
|
|
3644
|
+
*/
|
|
3645
|
+
PlaceOutletComponent.prototype._placeVisit;
|
|
3507
3646
|
/**
|
|
3508
3647
|
* @type {?}
|
|
3509
3648
|
* @private
|
|
@@ -3520,10 +3659,17 @@ if (false) {
|
|
|
3520
3659
|
*/
|
|
3521
3660
|
PlaceOutletComponent.prototype._placeDefinition;
|
|
3522
3661
|
/**
|
|
3523
|
-
* TODO: This is now really a visit
|
|
3524
3662
|
* @type {?}
|
|
3663
|
+
* @private
|
|
3525
3664
|
*/
|
|
3526
|
-
PlaceOutletComponent.prototype.
|
|
3665
|
+
PlaceOutletComponent.prototype.parentOutletModel;
|
|
3666
|
+
/** @type {?} */
|
|
3667
|
+
PlaceOutletComponent.prototype.placeAnimationOrder;
|
|
3668
|
+
/**
|
|
3669
|
+
* @type {?}
|
|
3670
|
+
* @private
|
|
3671
|
+
*/
|
|
3672
|
+
PlaceOutletComponent.prototype.isOnInitialPlace;
|
|
3527
3673
|
/**
|
|
3528
3674
|
* @type {?}
|
|
3529
3675
|
* @private
|
|
@@ -3534,8 +3680,153 @@ if (false) {
|
|
|
3534
3680
|
* @private
|
|
3535
3681
|
*/
|
|
3536
3682
|
PlaceOutletComponent.prototype.placeRouter;
|
|
3683
|
+
}
|
|
3684
|
+
|
|
3685
|
+
/**
|
|
3686
|
+
* @fileoverview added by tsickle
|
|
3687
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3688
|
+
*/
|
|
3689
|
+
class AbstractPlaceNavigationComponent extends DisposableComponent {
|
|
3690
|
+
constructor() {
|
|
3691
|
+
super();
|
|
3692
|
+
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
3693
|
+
this.placeDefinitions = chain(this.placesModel).map((/**
|
|
3694
|
+
* @param {?} c
|
|
3695
|
+
* @return {?}
|
|
3696
|
+
*/
|
|
3697
|
+
c => PlaceComponent.getDefinition(c)));
|
|
3698
|
+
this.relativeToModel = chain(this.placeOutletModel).pullValueModel((/**
|
|
3699
|
+
* @param {?} o
|
|
3700
|
+
* @return {?}
|
|
3701
|
+
*/
|
|
3702
|
+
o => o.activatedRouteModel));
|
|
3703
|
+
this.commandFactory = Command.createFactory((/**
|
|
3704
|
+
* @param {?} placeDefinition
|
|
3705
|
+
* @return {?}
|
|
3706
|
+
*/
|
|
3707
|
+
(placeDefinition) => {
|
|
3708
|
+
this.placeOutlet.navigate(new Visit(placeDefinition));
|
|
3709
|
+
}));
|
|
3710
|
+
}
|
|
3711
|
+
/**
|
|
3712
|
+
* @param {?} placeDef
|
|
3713
|
+
* @return {?}
|
|
3714
|
+
*/
|
|
3715
|
+
getNav(placeDef) {
|
|
3716
|
+
/** @type {?} */
|
|
3717
|
+
const navItem = (/** @type {?} */ (placeDef.getPlaceData('nav')));
|
|
3718
|
+
return {
|
|
3719
|
+
title: (/**
|
|
3720
|
+
* @return {?}
|
|
3721
|
+
*/
|
|
3722
|
+
() => navItem ? navItem.title() : placeDef.searchPlaceData(['navTitle', 'title'])),
|
|
3723
|
+
tooltip: (/**
|
|
3724
|
+
* @return {?}
|
|
3725
|
+
*/
|
|
3726
|
+
() => navItem && navItem.tooltip ? navItem.tooltip() : placeDef.getPlaceData('navTooltip', null)),
|
|
3727
|
+
icon: (/**
|
|
3728
|
+
* @return {?}
|
|
3729
|
+
*/
|
|
3730
|
+
() => navItem && navItem.icon ? navItem.icon() : placeDef.getPlaceData('navIcon', null))
|
|
3731
|
+
};
|
|
3732
|
+
}
|
|
3733
|
+
/**
|
|
3734
|
+
* @return {?}
|
|
3735
|
+
*/
|
|
3736
|
+
ngOnInit() {
|
|
3737
|
+
}
|
|
3738
|
+
}
|
|
3739
|
+
AbstractPlaceNavigationComponent.propDecorators = {
|
|
3740
|
+
places: [{ type: Input }],
|
|
3741
|
+
placesModel: [{ type: Input }],
|
|
3742
|
+
placeOutlet: [{ type: Input }],
|
|
3743
|
+
placeOutletModel: [{ type: Input }]
|
|
3744
|
+
};
|
|
3745
|
+
__decorate([
|
|
3746
|
+
StoreInListModel('placesModel'),
|
|
3747
|
+
__metadata("design:type", Array)
|
|
3748
|
+
], AbstractPlaceNavigationComponent.prototype, "places", void 0);
|
|
3749
|
+
__decorate([
|
|
3750
|
+
UseDelegate(),
|
|
3751
|
+
__metadata("design:type", ListModel)
|
|
3752
|
+
], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
|
|
3753
|
+
__decorate([
|
|
3754
|
+
StoreInValueModel('placeOutletModel'),
|
|
3755
|
+
__metadata("design:type", PlaceOutletComponent)
|
|
3756
|
+
], AbstractPlaceNavigationComponent.prototype, "placeOutlet", void 0);
|
|
3757
|
+
__decorate([
|
|
3758
|
+
UseDelegate(),
|
|
3759
|
+
__metadata("design:type", ValueModel)
|
|
3760
|
+
], AbstractPlaceNavigationComponent.prototype, "placeOutletModel", void 0);
|
|
3761
|
+
__decorate([
|
|
3762
|
+
Memoize(),
|
|
3763
|
+
__metadata("design:type", Function),
|
|
3764
|
+
__metadata("design:paramtypes", [PlaceDefinition]),
|
|
3765
|
+
__metadata("design:returntype", Object)
|
|
3766
|
+
], AbstractPlaceNavigationComponent.prototype, "getNav", null);
|
|
3767
|
+
if (false) {
|
|
3768
|
+
/** @type {?} */
|
|
3769
|
+
AbstractPlaceNavigationComponent.prototype.places;
|
|
3770
|
+
/** @type {?} */
|
|
3771
|
+
AbstractPlaceNavigationComponent.prototype.placesModel;
|
|
3772
|
+
/** @type {?} */
|
|
3773
|
+
AbstractPlaceNavigationComponent.prototype.placeOutlet;
|
|
3774
|
+
/** @type {?} */
|
|
3775
|
+
AbstractPlaceNavigationComponent.prototype.placeOutletModel;
|
|
3776
|
+
/** @type {?} */
|
|
3777
|
+
AbstractPlaceNavigationComponent.prototype.placeDefinitions;
|
|
3778
|
+
/**
|
|
3779
|
+
* @type {?}
|
|
3780
|
+
* @protected
|
|
3781
|
+
*/
|
|
3782
|
+
AbstractPlaceNavigationComponent.prototype.relativeToModel;
|
|
3783
|
+
/** @type {?} */
|
|
3784
|
+
AbstractPlaceNavigationComponent.prototype.commandFactory;
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3787
|
+
/**
|
|
3788
|
+
* @fileoverview added by tsickle
|
|
3789
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3790
|
+
*/
|
|
3791
|
+
class ListPlaceNavComponent extends AbstractPlaceNavigationComponent {
|
|
3792
|
+
constructor() {
|
|
3793
|
+
super();
|
|
3794
|
+
this.expanded = true;
|
|
3795
|
+
}
|
|
3796
|
+
/**
|
|
3797
|
+
* @return {?}
|
|
3798
|
+
*/
|
|
3799
|
+
expandMenu() {
|
|
3800
|
+
this.expanded = true;
|
|
3801
|
+
}
|
|
3802
|
+
/**
|
|
3803
|
+
* @return {?}
|
|
3804
|
+
*/
|
|
3805
|
+
collapseMenu() {
|
|
3806
|
+
this.expanded = false;
|
|
3807
|
+
}
|
|
3808
|
+
/**
|
|
3809
|
+
* @return {?}
|
|
3810
|
+
*/
|
|
3811
|
+
toggleMenu() {
|
|
3812
|
+
this.expanded = !this.expanded;
|
|
3813
|
+
}
|
|
3814
|
+
}
|
|
3815
|
+
ListPlaceNavComponent.decorators = [
|
|
3816
|
+
{ type: Component, args: [{
|
|
3817
|
+
selector: 'aup-list-place-nav',
|
|
3818
|
+
template: "<mat-nav-list class=\"app-menu\">\n <a mat-list-item *ngFor=\"let place of placeDefinitions.value\"\n [pectinCommand]=\"commandFactory.create(place)\"\n routerLinkActive #rla=\"routerLinkActive\"\n [matTooltip]=\"getNav(place).tooltip()\">\n <mat-icon *ngIf=\"getNav(place).icon()\">{{getNav(place).icon()}}</mat-icon>\n <span class=\"expanded-only\">{{getNav(place).title()}}</span>\n </a>\n</mat-nav-list>\n",
|
|
3819
|
+
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}"]
|
|
3820
|
+
}] }
|
|
3821
|
+
];
|
|
3822
|
+
/** @nocollapse */
|
|
3823
|
+
ListPlaceNavComponent.ctorParameters = () => [];
|
|
3824
|
+
ListPlaceNavComponent.propDecorators = {
|
|
3825
|
+
expanded: [{ type: HostBinding, args: ['class.expanded',] }]
|
|
3826
|
+
};
|
|
3827
|
+
if (false) {
|
|
3537
3828
|
/** @type {?} */
|
|
3538
|
-
|
|
3829
|
+
ListPlaceNavComponent.prototype.expanded;
|
|
3539
3830
|
}
|
|
3540
3831
|
|
|
3541
3832
|
/**
|
|
@@ -3549,8 +3840,8 @@ class TabbedPlaceNavigationComponent extends AbstractPlaceNavigationComponent {
|
|
|
3549
3840
|
}
|
|
3550
3841
|
TabbedPlaceNavigationComponent.decorators = [
|
|
3551
3842
|
{ type: Component, args: [{
|
|
3552
|
-
selector: '
|
|
3553
|
-
template: "<nav mat-tab-nav-bar>\n <a mat-tab-link *ngFor=\"let place of placeDefinitions.value\"\n [
|
|
3843
|
+
selector: 'aup-tabbed-place-navigation',
|
|
3844
|
+
template: "<nav mat-tab-nav-bar>\n <a mat-tab-link *ngFor=\"let place of placeDefinitions.value\"\n [pectinCommand]=\"commandFactory.create(place)\"\n routerLinkActive #rla=\"routerLinkActive\"\n [active]=\"rla.isActive\"\n [matTooltip]=\"getNav(place).tooltip()\">\n <mat-icon *ngIf=\"getNav(place).icon()\">{{getNav(place).icon()}}</mat-icon>\n <span>{{getNav(place).title()}}</span>\n </a>\n</nav>\n",
|
|
3554
3845
|
styles: [""]
|
|
3555
3846
|
}] }
|
|
3556
3847
|
];
|
|
@@ -3570,10 +3861,11 @@ PlaceModule.decorators = [
|
|
|
3570
3861
|
BrowserAnimationsModule,
|
|
3571
3862
|
MatProgressSpinnerModule,
|
|
3572
3863
|
RouterModule,
|
|
3573
|
-
MatTabsModule
|
|
3864
|
+
MatTabsModule,
|
|
3574
3865
|
MatListModule,
|
|
3575
3866
|
MatTooltipModule,
|
|
3576
|
-
MatIconModule
|
|
3867
|
+
MatIconModule,
|
|
3868
|
+
DirectivesModule
|
|
3577
3869
|
],
|
|
3578
3870
|
declarations: [
|
|
3579
3871
|
EmptyStateComponent,
|
|
@@ -3602,15 +3894,7 @@ class AngularUiPowerupsModule {
|
|
|
3602
3894
|
}
|
|
3603
3895
|
AngularUiPowerupsModule.decorators = [
|
|
3604
3896
|
{ type: NgModule, args: [{
|
|
3605
|
-
declarations: [
|
|
3606
|
-
CommandDirective,
|
|
3607
|
-
FocusBindingDirective,
|
|
3608
|
-
NumberInputComponent,
|
|
3609
|
-
StringInputComponent,
|
|
3610
|
-
PasswordInputComponent,
|
|
3611
|
-
SelectInputComponent,
|
|
3612
|
-
NoopComponent
|
|
3613
|
-
],
|
|
3897
|
+
declarations: [],
|
|
3614
3898
|
imports: [
|
|
3615
3899
|
CommonModule,
|
|
3616
3900
|
BrowserAnimationsModule,
|
|
@@ -3618,19 +3902,17 @@ AngularUiPowerupsModule.decorators = [
|
|
|
3618
3902
|
MatInputModule,
|
|
3619
3903
|
MatFormFieldModule,
|
|
3620
3904
|
MatSelectModule,
|
|
3621
|
-
MatTabsModule
|
|
3905
|
+
MatTabsModule,
|
|
3906
|
+
DirectivesModule,
|
|
3907
|
+
ComponentsModule,
|
|
3622
3908
|
PlaceModule,
|
|
3623
3909
|
InteractionModule
|
|
3624
3910
|
],
|
|
3625
3911
|
exports: [
|
|
3626
|
-
CommandDirective,
|
|
3627
|
-
FocusBindingDirective,
|
|
3628
|
-
NumberInputComponent,
|
|
3629
|
-
StringInputComponent,
|
|
3630
|
-
PasswordInputComponent,
|
|
3631
|
-
SelectInputComponent,
|
|
3632
3912
|
InteractionModule,
|
|
3633
3913
|
PlaceModule,
|
|
3914
|
+
DirectivesModule,
|
|
3915
|
+
ComponentsModule,
|
|
3634
3916
|
NoopComponent
|
|
3635
3917
|
]
|
|
3636
3918
|
},] }
|
|
@@ -4086,7 +4368,7 @@ function Place(options) {
|
|
|
4086
4368
|
*/
|
|
4087
4369
|
(target) => {
|
|
4088
4370
|
if (PlaceComponent.isPlaceComponentConstructor(target)) {
|
|
4089
|
-
PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, isNil(options.authenticate) ? false : options.authenticate, options.
|
|
4371
|
+
PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, isNil(options.authenticate) ? false : options.authenticate, options.data, PlaceComponent.getRouteParameters(target), (options.children || []).map((/**
|
|
4090
4372
|
* @param {?} c
|
|
4091
4373
|
* @return {?}
|
|
4092
4374
|
*/
|
|
@@ -4106,8 +4388,6 @@ function Place(options) {
|
|
|
4106
4388
|
if (false) {
|
|
4107
4389
|
/** @type {?} */
|
|
4108
4390
|
Options.prototype.path;
|
|
4109
|
-
/** @type {?} */
|
|
4110
|
-
Options.prototype.order;
|
|
4111
4391
|
/** @type {?|undefined} */
|
|
4112
4392
|
Options.prototype.data;
|
|
4113
4393
|
/** @type {?|undefined} */
|
|
@@ -4382,252 +4662,72 @@ class VisitSanitiser {
|
|
|
4382
4662
|
console.log({ routeId, sanitisedValue });
|
|
4383
4663
|
// ###------- EARLY EXIT --------###
|
|
4384
4664
|
if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
|
|
4385
|
-
// if the route id has changed we redirect immediately as other
|
|
4386
|
-
// parameter sanitisers might use it.
|
|
4387
|
-
return visit.replace(routeIdDef, sanitisedValue);
|
|
4388
|
-
}
|
|
4389
|
-
}
|
|
4390
|
-
// if we didn't replace the routeId we continue the url present parameters.
|
|
4391
|
-
/** @type {?} */
|
|
4392
|
-
const parameterDefs = placeDef.getVisitParameterDefs({
|
|
4393
|
-
includeRouteParameters: true,
|
|
4394
|
-
includeNonRouteParameters: true
|
|
4395
|
-
});
|
|
4396
|
-
/** @type {?} */
|
|
4397
|
-
let sanitisedVisit = visit;
|
|
4398
|
-
for (let i = 0; i < parameterDefs.length; i++) {
|
|
4399
|
-
/** @type {?} */
|
|
4400
|
-
const def = parameterDefs[i];
|
|
4401
|
-
/** @type {?} */
|
|
4402
|
-
const value = visit.getParameter(def.name);
|
|
4403
|
-
/** @type {?} */
|
|
4404
|
-
const sanitisedValue = yield def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector);
|
|
4405
|
-
if (def.hasChanged(value, sanitisedValue)) {
|
|
4406
|
-
sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
|
|
4407
|
-
}
|
|
4408
|
-
}
|
|
4409
|
-
return sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit;
|
|
4410
|
-
});
|
|
4411
|
-
}
|
|
4412
|
-
}
|
|
4413
|
-
if (false) {
|
|
4414
|
-
/**
|
|
4415
|
-
* @type {?}
|
|
4416
|
-
* @private
|
|
4417
|
-
*/
|
|
4418
|
-
VisitSanitiser.prototype.activatedRoute;
|
|
4419
|
-
/**
|
|
4420
|
-
* @type {?}
|
|
4421
|
-
* @private
|
|
4422
|
-
*/
|
|
4423
|
-
VisitSanitiser.prototype.router;
|
|
4424
|
-
/**
|
|
4425
|
-
* @type {?}
|
|
4426
|
-
* @private
|
|
4427
|
-
*/
|
|
4428
|
-
VisitSanitiser.prototype.placeHistory;
|
|
4429
|
-
/**
|
|
4430
|
-
* @type {?}
|
|
4431
|
-
* @private
|
|
4432
|
-
*/
|
|
4433
|
-
VisitSanitiser.prototype.injector;
|
|
4434
|
-
}
|
|
4435
|
-
|
|
4436
|
-
/**
|
|
4437
|
-
* @fileoverview added by tsickle
|
|
4438
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4439
|
-
*/
|
|
4440
|
-
class LeavePlaceGuard {
|
|
4441
|
-
/**
|
|
4442
|
-
* @param {?} router
|
|
4443
|
-
* @param {?} injector
|
|
4444
|
-
* @param {?} placeRouter
|
|
4445
|
-
* @param {?} interactionContext
|
|
4446
|
-
* @param {?} angularLocation
|
|
4447
|
-
*/
|
|
4448
|
-
constructor(router, injector, placeRouter, interactionContext, angularLocation) {
|
|
4449
|
-
this.router = router;
|
|
4450
|
-
this.injector = injector;
|
|
4451
|
-
this.placeRouter = placeRouter;
|
|
4452
|
-
this.interactionContext = interactionContext;
|
|
4453
|
-
this.angularLocation = angularLocation;
|
|
4454
|
-
}
|
|
4455
|
-
/**
|
|
4456
|
-
* @private
|
|
4457
|
-
* @param {?} nextState
|
|
4458
|
-
* @param {?} placeDefinitionPath
|
|
4459
|
-
* @return {?}
|
|
4460
|
-
*/
|
|
4461
|
-
isLeavingTheCurrentPlace(nextState, placeDefinitionPath) {
|
|
4462
|
-
// TODO: this will break with child routes... need to examine the router states properly.
|
|
4463
|
-
return !nextState.url.startsWith(placeDefinitionPath);
|
|
4464
|
-
}
|
|
4465
|
-
/**
|
|
4466
|
-
* @param {?} component
|
|
4467
|
-
* @param {?} currentRoute
|
|
4468
|
-
* @param {?} currentState
|
|
4469
|
-
* @param {?=} nextState
|
|
4470
|
-
* @return {?}
|
|
4471
|
-
*/
|
|
4472
|
-
canDeactivate(component, currentRoute, currentState, nextState) {
|
|
4473
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4474
|
-
/** @type {?} */
|
|
4475
|
-
const placeDefinitionPath = `/${component.placeDefinition.path}`;
|
|
4476
|
-
// console.log('canDeactivate', {
|
|
4477
|
-
// staticPath: placeDefinitionPath,
|
|
4478
|
-
// currentStateUrl: currentState.url,
|
|
4479
|
-
// nextStateUrl: nextState.url
|
|
4480
|
-
// // alreadyDeclined: this._alreadyAccepted
|
|
4481
|
-
// });
|
|
4482
|
-
// Example of the above when navigating to a different child route.
|
|
4483
|
-
// canDeactivate {staticPath: "/hero-details",
|
|
4484
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-details",
|
|
4485
|
-
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats"
|
|
4486
|
-
// }
|
|
4487
|
-
// Example clicking on router tab of the parent component (de-activates the parent due to route param changes)
|
|
4488
|
-
// canDeactivate {
|
|
4489
|
-
// staticPath: "/hero-stats",
|
|
4490
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4491
|
-
// nextStateUrl: "/route-parameters/"
|
|
4492
|
-
// }
|
|
4493
|
-
// canDeactivate {
|
|
4494
|
-
// staticPath: "/route-parameters",
|
|
4495
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4496
|
-
// nextStateUrl: "/route-parameters/"
|
|
4497
|
-
// }
|
|
4498
|
-
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: undefined, dl: Array(0), …}
|
|
4499
|
-
// parameter-snapshot.ts:20 {name: "idModel", mine: -1, theirs: null}
|
|
4500
|
-
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
4501
|
-
// canDeactivate {
|
|
4502
|
-
// staticPath: "/hero-stats",
|
|
4503
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4504
|
-
// nextStateUrl: "/route-parameters/-1"
|
|
4505
|
-
// }
|
|
4506
|
-
// canDeactivate {
|
|
4507
|
-
// staticPath: "/route-parameters",
|
|
4508
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4509
|
-
// nextStateUrl: "/route-parameters/-1"
|
|
4510
|
-
// }
|
|
4511
|
-
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: "A", dl: Array(3), …}
|
|
4512
|
-
// parameter-snapshot.ts:20 {name: "dv", mine: "A", theirs: undefined}
|
|
4513
|
-
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
4514
|
-
// canDeactivate {
|
|
4515
|
-
// staticPath: "/hero-stats",
|
|
4516
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4517
|
-
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c"
|
|
4518
|
-
// }
|
|
4519
|
-
// TODO: Add tests
|
|
4520
|
-
if (this.placeRouter.navigationSession.alreadyAccepted(component)) {
|
|
4521
|
-
// We'll get called multiple times if there's any parameter sanitisation so
|
|
4522
|
-
// we always return true if we accepted on a previous cycle of the current
|
|
4523
|
-
// navigation session.
|
|
4524
|
-
return true;
|
|
4665
|
+
// if the route id has changed we redirect immediately as other
|
|
4666
|
+
// parameter sanitisers might use it.
|
|
4667
|
+
return visit.replace(routeIdDef, sanitisedValue);
|
|
4668
|
+
}
|
|
4525
4669
|
}
|
|
4526
|
-
|
|
4670
|
+
// if we didn't replace the routeId we continue the url present parameters.
|
|
4671
|
+
/** @type {?} */
|
|
4672
|
+
const parameterDefs = placeDef.getVisitParameterDefs({
|
|
4673
|
+
includeRouteParameters: true,
|
|
4674
|
+
includeNonRouteParameters: true
|
|
4675
|
+
});
|
|
4676
|
+
/** @type {?} */
|
|
4677
|
+
let sanitisedVisit = visit;
|
|
4678
|
+
for (let i = 0; i < parameterDefs.length; i++) {
|
|
4527
4679
|
/** @type {?} */
|
|
4528
|
-
const
|
|
4680
|
+
const def = parameterDefs[i];
|
|
4529
4681
|
/** @type {?} */
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
if (this.interactionContext.isActive()) {
|
|
4536
|
-
canLeave = false;
|
|
4537
|
-
console.log('cancelling', { activity: this.interactionContext.currentActivity });
|
|
4538
|
-
this.interactionContext.currentActivity.cancel(null);
|
|
4539
|
-
}
|
|
4540
|
-
// No interaction in progress, so ask the component .
|
|
4541
|
-
// This may start an interaction, hence checking the interaction context above. I.e. if the place pops up the dialog, and
|
|
4542
|
-
// the user clicks back again, we'll re-enter here and go bang when the component tries to open another
|
|
4543
|
-
// dialog.
|
|
4544
|
-
if (canLeave) {
|
|
4545
|
-
// TODO: Add tests: hit back -> confirm leave dialog -> hit back -> close dialog -> hit back -> confirm leave dialog.
|
|
4546
|
-
canLeave = yield component.canDeactivate();
|
|
4547
|
-
}
|
|
4548
|
-
// We also block back button parameter changes while the dialog is open.
|
|
4549
|
-
// NOTE: Now that I'm catching parameter changes I could possibly retry using a fragment or
|
|
4550
|
-
// query parameter to track the dialog being open. Previously I was just checking this on
|
|
4551
|
-
// path changes... if that worked it'd fix the case where the back button breaks with an activity
|
|
4552
|
-
// open on the first page: https://coolon.atlassian.net/browse/AUP-33
|
|
4553
|
-
}
|
|
4554
|
-
else {
|
|
4555
|
-
if (this.interactionContext.isActive()) {
|
|
4556
|
-
console.log('cancelling', { activity: this.interactionContext.currentActivity });
|
|
4557
|
-
this.interactionContext.currentActivity.cancel(null);
|
|
4558
|
-
canLeave = false;
|
|
4559
|
-
}
|
|
4560
|
-
else {
|
|
4561
|
-
canLeave = true;
|
|
4562
|
-
}
|
|
4563
|
-
}
|
|
4564
|
-
if (canLeave) {
|
|
4565
|
-
// We'll get called multiple times if there's any parameter sanitisation so
|
|
4566
|
-
// we remember the acceptance for the duration of the current navigation session.
|
|
4567
|
-
self.placeRouter.navigationSession.rememberAcceptanceOf(component);
|
|
4568
|
-
}
|
|
4569
|
-
else {
|
|
4570
|
-
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
4571
|
-
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4572
|
-
if (this.placeRouter.navigationSession.isPopState) {
|
|
4573
|
-
console.log('cancelled during popstate');
|
|
4574
|
-
this.angularLocation.go(this.placeRouter.navigationSession.popStateReturnUrl);
|
|
4575
|
-
}
|
|
4682
|
+
const value = visit.getParameter(def.name);
|
|
4683
|
+
/** @type {?} */
|
|
4684
|
+
const sanitisedValue = yield def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector);
|
|
4685
|
+
if (def.hasChanged(value, sanitisedValue)) {
|
|
4686
|
+
sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
|
|
4576
4687
|
}
|
|
4577
|
-
return canLeave;
|
|
4578
4688
|
}
|
|
4689
|
+
return sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit;
|
|
4579
4690
|
});
|
|
4580
4691
|
}
|
|
4581
4692
|
}
|
|
4582
|
-
LeavePlaceGuard.decorators = [
|
|
4583
|
-
{ type: Injectable, args: [{
|
|
4584
|
-
providedIn: 'root'
|
|
4585
|
-
},] }
|
|
4586
|
-
];
|
|
4587
|
-
/** @nocollapse */
|
|
4588
|
-
LeavePlaceGuard.ctorParameters = () => [
|
|
4589
|
-
{ type: Router },
|
|
4590
|
-
{ type: Injector },
|
|
4591
|
-
{ type: PlaceRouter },
|
|
4592
|
-
{ type: InteractionContext },
|
|
4593
|
-
{ type: Location }
|
|
4594
|
-
];
|
|
4595
|
-
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(PlaceRouter), ɵɵinject(InteractionContext), ɵɵinject(Location)); }, token: LeavePlaceGuard, providedIn: "root" });
|
|
4596
4693
|
if (false) {
|
|
4597
4694
|
/**
|
|
4598
4695
|
* @type {?}
|
|
4599
4696
|
* @private
|
|
4600
4697
|
*/
|
|
4601
|
-
|
|
4698
|
+
VisitSanitiser.prototype.activatedRoute;
|
|
4602
4699
|
/**
|
|
4603
4700
|
* @type {?}
|
|
4604
4701
|
* @private
|
|
4605
4702
|
*/
|
|
4606
|
-
|
|
4703
|
+
VisitSanitiser.prototype.router;
|
|
4607
4704
|
/**
|
|
4608
4705
|
* @type {?}
|
|
4609
4706
|
* @private
|
|
4610
4707
|
*/
|
|
4611
|
-
|
|
4612
|
-
/**
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4708
|
+
VisitSanitiser.prototype.placeHistory;
|
|
4709
|
+
/**
|
|
4710
|
+
* @type {?}
|
|
4711
|
+
* @private
|
|
4712
|
+
*/
|
|
4713
|
+
VisitSanitiser.prototype.injector;
|
|
4616
4714
|
}
|
|
4617
4715
|
|
|
4618
4716
|
/**
|
|
4619
4717
|
* @fileoverview added by tsickle
|
|
4620
4718
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4621
4719
|
*/
|
|
4622
|
-
class
|
|
4720
|
+
class EnterPlaceGuard {
|
|
4623
4721
|
/**
|
|
4624
4722
|
* @param {?} router
|
|
4723
|
+
* @param {?} urlSerializer
|
|
4625
4724
|
* @param {?} placeRouter
|
|
4626
4725
|
* @param {?} placeHistory
|
|
4627
4726
|
* @param {?} injector
|
|
4628
4727
|
*/
|
|
4629
|
-
constructor(router, placeRouter, placeHistory, injector) {
|
|
4728
|
+
constructor(router, urlSerializer, placeRouter, placeHistory, injector) {
|
|
4630
4729
|
this.router = router;
|
|
4730
|
+
this.urlSerializer = urlSerializer;
|
|
4631
4731
|
this.placeRouter = placeRouter;
|
|
4632
4732
|
this.placeHistory = placeHistory;
|
|
4633
4733
|
this.injector = injector;
|
|
@@ -4645,7 +4745,7 @@ class PlaceRouteGuard {
|
|
|
4645
4745
|
const placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);
|
|
4646
4746
|
// Parse our route params.
|
|
4647
4747
|
/** @type {?} */
|
|
4648
|
-
const params = new
|
|
4748
|
+
const params = new EnterPlaceGuard.ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
|
|
4649
4749
|
/** @type {?} */
|
|
4650
4750
|
const parsedParams = placeDefinition.parseRouteParams(params);
|
|
4651
4751
|
/** @type {?} */
|
|
@@ -4658,12 +4758,10 @@ class PlaceRouteGuard {
|
|
|
4658
4758
|
this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
|
|
4659
4759
|
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
4660
4760
|
/** @type {?} */
|
|
4661
|
-
const
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
const commands = [(activatedRoute.url[0].path)].concat(parameterCommands, this.placeRouter.extractChildPath(activatedRoute));
|
|
4666
|
-
console.log('##### Redirect', commands);
|
|
4761
|
+
const routerStateUrlTree = this.urlSerializer.parse(state.url);
|
|
4762
|
+
// Regenerate the url
|
|
4763
|
+
const { commands } = this.createRedirectCommands(sanitisedVisit, [...routerStateUrlTree.root.children.primary.segments]);
|
|
4764
|
+
console.log('##### Place Guard Redirect', commands);
|
|
4667
4765
|
return this.router.createUrlTree(commands, {
|
|
4668
4766
|
replaceUrl: true,
|
|
4669
4767
|
skipLocationChange: false
|
|
@@ -4678,43 +4776,83 @@ class PlaceRouteGuard {
|
|
|
4678
4776
|
}
|
|
4679
4777
|
});
|
|
4680
4778
|
}
|
|
4779
|
+
/**
|
|
4780
|
+
* @private
|
|
4781
|
+
* @param {?} sanitisedVisit
|
|
4782
|
+
* @param {?} path
|
|
4783
|
+
* @return {?}
|
|
4784
|
+
*/
|
|
4785
|
+
createRedirectCommands(sanitisedVisit, path) {
|
|
4786
|
+
// Ugly, but it works for now.
|
|
4787
|
+
/** @type {?} */
|
|
4788
|
+
const newSegments = sanitisedVisit.getUrlSegments();
|
|
4789
|
+
/** @type {?} */
|
|
4790
|
+
const replaceAt = path.findIndex((/**
|
|
4791
|
+
* @param {?} segment
|
|
4792
|
+
* @return {?}
|
|
4793
|
+
*/
|
|
4794
|
+
segment => segment.path === newSegments[0].path));
|
|
4795
|
+
/** @type {?} */
|
|
4796
|
+
const newPath = [...path];
|
|
4797
|
+
newPath.splice(replaceAt, newSegments.length, ...newSegments); // do not use the return value, it's the items that were removed!
|
|
4798
|
+
// do not use the return value, it's the items that were removed!
|
|
4799
|
+
/** @type {?} */
|
|
4800
|
+
const commands = [];
|
|
4801
|
+
newPath.forEach((/**
|
|
4802
|
+
* @param {?} s
|
|
4803
|
+
* @return {?}
|
|
4804
|
+
*/
|
|
4805
|
+
s => {
|
|
4806
|
+
commands.push(s.path);
|
|
4807
|
+
if (s.parameterMap.keys.length > 0) {
|
|
4808
|
+
commands.push(s.parameters);
|
|
4809
|
+
}
|
|
4810
|
+
}));
|
|
4811
|
+
return { newPath, commands };
|
|
4812
|
+
}
|
|
4681
4813
|
}
|
|
4682
|
-
|
|
4814
|
+
EnterPlaceGuard.decorators = [
|
|
4683
4815
|
{ type: Injectable, args: [{
|
|
4684
4816
|
providedIn: 'root'
|
|
4685
4817
|
},] }
|
|
4686
4818
|
];
|
|
4687
4819
|
/** @nocollapse */
|
|
4688
|
-
|
|
4820
|
+
EnterPlaceGuard.ctorParameters = () => [
|
|
4689
4821
|
{ type: Router },
|
|
4822
|
+
{ type: UrlSerializer },
|
|
4690
4823
|
{ type: PlaceRouter },
|
|
4691
4824
|
{ type: PlaceHistory },
|
|
4692
4825
|
{ type: Injector }
|
|
4693
4826
|
];
|
|
4694
|
-
/** @nocollapse */
|
|
4827
|
+
/** @nocollapse */ EnterPlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function EnterPlaceGuard_Factory() { return new EnterPlaceGuard(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(PlaceRouter), ɵɵinject(PlaceHistory), ɵɵinject(INJECTOR)); }, token: EnterPlaceGuard, providedIn: "root" });
|
|
4695
4828
|
if (false) {
|
|
4696
4829
|
/**
|
|
4697
4830
|
* @type {?}
|
|
4698
4831
|
* @private
|
|
4699
4832
|
*/
|
|
4700
|
-
|
|
4833
|
+
EnterPlaceGuard.prototype.router;
|
|
4834
|
+
/**
|
|
4835
|
+
* @type {?}
|
|
4836
|
+
* @private
|
|
4837
|
+
*/
|
|
4838
|
+
EnterPlaceGuard.prototype.urlSerializer;
|
|
4701
4839
|
/**
|
|
4702
4840
|
* @type {?}
|
|
4703
4841
|
* @private
|
|
4704
4842
|
*/
|
|
4705
|
-
|
|
4843
|
+
EnterPlaceGuard.prototype.placeRouter;
|
|
4706
4844
|
/**
|
|
4707
4845
|
* @type {?}
|
|
4708
4846
|
* @private
|
|
4709
4847
|
*/
|
|
4710
|
-
|
|
4848
|
+
EnterPlaceGuard.prototype.placeHistory;
|
|
4711
4849
|
/**
|
|
4712
4850
|
* @type {?}
|
|
4713
4851
|
* @private
|
|
4714
4852
|
*/
|
|
4715
|
-
|
|
4853
|
+
EnterPlaceGuard.prototype.injector;
|
|
4716
4854
|
}
|
|
4717
|
-
(function (
|
|
4855
|
+
(function (EnterPlaceGuard) {
|
|
4718
4856
|
/**
|
|
4719
4857
|
* This a work around for the fact that an activated route with multiple segments doesn't
|
|
4720
4858
|
* include the segment params in the paramMap as well as each segment returns an empty
|
|
@@ -4790,7 +4928,7 @@ if (false) {
|
|
|
4790
4928
|
__metadata("design:type", Array),
|
|
4791
4929
|
__metadata("design:paramtypes", [])
|
|
4792
4930
|
], ConsolidatedParameterMap.prototype, "keys", null);
|
|
4793
|
-
|
|
4931
|
+
EnterPlaceGuard.ConsolidatedParameterMap = ConsolidatedParameterMap;
|
|
4794
4932
|
if (false) {
|
|
4795
4933
|
/**
|
|
4796
4934
|
* @type {?}
|
|
@@ -4842,7 +4980,207 @@ if (false) {
|
|
|
4842
4980
|
*/
|
|
4843
4981
|
ParamMapAdapter.prototype.params;
|
|
4844
4982
|
}
|
|
4845
|
-
})(
|
|
4983
|
+
})(EnterPlaceGuard || (EnterPlaceGuard = {}));
|
|
4984
|
+
|
|
4985
|
+
/**
|
|
4986
|
+
* @fileoverview added by tsickle
|
|
4987
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4988
|
+
*/
|
|
4989
|
+
class LeavePlaceGuard {
|
|
4990
|
+
/**
|
|
4991
|
+
* @param {?} router
|
|
4992
|
+
* @param {?} injector
|
|
4993
|
+
* @param {?} placeRouter
|
|
4994
|
+
* @param {?} interactionContext
|
|
4995
|
+
* @param {?} angularLocation
|
|
4996
|
+
*/
|
|
4997
|
+
constructor(router, injector, placeRouter, interactionContext, angularLocation) {
|
|
4998
|
+
this.router = router;
|
|
4999
|
+
this.injector = injector;
|
|
5000
|
+
this.placeRouter = placeRouter;
|
|
5001
|
+
this.interactionContext = interactionContext;
|
|
5002
|
+
this.angularLocation = angularLocation;
|
|
5003
|
+
}
|
|
5004
|
+
/**
|
|
5005
|
+
* @private
|
|
5006
|
+
* @param {?} nextState
|
|
5007
|
+
* @param {?} placeDefinition
|
|
5008
|
+
* @return {?}
|
|
5009
|
+
*/
|
|
5010
|
+
isLeavingTheCurrentPlace(nextState, placeDefinition) {
|
|
5011
|
+
// TODO: this will break with child routes... need to examine the router states properly.
|
|
5012
|
+
// console.log('canDeactivate', {
|
|
5013
|
+
// staticPath: placeDefinitionPath,
|
|
5014
|
+
// currentStateUrl: currentState.url,
|
|
5015
|
+
// nextStateUrl: nextState.url
|
|
5016
|
+
// // alreadyDeclined: this._alreadyAccepted
|
|
5017
|
+
// });
|
|
5018
|
+
// Example of the above when navigating to a different child route.
|
|
5019
|
+
// canDeactivate {staticPath: "/hero-details",
|
|
5020
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-details",
|
|
5021
|
+
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats"
|
|
5022
|
+
// }
|
|
5023
|
+
// TODO: this will break with child routes... need to examine the router states properly.
|
|
5024
|
+
// console.log('canDeactivate', {
|
|
5025
|
+
// staticPath: placeDefinitionPath,
|
|
5026
|
+
// currentStateUrl: currentState.url,
|
|
5027
|
+
// nextStateUrl: nextState.url
|
|
5028
|
+
// // alreadyDeclined: this._alreadyAccepted
|
|
5029
|
+
// });
|
|
5030
|
+
// Example of the above when navigating to a different child route.
|
|
5031
|
+
// canDeactivate {staticPath: "/hero-details",
|
|
5032
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-details",
|
|
5033
|
+
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats"
|
|
5034
|
+
// }
|
|
5035
|
+
// Example clicking on router tab of the parent component (de-activates the parent due to route param changes)
|
|
5036
|
+
// canDeactivate {
|
|
5037
|
+
// staticPath: "/hero-stats",
|
|
5038
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
5039
|
+
// nextStateUrl: "/route-parameters/"
|
|
5040
|
+
// }
|
|
5041
|
+
// canDeactivate {
|
|
5042
|
+
// staticPath: "/route-parameters",
|
|
5043
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
5044
|
+
// nextStateUrl: "/route-parameters/"
|
|
5045
|
+
// }
|
|
5046
|
+
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: undefined, dl: Array(0), …}
|
|
5047
|
+
// parameter-snapshot.ts:20 {name: "idModel", mine: -1, theirs: null}
|
|
5048
|
+
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
5049
|
+
// canDeactivate {
|
|
5050
|
+
// staticPath: "/hero-stats",
|
|
5051
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
5052
|
+
// nextStateUrl: "/route-parameters/-1"
|
|
5053
|
+
// }
|
|
5054
|
+
// canDeactivate {
|
|
5055
|
+
// staticPath: "/route-parameters",
|
|
5056
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
5057
|
+
// nextStateUrl: "/route-parameters/-1"
|
|
5058
|
+
// }
|
|
5059
|
+
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: "A", dl: Array(3), …}
|
|
5060
|
+
// parameter-snapshot.ts:20 {name: "dv", mine: "A", theirs: undefined}
|
|
5061
|
+
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
5062
|
+
// canDeactivate {
|
|
5063
|
+
// staticPath: "/hero-stats",
|
|
5064
|
+
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
5065
|
+
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c"
|
|
5066
|
+
// }
|
|
5067
|
+
/** @type {?} */
|
|
5068
|
+
const placeDefinitionPath = `/${placeDefinition.path}`;
|
|
5069
|
+
return !nextState.url.startsWith(placeDefinitionPath);
|
|
5070
|
+
}
|
|
5071
|
+
/**
|
|
5072
|
+
* @param {?} component
|
|
5073
|
+
* @param {?} currentRoute
|
|
5074
|
+
* @param {?} currentState
|
|
5075
|
+
* @param {?=} nextState
|
|
5076
|
+
* @return {?}
|
|
5077
|
+
*/
|
|
5078
|
+
canDeactivate(component, currentRoute, currentState, nextState) {
|
|
5079
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
5080
|
+
// TODO: Add tests
|
|
5081
|
+
if (this.placeRouter.navigationSession.alreadyAccepted(component)) {
|
|
5082
|
+
// We'll get called multiple times if there's any parameter sanitisation so
|
|
5083
|
+
// we always return true if we accepted on a previous cycle of the current
|
|
5084
|
+
// navigation session.
|
|
5085
|
+
return true;
|
|
5086
|
+
}
|
|
5087
|
+
else {
|
|
5088
|
+
/** @type {?} */
|
|
5089
|
+
const self = this;
|
|
5090
|
+
/** @type {?} */
|
|
5091
|
+
let canLeave = true;
|
|
5092
|
+
if (this.isLeavingTheCurrentPlace(nextState, component.placeDefinition)) {
|
|
5093
|
+
// we check the interaction first, so that components that don't need to check if they're in an
|
|
5094
|
+
// interaction during the canDeactivate cycle.
|
|
5095
|
+
// TODO: Add tests: show dialog -> hit back -> same route
|
|
5096
|
+
if (component.interactionContext && component.interactionContext.isActive()) {
|
|
5097
|
+
canLeave = false;
|
|
5098
|
+
console.log('cancelling', { activity: component.interactionContext.currentActivity });
|
|
5099
|
+
component.interactionContext.currentActivity.cancel(null);
|
|
5100
|
+
}
|
|
5101
|
+
// No interaction in progress, so ask the component .
|
|
5102
|
+
// This may start an interaction, hence checking the interaction context above. I.e. if the place pops up the dialog, and
|
|
5103
|
+
// the user clicks back again, we'll re-enter here and go bang when the component tries to open another
|
|
5104
|
+
// dialog.
|
|
5105
|
+
if (canLeave) {
|
|
5106
|
+
// TODO: Add tests: hit back -> confirm leave dialog -> hit back -> close dialog -> hit back -> confirm leave dialog.
|
|
5107
|
+
canLeave = yield component.canDeactivate();
|
|
5108
|
+
}
|
|
5109
|
+
// We also block back button parameter changes while the dialog is open.
|
|
5110
|
+
// NOTE: Now that I'm catching parameter changes I could possibly retry using a fragment or
|
|
5111
|
+
// query parameter to track the dialog being open. Previously I was just checking this on
|
|
5112
|
+
// path changes... if that worked it'd fix the case where the back button breaks with an activity
|
|
5113
|
+
// open on the first page: https://coolon.atlassian.net/browse/AUP-33
|
|
5114
|
+
}
|
|
5115
|
+
else {
|
|
5116
|
+
if (this.interactionContext.isActive()) {
|
|
5117
|
+
console.log('cancelling', { activity: this.interactionContext.currentActivity });
|
|
5118
|
+
this.interactionContext.currentActivity.cancel(null);
|
|
5119
|
+
canLeave = false;
|
|
5120
|
+
}
|
|
5121
|
+
else {
|
|
5122
|
+
canLeave = true;
|
|
5123
|
+
}
|
|
5124
|
+
}
|
|
5125
|
+
if (canLeave) {
|
|
5126
|
+
// We'll get called multiple times if there's any parameter sanitisation so
|
|
5127
|
+
// we remember the acceptance for the duration of the current navigation session.
|
|
5128
|
+
self.placeRouter.navigationSession.rememberAcceptanceOf(component);
|
|
5129
|
+
}
|
|
5130
|
+
else {
|
|
5131
|
+
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
5132
|
+
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
5133
|
+
if (this.placeRouter.navigationSession.isPopState) {
|
|
5134
|
+
console.log('cancelled during popstate');
|
|
5135
|
+
this.angularLocation.go(this.placeRouter.navigationSession.popStateReturnUrl);
|
|
5136
|
+
}
|
|
5137
|
+
}
|
|
5138
|
+
return canLeave;
|
|
5139
|
+
}
|
|
5140
|
+
});
|
|
5141
|
+
}
|
|
5142
|
+
}
|
|
5143
|
+
LeavePlaceGuard.decorators = [
|
|
5144
|
+
{ type: Injectable, args: [{
|
|
5145
|
+
providedIn: 'root'
|
|
5146
|
+
},] }
|
|
5147
|
+
];
|
|
5148
|
+
/** @nocollapse */
|
|
5149
|
+
LeavePlaceGuard.ctorParameters = () => [
|
|
5150
|
+
{ type: Router },
|
|
5151
|
+
{ type: Injector },
|
|
5152
|
+
{ type: PlaceRouter },
|
|
5153
|
+
{ type: InteractionContext },
|
|
5154
|
+
{ type: Location }
|
|
5155
|
+
];
|
|
5156
|
+
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(PlaceRouter), ɵɵinject(InteractionContext), ɵɵinject(Location)); }, token: LeavePlaceGuard, providedIn: "root" });
|
|
5157
|
+
__decorate([
|
|
5158
|
+
Trace(),
|
|
5159
|
+
__metadata("design:type", Function),
|
|
5160
|
+
__metadata("design:paramtypes", [RouterStateSnapshot, PlaceDefinition]),
|
|
5161
|
+
__metadata("design:returntype", void 0)
|
|
5162
|
+
], LeavePlaceGuard.prototype, "isLeavingTheCurrentPlace", null);
|
|
5163
|
+
if (false) {
|
|
5164
|
+
/**
|
|
5165
|
+
* @type {?}
|
|
5166
|
+
* @private
|
|
5167
|
+
*/
|
|
5168
|
+
LeavePlaceGuard.prototype.router;
|
|
5169
|
+
/**
|
|
5170
|
+
* @type {?}
|
|
5171
|
+
* @private
|
|
5172
|
+
*/
|
|
5173
|
+
LeavePlaceGuard.prototype.injector;
|
|
5174
|
+
/**
|
|
5175
|
+
* @type {?}
|
|
5176
|
+
* @private
|
|
5177
|
+
*/
|
|
5178
|
+
LeavePlaceGuard.prototype.placeRouter;
|
|
5179
|
+
/** @type {?} */
|
|
5180
|
+
LeavePlaceGuard.prototype.interactionContext;
|
|
5181
|
+
/** @type {?} */
|
|
5182
|
+
LeavePlaceGuard.prototype.angularLocation;
|
|
5183
|
+
}
|
|
4846
5184
|
|
|
4847
5185
|
/**
|
|
4848
5186
|
* @fileoverview added by tsickle
|
|
@@ -4864,5 +5202,5 @@ if (false) {
|
|
|
4864
5202
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4865
5203
|
*/
|
|
4866
5204
|
|
|
4867
|
-
export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ConfirmThenDialogComponent, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective, Formatter, InteractionContext, InteractionGuard, InteractionModule, InteractionOutletComponent, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NavigationSession, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent,
|
|
5205
|
+
export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionService, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, EnterPlaceGuard, FocusBindingDirective, Formatter, InplaceInteractionContextComponent, InteractionContext, InteractionGuard, InteractionModule, InteractionOutletComponent, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NavigationSession, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, Visit, VisitParameter, VisitParameterList, VisitSanitiser, leftRightPlaceAnimation, slideDownAndUpAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, ConfirmationDialogComponent as ɵba, AbstractActivity as ɵbb, ACTIVITY_DATA as ɵbc, Activity as ɵbd, ConfirmThenDialogComponent as ɵbf, AlertDialogComponent as ɵbg, InteractionOutletComponent as ɵbi, InplaceInteractionContextComponent as ɵbj, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbk, DialogInteractionService as ɵbl, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, NoopComponent as ɵk, PlaceModule as ɵl, EmptyStateComponent as ɵm, BusyOverlayComponent as ɵn, PlaceOutletComponent as ɵo, leftRightPlaceAnimation as ɵp, LEFT_RIGHT_PLACE_ANIMATION as ɵq, PlaceRouter as ɵr, PlaceHistory as ɵs, TabbedPlaceNavigationComponent as ɵt, AbstractPlaceNavigationComponent as ɵu, ListPlaceNavComponent as ɵv, InteractionModule as ɵw, ActivityContainerComponent as ɵx, InteractionContext as ɵy, ActivityOutletComponent as ɵz };
|
|
4868
5206
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|