@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.
Files changed (113) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +1793 -1331
  2. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  3. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  5. package/coolon-angular-ui-powerups.d.ts +35 -32
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/coolon-angular-ui-powerups.js +35 -32
  8. package/esm2015/index.js +2 -2
  9. package/esm2015/lib/angular-ui-powerups.module.js +8 -22
  10. package/esm2015/lib/components/components.module.js +47 -0
  11. package/esm2015/lib/components/forms/number-input/number-input.component.js +2 -2
  12. package/esm2015/lib/components/forms/password-input/password-input.component.js +2 -2
  13. package/esm2015/lib/components/forms/select-input/select-input.component.js +2 -2
  14. package/esm2015/lib/components/forms/string-input/string-input.component.js +2 -2
  15. package/esm2015/lib/components/index.js +2 -1
  16. package/esm2015/lib/components/noop/noop.component.js +2 -2
  17. package/esm2015/lib/directives/directives.module.js +36 -0
  18. package/esm2015/lib/directives/index.js +2 -1
  19. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +72 -49
  20. package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.js +2 -2
  21. package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.js +3 -3
  22. package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +3 -3
  23. package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +3 -3
  24. package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +128 -0
  25. package/esm2015/lib/interaction/components/interaction-outlet/interaction-outlet.component.js +2 -2
  26. package/esm2015/lib/interaction/index.js +2 -1
  27. package/esm2015/lib/interaction/interaction.module.js +6 -3
  28. package/esm2015/lib/interaction/services/dialog-interaction.service.js +10 -7
  29. package/esm2015/lib/place/components/abstract-place-navigation.component.js +38 -3
  30. package/esm2015/lib/place/components/busy-overlay/busy-overlay.component.js +2 -2
  31. package/esm2015/lib/place/components/empty-state/empty-state.component.js +3 -3
  32. package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js +3 -3
  33. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +73 -33
  34. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +3 -3
  35. package/esm2015/lib/place/index.js +2 -2
  36. package/esm2015/lib/place/place-component.js +3 -1
  37. package/esm2015/lib/place/place-definition.js +2 -6
  38. package/esm2015/lib/place/place-router.js +7 -9
  39. package/esm2015/lib/place/place.decorator.js +2 -4
  40. package/esm2015/lib/place/place.module.js +4 -2
  41. package/esm2015/lib/place/route/guards/enter-place-guard.service.js +283 -0
  42. package/esm2015/lib/place/route/guards/leave-place.guard.js +73 -53
  43. package/esm2015/lib/place/visit.js +10 -1
  44. package/esm2015/public_api.js +5 -5
  45. package/esm5/coolon-angular-ui-powerups.js +35 -32
  46. package/esm5/index.js +2 -2
  47. package/esm5/lib/angular-ui-powerups.module.js +8 -22
  48. package/esm5/lib/components/components.module.js +51 -0
  49. package/esm5/lib/components/forms/number-input/number-input.component.js +2 -2
  50. package/esm5/lib/components/forms/password-input/password-input.component.js +2 -2
  51. package/esm5/lib/components/forms/select-input/select-input.component.js +2 -2
  52. package/esm5/lib/components/forms/string-input/string-input.component.js +2 -2
  53. package/esm5/lib/components/index.js +2 -1
  54. package/esm5/lib/components/noop/noop.component.js +2 -2
  55. package/esm5/lib/directives/directives.module.js +40 -0
  56. package/esm5/lib/directives/index.js +2 -1
  57. package/esm5/lib/interaction/components/activity-container/activity-container.component.js +80 -50
  58. package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.js +2 -2
  59. package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js +3 -3
  60. package/esm5/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +3 -3
  61. package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +3 -3
  62. package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +171 -0
  63. package/esm5/lib/interaction/components/interaction-outlet/interaction-outlet.component.js +2 -2
  64. package/esm5/lib/interaction/index.js +2 -1
  65. package/esm5/lib/interaction/interaction.module.js +6 -3
  66. package/esm5/lib/interaction/services/dialog-interaction.service.js +10 -7
  67. package/esm5/lib/place/components/abstract-place-navigation.component.js +38 -3
  68. package/esm5/lib/place/components/busy-overlay/busy-overlay.component.js +2 -2
  69. package/esm5/lib/place/components/empty-state/empty-state.component.js +3 -3
  70. package/esm5/lib/place/components/list-place-nav/list-place-nav.component.js +3 -3
  71. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +85 -39
  72. package/esm5/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +3 -3
  73. package/esm5/lib/place/index.js +2 -2
  74. package/esm5/lib/place/place-component.js +3 -1
  75. package/esm5/lib/place/place-definition.js +2 -5
  76. package/esm5/lib/place/place-router.js +11 -10
  77. package/esm5/lib/place/place.decorator.js +2 -4
  78. package/esm5/lib/place/place.module.js +4 -2
  79. package/esm5/lib/place/route/guards/enter-place-guard.service.js +319 -0
  80. package/esm5/lib/place/route/guards/leave-place.guard.js +75 -11
  81. package/esm5/lib/place/visit.js +13 -1
  82. package/esm5/public_api.js +5 -5
  83. package/fesm2015/coolon-angular-ui-powerups.js +1308 -970
  84. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  85. package/fesm5/coolon-angular-ui-powerups.js +1747 -1292
  86. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  87. package/lib/components/components.module.d.ts +2 -0
  88. package/lib/components/index.d.ts +1 -0
  89. package/lib/directives/directives.module.d.ts +2 -0
  90. package/lib/directives/index.d.ts +1 -0
  91. package/lib/interaction/components/activity-container/activity-container.component.d.ts +9 -6
  92. package/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.d.ts +21 -0
  93. package/lib/interaction/index.d.ts +1 -0
  94. package/lib/place/components/abstract-place-navigation.component.d.ts +7 -1
  95. package/lib/place/components/place-outlet/place-outlet.component.d.ts +8 -5
  96. package/lib/place/index.d.ts +1 -1
  97. package/lib/place/place-component.d.ts +2 -0
  98. package/lib/place/place-definition.d.ts +1 -2
  99. package/lib/place/place.decorator.d.ts +0 -1
  100. package/lib/place/route/guards/{place-route.guard.d.ts → enter-place-guard.service.d.ts} +6 -4
  101. package/lib/place/visit.d.ts +2 -0
  102. package/package.json +1 -1
  103. package/schematics/place-routes/place-builder.js +0 -1
  104. package/schematics/place-routes/place-builder.js.map +1 -1
  105. package/schematics/place-routes/place-class-scanner.js +0 -1
  106. package/schematics/place-routes/place-class-scanner.js.map +1 -1
  107. package/schematics/place-routes/place-def.d.ts +0 -2
  108. package/schematics/place-routes/place-def.js +12 -11
  109. package/schematics/place-routes/place-def.js.map +1 -1
  110. package/schematics/place-routes/templates/place-routes.ts.template +1 -1
  111. package/styles/styles.scss +7 -2
  112. package/esm2015/lib/place/route/guards/place-route.guard.js +0 -243
  113. package/esm5/lib/place/route/guards/place-route.guard.js +0 -273
@@ -1,17 +1,16 @@
1
- import { DOCUMENT, Location, CommonModule } from '@angular/common';
2
- import { EventEmitter, Input, Output, HostListener, Component, Directive, ElementRef, Inject, NgZone, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, Optional, ɵɵdefineInjectable, ɵɵinject, NgModule, HostBinding, SkipSelf, INJECTOR } from '@angular/core';
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, MatProgressSpinnerModule, MatInputModule, MatFormFieldModule, MatSelectModule } from '@angular/material';
5
- import { MatTabsModule as MatTabsModule$1 } from '@angular/material/tabs';
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
7
  import { __extends, __decorate, __metadata, __assign, __awaiter, __generator, __spread } 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';
8
+ import { assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingValueModel, MutableStream, MutableListModel, DelegatingListModel, StoreInValueModel, Binding, MutableValueModel, Trace, Guard as Guard$1, Command, OptionsHelper, ValueHolder } from '@coolon/pectin';
9
9
  import { PortalModule } from '@angular/cdk/portal';
10
- import { Router, RouterModule, NavigationStart, NavigationEnd, NavigationError, ActivatedRoute, RouterOutlet, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
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';
@@ -21,70 +20,35 @@ import 'reflect-metadata';
21
20
  import { style, query, group, animate, trigger, transition } from '@angular/animations';
22
21
  import ResizeObserver from 'resize-observer-polyfill';
23
22
 
24
- /**
25
- * @fileoverview added by tsickle
26
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
27
- */
28
- var DisposableComponent = /** @class */ (function (_super) {
29
- __extends(DisposableComponent, _super);
30
- function DisposableComponent() {
31
- return _super !== null && _super.apply(this, arguments) || this;
32
- }
33
- /**
34
- * @return {?}
35
- */
36
- DisposableComponent.prototype.ngOnDestroy = /**
37
- * @return {?}
38
- */
39
- function () {
40
- this.dispose();
41
- };
42
- return DisposableComponent;
43
- }(GarbageCollector));
44
-
45
23
  /**
46
24
  * @fileoverview added by tsickle
47
25
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
48
26
  */
49
27
  /**
50
- * @abstract
51
- * @template T
28
+ * @template P
52
29
  */
53
- var AbstractInputComponent = /** @class */ (function (_super) {
54
- __extends(AbstractInputComponent, _super);
55
- function AbstractInputComponent() {
30
+ var CommandDirective = /** @class */ (function (_super) {
31
+ __extends(CommandDirective, _super);
32
+ function CommandDirective(elementRef) {
56
33
  var _this = _super.call(this) || this;
57
- _this.valueModel = new DelegatingFormValueModel();
58
- // TODO: fix this.
59
- // tslint:disable-next-line:no-output-native
60
- _this.focus = new EventEmitter();
61
- // tslint:disable-next-line:no-output-native
62
- _this.blur = new EventEmitter();
63
- // tslint:disable-next-line:no-output-native
64
- _this.enterKey = new EventEmitter();
65
- // tslint:disable-next-line:no-output-native
66
- _this.escapeKey = new EventEmitter();
67
- /** @type {?} */
68
- var self = _this;
69
- _this.errorStateMatcher = {
70
- isErrorState: /**
71
- * @param {?} control
72
- * @param {?} form
73
- * @return {?}
74
- */
75
- function (control, form) {
76
- return self.hasErrors();
77
- }
78
- };
34
+ _this.elementRef = elementRef;
35
+ _this._commandParameterProvided = false;
79
36
  return _this;
80
37
  }
81
- Object.defineProperty(AbstractInputComponent.prototype, "userValueModel", {
38
+ Object.defineProperty(CommandDirective.prototype, "commandParameter", {
39
+ get: /**
40
+ * @return {?}
41
+ */
42
+ function () {
43
+ return this._commandParameter;
44
+ },
82
45
  set: /**
83
- * @param {?} model
46
+ * @param {?} value
84
47
  * @return {?}
85
48
  */
86
- function (model) {
87
- this.valueModel.setDelegate(model);
49
+ function (value) {
50
+ this._commandParameterProvided = true;
51
+ this._commandParameter = value;
88
52
  },
89
53
  enumerable: true,
90
54
  configurable: true
@@ -92,725 +56,829 @@ var AbstractInputComponent = /** @class */ (function (_super) {
92
56
  /**
93
57
  * @return {?}
94
58
  */
95
- AbstractInputComponent.prototype.notifyClick = /**
59
+ CommandDirective.prototype.ngOnInit = /**
96
60
  * @return {?}
97
61
  */
98
62
  function () {
99
- this.safelyInvoke(this.clickCommand);
63
+ assert.notNil(this.pectinCommand);
64
+ if (this.pectinCommand instanceof UnaryCommand) {
65
+ if (!this._commandParameterProvided) {
66
+ lang.illegalState('UnaryCommands required the command parameter to be specified.');
67
+ }
68
+ }
69
+ else {
70
+ if (this._commandParameterProvided) {
71
+ lang.illegalState('command parameters are only supported by UnaryCommands');
72
+ }
73
+ }
100
74
  };
101
75
  /**
102
76
  * @return {?}
103
77
  */
104
- AbstractInputComponent.prototype.notifyFocusIn = /**
78
+ CommandDirective.prototype.ngAfterViewInit = /**
105
79
  * @return {?}
106
80
  */
107
81
  function () {
108
- this.safelyInvoke(this.focusCommand);
109
- this.focus.emit();
82
+ var _this = this;
83
+ // for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now
84
+ // we need to do this.
85
+ var chain = Dsl.disposeWith(this).chain;
86
+ chain(this.pectinCommand.enabled).subscribe((/**
87
+ * @param {?} enabled
88
+ * @return {?}
89
+ */
90
+ function (enabled) {
91
+ if (enabled) {
92
+ _this.elementRef.nativeElement.removeAttribute('disabled');
93
+ if (_this.elementRef.nativeElement.tagName === 'A') {
94
+ _this.elementRef.nativeElement.setAttribute('href', 'javascript:void');
95
+ }
96
+ }
97
+ else {
98
+ _this.elementRef.nativeElement.setAttribute('disabled', 'disabled');
99
+ if (_this.elementRef.nativeElement.tagName === 'A') {
100
+ _this.elementRef.nativeElement.removeAttribute('href');
101
+ }
102
+ }
103
+ }));
110
104
  };
111
105
  /**
112
106
  * @return {?}
113
107
  */
114
- AbstractInputComponent.prototype.notifyFocusOut = /**
108
+ CommandDirective.prototype.ngOnDestroy = /**
115
109
  * @return {?}
116
110
  */
117
111
  function () {
118
- this.safelyInvoke(this.blurCommand);
119
- this.blur.emit();
112
+ this.dispose();
120
113
  };
121
114
  /**
115
+ * @param {?} $event
122
116
  * @return {?}
123
117
  */
124
- AbstractInputComponent.prototype.notifyEnterKey = /**
118
+ CommandDirective.prototype.notifyClick = /**
119
+ * @param {?} $event
125
120
  * @return {?}
126
121
  */
127
- function () {
128
- this.safelyInvoke(this.enterCommand);
129
- this.enterKey.emit();
122
+ function ($event) {
123
+ $event.preventDefault();
124
+ $event.stopPropagation();
125
+ if (this.pectinCommand.enabled.value) {
126
+ if (this.pectinCommand instanceof UnaryCommand) {
127
+ this.pectinCommand.withContext({ event: $event }).execute(this.commandParameter);
128
+ }
129
+ else {
130
+ this.pectinCommand.withContext({ event: $event }).execute();
131
+ }
132
+ }
133
+ else {
134
+ console.warn('disabled command clicked, ignoring.');
135
+ }
136
+ };
137
+ CommandDirective.decorators = [
138
+ { type: Directive, args: [{
139
+ // tslint:disable-next-line:directive-selector
140
+ selector: '[pectinCommand]'
141
+ },] }
142
+ ];
143
+ /** @nocollapse */
144
+ CommandDirective.ctorParameters = function () { return [
145
+ { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
146
+ ]; };
147
+ CommandDirective.propDecorators = {
148
+ pectinCommand: [{ type: Input }],
149
+ commandParameter: [{ type: Input }],
150
+ notifyClick: [{ type: HostListener, args: ['click', ['$event'],] }]
130
151
  };
152
+ return CommandDirective;
153
+ }(GarbageCollector));
154
+ if (false) {
155
+ /** @type {?} */
156
+ CommandDirective.prototype.pectinCommand;
157
+ /**
158
+ * @type {?}
159
+ * @private
160
+ */
161
+ CommandDirective.prototype._commandParameter;
162
+ /**
163
+ * @type {?}
164
+ * @private
165
+ */
166
+ CommandDirective.prototype._commandParameterProvided;
167
+ /**
168
+ * @type {?}
169
+ * @private
170
+ */
171
+ CommandDirective.prototype.elementRef;
172
+ }
173
+
174
+ /**
175
+ * @fileoverview added by tsickle
176
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
177
+ */
178
+ var DisposableComponent = /** @class */ (function (_super) {
179
+ __extends(DisposableComponent, _super);
180
+ function DisposableComponent() {
181
+ return _super !== null && _super.apply(this, arguments) || this;
182
+ }
131
183
  /**
132
184
  * @return {?}
133
185
  */
134
- AbstractInputComponent.prototype.notifyEscapeKey = /**
186
+ DisposableComponent.prototype.ngOnDestroy = /**
135
187
  * @return {?}
136
188
  */
137
189
  function () {
138
- this.safelyInvoke(this.escapeCommand);
139
- this.escapeKey.emit();
190
+ this.dispose();
140
191
  };
192
+ return DisposableComponent;
193
+ }(GarbageCollector));
194
+
195
+ /**
196
+ * @fileoverview added by tsickle
197
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
198
+ */
199
+ var FocusBindingDirective = /** @class */ (function (_super) {
200
+ __extends(FocusBindingDirective, _super);
201
+ function FocusBindingDirective(el, ngZone, document) {
202
+ var _this = _super.call(this) || this;
203
+ _this.el = el;
204
+ _this.ngZone = ngZone;
205
+ // @see https://stackoverflow.com/questions/49513359/could-not-resolve-type-document-in-angular5/53715642#53715642
206
+ _this.document = (/** @type {?} */ (document));
207
+ return _this;
208
+ }
141
209
  /**
142
- * @protected
143
- * @param {?} command
144
210
  * @return {?}
145
211
  */
146
- AbstractInputComponent.prototype.safelyInvoke = /**
147
- * @protected
148
- * @param {?} command
212
+ FocusBindingDirective.prototype.onFocusIn = /**
149
213
  * @return {?}
150
214
  */
151
- function (command) {
152
- if (command && command.enabled.value) {
153
- command.execute();
215
+ function () {
216
+ if (this.hasBinding()) {
217
+ this.pectinFocusBinding.focusContext.notifyFocusIn();
154
218
  }
155
219
  };
156
220
  /**
157
221
  * @return {?}
158
222
  */
159
- AbstractInputComponent.prototype.ngOnInit = /**
223
+ FocusBindingDirective.prototype.onFocusOut = /**
160
224
  * @return {?}
161
225
  */
162
226
  function () {
227
+ if (this.hasBinding()) {
228
+ this.pectinFocusBinding.focusContext.notifyFocusOut();
229
+ }
163
230
  };
164
231
  /**
165
232
  * @return {?}
166
233
  */
167
- AbstractInputComponent.prototype.isEnabled = /**
234
+ FocusBindingDirective.prototype.ngOnInit = /**
168
235
  * @return {?}
169
236
  */
170
237
  function () {
171
- return this.enabled.value;
172
238
  };
173
- Object.defineProperty(AbstractInputComponent.prototype, "enabled", {
174
- get: /**
175
- * @return {?}
176
- */
177
- function () {
178
- return this.valueModel.enabled;
179
- },
180
- enumerable: true,
181
- configurable: true
182
- });
183
239
  /**
184
240
  * @return {?}
185
241
  */
186
- AbstractInputComponent.prototype.hasErrors = /**
242
+ FocusBindingDirective.prototype.ngAfterViewInit = /**
187
243
  * @return {?}
188
244
  */
189
245
  function () {
190
- return !this.errorList.query().isEmpty();
246
+ var _this = this;
247
+ // TODO: Make this also track the current enabled/disabled state.
248
+ if (this.hasBinding()) {
249
+ var chain = Dsl.disposeWith(this).chain;
250
+ chain(this.pectinFocusBinding.focusContext.focused).subscribe((/**
251
+ * @param {?} focused
252
+ * @return {?}
253
+ */
254
+ function (focused) {
255
+ if (focused && !_this.alreadyHasFocus()) {
256
+ _this.tryAndFocus();
257
+ }
258
+ }));
259
+ }
260
+ else {
261
+ Logger.get(this).warn('pectinFocusBinding was nil');
262
+ }
191
263
  };
192
- Object.defineProperty(AbstractInputComponent.prototype, "errorList", {
193
- get: /**
194
- * @return {?}
195
- */
196
- function () {
197
- return this.valueModel.errorList;
198
- },
199
- enumerable: true,
200
- configurable: true
201
- });
202
- Object.defineProperty(AbstractInputComponent.prototype, "firstError", {
203
- get: /**
204
- * @return {?}
205
- */
206
- function () {
207
- return this.hasErrors() ? this.errorList.value[0] : null;
208
- },
209
- enumerable: true,
210
- configurable: true
211
- });
212
- AbstractInputComponent.propDecorators = {
213
- userValueModel: [{ type: Input, args: ['valueModel',] }],
214
- label: [{ type: Input }],
215
- floatLabel: [{ type: Input }],
216
- hint: [{ type: Input }],
217
- placeholder: [{ type: Input }],
218
- focusCommand: [{ type: Input, args: ['command.focus',] }],
219
- blurCommand: [{ type: Input, args: ['command.blur',] }],
220
- enterCommand: [{ type: Input, args: ['command.enter',] }],
221
- escapeCommand: [{ type: Input, args: ['command.escape',] }],
222
- clickCommand: [{ type: Input, args: ['command.click',] }],
223
- focus: [{ type: Output }],
224
- blur: [{ type: Output }],
225
- enterKey: [{ type: Output }],
226
- escapeKey: [{ type: Output }],
227
- notifyClick: [{ type: HostListener, args: ['click',] }],
228
- notifyFocusIn: [{ type: HostListener, args: ['focusin',] }],
229
- notifyFocusOut: [{ type: HostListener, args: ['focusout',] }]
230
- };
231
- __decorate([
232
- UseDelegate(),
233
- __metadata("design:type", ValueModel),
234
- __metadata("design:paramtypes", [ValueModel])
235
- ], AbstractInputComponent.prototype, "userValueModel", null);
236
- return AbstractInputComponent;
237
- }(DisposableComponent));
238
- if (false) {
239
- /** @type {?} */
240
- AbstractInputComponent.prototype.valueModel;
241
- /** @type {?} */
242
- AbstractInputComponent.prototype.label;
243
- /** @type {?} */
244
- AbstractInputComponent.prototype.floatLabel;
245
- /** @type {?} */
246
- AbstractInputComponent.prototype.hint;
247
- /** @type {?} */
248
- AbstractInputComponent.prototype.placeholder;
249
- /** @type {?} */
250
- AbstractInputComponent.prototype.focusCommand;
251
- /** @type {?} */
252
- AbstractInputComponent.prototype.blurCommand;
253
- /** @type {?} */
254
- AbstractInputComponent.prototype.enterCommand;
255
- /** @type {?} */
256
- AbstractInputComponent.prototype.escapeCommand;
257
- /** @type {?} */
258
- AbstractInputComponent.prototype.clickCommand;
259
- /** @type {?} */
260
- AbstractInputComponent.prototype.focus;
261
- /** @type {?} */
262
- AbstractInputComponent.prototype.blur;
263
- /** @type {?} */
264
- AbstractInputComponent.prototype.enterKey;
265
- /** @type {?} */
266
- AbstractInputComponent.prototype.escapeKey;
267
- /** @type {?} */
268
- AbstractInputComponent.prototype.errorStateMatcher;
269
- }
270
-
271
- /**
272
- * @fileoverview added by tsickle
273
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
274
- */
275
- var NumberInputComponent = /** @class */ (function (_super) {
276
- __extends(NumberInputComponent, _super);
277
- function NumberInputComponent() {
278
- return _super.call(this) || this;
279
- }
280
264
  /**
265
+ * @private
281
266
  * @return {?}
282
267
  */
283
- NumberInputComponent.prototype.ngOnInit = /**
268
+ FocusBindingDirective.prototype.hasBinding = /**
269
+ * @private
284
270
  * @return {?}
285
271
  */
286
272
  function () {
273
+ return !!this.pectinFocusBinding && !!this.pectinFocusBinding.focusContext;
287
274
  };
288
- NumberInputComponent.decorators = [
289
- { type: Component, args: [{
290
- selector: 'angular-ui-powerups-number-input',
291
- 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",
292
- styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
293
- }] }
294
- ];
295
- /** @nocollapse */
296
- NumberInputComponent.ctorParameters = function () { return []; };
297
- return NumberInputComponent;
298
- }(AbstractInputComponent));
299
-
300
- /**
301
- * @fileoverview added by tsickle
302
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
303
- */
304
- var PasswordInputComponent = /** @class */ (function (_super) {
305
- __extends(PasswordInputComponent, _super);
306
- function PasswordInputComponent() {
307
- return _super.call(this) || this;
308
- }
275
+ // Hook method for debugging via tracing.
276
+ // Hook method for debugging via tracing.
309
277
  /**
310
278
  * @return {?}
311
279
  */
312
- PasswordInputComponent.prototype.ngOnInit = /**
313
- * @return {?}
314
- */
315
- function () {
316
- };
317
- PasswordInputComponent.decorators = [
318
- { type: Component, args: [{
319
- selector: 'angular-ui-powerups-password-input',
320
- 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",
321
- styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
322
- }] }
323
- ];
324
- /** @nocollapse */
325
- PasswordInputComponent.ctorParameters = function () { return []; };
326
- return PasswordInputComponent;
327
- }(AbstractInputComponent));
328
-
329
- /**
330
- * @fileoverview added by tsickle
331
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
332
- */
333
- /**
334
- * @template T
335
- */
336
- var SelectInputComponent = /** @class */ (function (_super) {
337
- __extends(SelectInputComponent, _super);
338
- function SelectInputComponent() {
339
- var _this = _super.call(this) || this;
340
- _this.optionLabelFormat = (/**
341
- * @param {?} option
342
- * @return {?}
343
- */
344
- function (option) { return (option && _this.optionLabel) ? option[_this.optionLabel] : option; });
345
- return _this;
346
- }
280
+ FocusBindingDirective.prototype.alreadyHasFocus =
281
+ // Hook method for debugging via tracing.
347
282
  /**
348
283
  * @return {?}
349
284
  */
350
- SelectInputComponent.prototype.ngOnInit = /**
351
- * @return {?}
352
- */
353
285
  function () {
286
+ return this.isFocused(this.focusTarget);
354
287
  };
355
- SelectInputComponent.decorators = [
356
- { type: Component, args: [{
357
- selector: 'angular-ui-powerups-select-input',
358
- 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",
359
- styles: [":host{display:inline-block}mat-form-field{width:100%}"]
360
- }] }
361
- ];
362
- /** @nocollapse */
363
- SelectInputComponent.ctorParameters = function () { return []; };
364
- SelectInputComponent.propDecorators = {
365
- optionsModel: [{ type: Input }],
366
- options: [{ type: Input }],
367
- optionLabel: [{ type: Input }],
368
- optionLabelFormat: [{ type: Input }]
369
- };
370
- __decorate([
371
- UseDelegate(),
372
- __metadata("design:type", ListModel)
373
- ], SelectInputComponent.prototype, "optionsModel", void 0);
374
- __decorate([
375
- StoreInListModel('optionsModel'),
376
- __metadata("design:type", Array)
377
- ], SelectInputComponent.prototype, "options", void 0);
378
- return SelectInputComponent;
379
- }(AbstractInputComponent));
380
- if (false) {
381
- /** @type {?} */
382
- SelectInputComponent.prototype.optionsModel;
383
- /** @type {?} */
384
- SelectInputComponent.prototype.options;
385
- /** @type {?} */
386
- SelectInputComponent.prototype.optionLabel;
387
- /** @type {?} */
388
- SelectInputComponent.prototype.optionLabelFormat;
389
- }
390
-
391
- /**
392
- * @fileoverview added by tsickle
393
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
394
- */
395
- var StringInputComponent = /** @class */ (function (_super) {
396
- __extends(StringInputComponent, _super);
397
- function StringInputComponent() {
398
- return _super.call(this) || this;
399
- }
288
+ // Hook method for debugging via tracing.
289
+ // Hook method for debugging via tracing.
400
290
  /**
291
+ * @param {?} element
401
292
  * @return {?}
402
293
  */
403
- StringInputComponent.prototype.ngOnInit = /**
294
+ FocusBindingDirective.prototype.isFocused =
295
+ // Hook method for debugging via tracing.
296
+ /**
297
+ * @param {?} element
404
298
  * @return {?}
405
299
  */
406
- function () {
300
+ function (element) {
301
+ return this.document.activeElement === element;
407
302
  };
408
- StringInputComponent.decorators = [
409
- { type: Component, args: [{
410
- selector: 'angular-ui-powerups-string-input',
411
- 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",
412
- styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
413
- }] }
414
- ];
415
- /** @nocollapse */
416
- StringInputComponent.ctorParameters = function () { return []; };
417
- return StringInputComponent;
418
- }(AbstractInputComponent));
419
-
420
- /**
421
- * @fileoverview added by tsickle
422
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
423
- */
424
- var NoopComponent = /** @class */ (function () {
425
- function NoopComponent() {
426
- }
427
- NoopComponent.decorators = [
428
- { type: Component, args: [{
429
- selector: 'angular-ui-powerups-noop',
430
- template: "",
431
- styles: [":host{display:block}"]
432
- }] }
433
- ];
434
- /** @nocollapse */
435
- NoopComponent.ctorParameters = function () { return []; };
436
- return NoopComponent;
437
- }());
438
-
439
- /**
440
- * @fileoverview added by tsickle
441
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
442
- */
443
- /**
444
- * @template P
445
- */
446
- var CommandDirective = /** @class */ (function (_super) {
447
- __extends(CommandDirective, _super);
448
- function CommandDirective(elementRef) {
449
- var _this = _super.call(this) || this;
450
- _this.elementRef = elementRef;
451
- _this._commandParameterProvided = false;
452
- return _this;
453
- }
454
- Object.defineProperty(CommandDirective.prototype, "commandParameter", {
455
- get: /**
456
- * @return {?}
457
- */
458
- function () {
459
- return this._commandParameter;
460
- },
461
- set: /**
462
- * @param {?} value
463
- * @return {?}
464
- */
465
- function (value) {
466
- this._commandParameterProvided = true;
467
- this._commandParameter = value;
468
- },
469
- enumerable: true,
470
- configurable: true
471
- });
472
303
  /**
304
+ * @param {?=} retries
473
305
  * @return {?}
474
306
  */
475
- CommandDirective.prototype.ngOnInit = /**
307
+ FocusBindingDirective.prototype.tryAndFocus = /**
308
+ * @param {?=} retries
476
309
  * @return {?}
477
310
  */
478
- function () {
479
- assert.notNil(this.pectinCommand);
480
- if (this.pectinCommand instanceof UnaryCommand) {
481
- if (!this._commandParameterProvided) {
482
- lang.illegalState('UnaryCommands required the command parameter to be specified.');
311
+ function (retries) {
312
+ var _this = this;
313
+ if (retries === void 0) { retries = 5; }
314
+ if (this.modelShouldStillHaveFocus() && this.canFocus()) {
315
+ if (!this.alreadyHasFocus()) {
316
+ this.focusTarget.focus();
483
317
  }
484
- }
485
- else {
486
- if (this._commandParameterProvided) {
487
- lang.illegalState('command parameters are only supported by UnaryCommands');
318
+ // if we didn't get the focus we try again later.
319
+ if (!this.alreadyHasFocus()) {
320
+ Logger.get(this).log("focus failed, trying " + retries + " more times");
321
+ if (retries > 0) {
322
+ // try again on the next paint
323
+ // TODO: is there an angular way of doing this without calling a window function.
324
+ requestAnimationFrame((/**
325
+ * @return {?}
326
+ */
327
+ function () {
328
+ _this.tryAndFocus(retries - 1);
329
+ }));
330
+ }
331
+ else {
332
+ Logger.get(this).warn("Tried to focus but gave up as the component wasn't enabled or visible.");
333
+ }
488
334
  }
489
335
  }
490
336
  };
491
- /**
492
- * @return {?}
493
- */
494
- CommandDirective.prototype.ngAfterViewInit = /**
495
- * @return {?}
496
- */
497
- function () {
498
- var _this = this;
499
- // for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now
500
- // we need to do this.
501
- var chain = Dsl.disposeWith(this).chain;
502
- chain(this.pectinCommand.enabled).subscribe((/**
503
- * @param {?} enabled
337
+ Object.defineProperty(FocusBindingDirective.prototype, "focusTarget", {
338
+ get: /**
504
339
  * @return {?}
505
340
  */
506
- function (enabled) {
507
- if (enabled) {
508
- _this.elementRef.nativeElement.removeAttribute('disabled');
509
- if (_this.elementRef.nativeElement.tagName === 'A') {
510
- _this.elementRef.nativeElement.setAttribute('href', 'javascript:void');
511
- }
512
- }
513
- else {
514
- _this.elementRef.nativeElement.setAttribute('disabled', 'disabled');
515
- if (_this.elementRef.nativeElement.tagName === 'A') {
516
- _this.elementRef.nativeElement.removeAttribute('href');
517
- }
518
- }
519
- }));
520
- };
341
+ function () {
342
+ return this.focusBindingTarget || this.el.nativeElement;
343
+ },
344
+ enumerable: true,
345
+ configurable: true
346
+ });
347
+ // Hook method for debugging via tracing.
348
+ // Hook method for debugging via tracing.
521
349
  /**
522
350
  * @return {?}
523
351
  */
524
- CommandDirective.prototype.ngOnDestroy = /**
352
+ FocusBindingDirective.prototype.modelShouldStillHaveFocus =
353
+ // Hook method for debugging via tracing.
354
+ /**
525
355
  * @return {?}
526
356
  */
527
357
  function () {
528
- this.dispose();
358
+ return this.hasBinding() && this.pectinFocusBinding.focusContext.focused.value;
529
359
  };
360
+ // Hook method for debugging via tracing.
361
+ // Hook method for debugging via tracing.
530
362
  /**
531
- * @param {?} $event
532
363
  * @return {?}
533
364
  */
534
- CommandDirective.prototype.notifyClick = /**
535
- * @param {?} $event
365
+ FocusBindingDirective.prototype.canFocus =
366
+ // Hook method for debugging via tracing.
367
+ /**
536
368
  * @return {?}
537
369
  */
538
- function ($event) {
539
- $event.preventDefault();
540
- $event.stopPropagation();
541
- if (this.pectinCommand.enabled.value) {
542
- if (this.pectinCommand instanceof UnaryCommand) {
543
- this.pectinCommand.withContext({ event: $event }).execute(this.commandParameter);
544
- }
545
- else {
546
- this.pectinCommand.withContext({ event: $event }).execute();
547
- }
548
- }
549
- else {
550
- console.warn('disabled command clicked, ignoring.');
551
- }
370
+ function () {
371
+ /** @type {?} */
372
+ var dimension = this.focusTarget.getBoundingClientRect();
373
+ /** @type {?} */
374
+ var hasSize = dimension.height >= 0 && dimension.height >= 0;
375
+ // tslint:disable-next-line:no-string-literal
376
+ return hasSize && !this.focusTarget['disabled'];
552
377
  };
553
- CommandDirective.decorators = [
378
+ FocusBindingDirective.decorators = [
554
379
  { type: Directive, args: [{
555
380
  // tslint:disable-next-line:directive-selector
556
- selector: '[pectinCommand]'
381
+ selector: '[pectinFocusBinding]'
557
382
  },] }
558
383
  ];
559
384
  /** @nocollapse */
560
- CommandDirective.ctorParameters = function () { return [
561
- { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
385
+ FocusBindingDirective.ctorParameters = function () { return [
386
+ { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
387
+ { type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
388
+ { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
562
389
  ]; };
563
- CommandDirective.propDecorators = {
564
- pectinCommand: [{ type: Input }],
565
- commandParameter: [{ type: Input }],
566
- notifyClick: [{ type: HostListener, args: ['click', ['$event'],] }]
390
+ FocusBindingDirective.propDecorators = {
391
+ pectinFocusBinding: [{ type: Input }],
392
+ focusBindingTarget: [{ type: Input }],
393
+ onFocusIn: [{ type: HostListener, args: ['focusin',] }],
394
+ onFocusOut: [{ type: HostListener, args: ['focusout',] }]
567
395
  };
568
- return CommandDirective;
569
- }(GarbageCollector));
396
+ return FocusBindingDirective;
397
+ }(DisposableComponent));
570
398
  if (false) {
571
- /** @type {?} */
572
- CommandDirective.prototype.pectinCommand;
573
399
  /**
574
400
  * @type {?}
575
401
  * @private
576
402
  */
577
- CommandDirective.prototype._commandParameter;
403
+ FocusBindingDirective.prototype.document;
404
+ /** @type {?} */
405
+ FocusBindingDirective.prototype.pectinFocusBinding;
406
+ /** @type {?} */
407
+ FocusBindingDirective.prototype.focusBindingTarget;
578
408
  /**
579
409
  * @type {?}
580
410
  * @private
581
411
  */
582
- CommandDirective.prototype._commandParameterProvided;
412
+ FocusBindingDirective.prototype.el;
583
413
  /**
584
414
  * @type {?}
585
415
  * @private
586
416
  */
587
- CommandDirective.prototype.elementRef;
417
+ FocusBindingDirective.prototype.ngZone;
588
418
  }
589
419
 
590
420
  /**
591
421
  * @fileoverview added by tsickle
592
422
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
593
423
  */
594
- var FocusBindingDirective = /** @class */ (function (_super) {
595
- __extends(FocusBindingDirective, _super);
596
- function FocusBindingDirective(el, ngZone, document) {
424
+ var DirectivesModule = /** @class */ (function () {
425
+ function DirectivesModule() {
426
+ }
427
+ DirectivesModule.decorators = [
428
+ { type: NgModule, args: [{
429
+ declarations: [
430
+ CommandDirective,
431
+ FocusBindingDirective
432
+ ],
433
+ imports: [
434
+ CommonModule,
435
+ BrowserAnimationsModule,
436
+ FormsModule,
437
+ MatInputModule,
438
+ MatFormFieldModule,
439
+ MatSelectModule,
440
+ MatTabsModule
441
+ ],
442
+ exports: [
443
+ CommandDirective,
444
+ FocusBindingDirective
445
+ ]
446
+ },] }
447
+ ];
448
+ return DirectivesModule;
449
+ }());
450
+
451
+ /**
452
+ * @fileoverview added by tsickle
453
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
454
+ */
455
+ /**
456
+ * @abstract
457
+ * @template T
458
+ */
459
+ var AbstractInputComponent = /** @class */ (function (_super) {
460
+ __extends(AbstractInputComponent, _super);
461
+ function AbstractInputComponent() {
597
462
  var _this = _super.call(this) || this;
598
- _this.el = el;
599
- _this.ngZone = ngZone;
600
- // @see https://stackoverflow.com/questions/49513359/could-not-resolve-type-document-in-angular5/53715642#53715642
601
- _this.document = (/** @type {?} */ (document));
463
+ _this.valueModel = new DelegatingFormValueModel();
464
+ // TODO: fix this.
465
+ // tslint:disable-next-line:no-output-native
466
+ _this.focus = new EventEmitter();
467
+ // tslint:disable-next-line:no-output-native
468
+ _this.blur = new EventEmitter();
469
+ // tslint:disable-next-line:no-output-native
470
+ _this.enterKey = new EventEmitter();
471
+ // tslint:disable-next-line:no-output-native
472
+ _this.escapeKey = new EventEmitter();
473
+ /** @type {?} */
474
+ var self = _this;
475
+ _this.errorStateMatcher = {
476
+ isErrorState: /**
477
+ * @param {?} control
478
+ * @param {?} form
479
+ * @return {?}
480
+ */
481
+ function (control, form) {
482
+ return self.hasErrors();
483
+ }
484
+ };
602
485
  return _this;
603
486
  }
487
+ Object.defineProperty(AbstractInputComponent.prototype, "userValueModel", {
488
+ set: /**
489
+ * @param {?} model
490
+ * @return {?}
491
+ */
492
+ function (model) {
493
+ this.valueModel.setDelegate(model);
494
+ },
495
+ enumerable: true,
496
+ configurable: true
497
+ });
604
498
  /**
605
499
  * @return {?}
606
500
  */
607
- FocusBindingDirective.prototype.onFocusIn = /**
501
+ AbstractInputComponent.prototype.notifyClick = /**
608
502
  * @return {?}
609
503
  */
610
504
  function () {
611
- if (this.hasBinding()) {
612
- this.pectinFocusBinding.focusContext.notifyFocusIn();
613
- }
505
+ this.safelyInvoke(this.clickCommand);
614
506
  };
615
507
  /**
616
508
  * @return {?}
617
509
  */
618
- FocusBindingDirective.prototype.onFocusOut = /**
510
+ AbstractInputComponent.prototype.notifyFocusIn = /**
619
511
  * @return {?}
620
512
  */
621
513
  function () {
622
- if (this.hasBinding()) {
623
- this.pectinFocusBinding.focusContext.notifyFocusOut();
624
- }
514
+ this.safelyInvoke(this.focusCommand);
515
+ this.focus.emit();
625
516
  };
626
517
  /**
627
518
  * @return {?}
628
519
  */
629
- FocusBindingDirective.prototype.ngOnInit = /**
520
+ AbstractInputComponent.prototype.notifyFocusOut = /**
630
521
  * @return {?}
631
522
  */
632
523
  function () {
524
+ this.safelyInvoke(this.blurCommand);
525
+ this.blur.emit();
633
526
  };
634
527
  /**
635
528
  * @return {?}
636
529
  */
637
- FocusBindingDirective.prototype.ngAfterViewInit = /**
530
+ AbstractInputComponent.prototype.notifyEnterKey = /**
638
531
  * @return {?}
639
532
  */
640
533
  function () {
641
- var _this = this;
642
- // TODO: Make this also track the current enabled/disabled state.
643
- if (this.hasBinding()) {
644
- var chain = Dsl.disposeWith(this).chain;
645
- chain(this.pectinFocusBinding.focusContext.focused).subscribe((/**
646
- * @param {?} focused
647
- * @return {?}
648
- */
649
- function (focused) {
650
- if (focused && !_this.alreadyHasFocus()) {
651
- _this.tryAndFocus();
652
- }
653
- }));
654
- }
655
- else {
656
- Logger.get(this).warn('pectinFocusBinding was nil');
657
- }
534
+ this.safelyInvoke(this.enterCommand);
535
+ this.enterKey.emit();
658
536
  };
659
537
  /**
660
- * @private
661
538
  * @return {?}
662
539
  */
663
- FocusBindingDirective.prototype.hasBinding = /**
664
- * @private
540
+ AbstractInputComponent.prototype.notifyEscapeKey = /**
665
541
  * @return {?}
666
542
  */
667
543
  function () {
668
- return !!this.pectinFocusBinding && !!this.pectinFocusBinding.focusContext;
544
+ this.safelyInvoke(this.escapeCommand);
545
+ this.escapeKey.emit();
669
546
  };
670
- // Hook method for debugging via tracing.
671
- // Hook method for debugging via tracing.
672
547
  /**
548
+ * @protected
549
+ * @param {?} command
673
550
  * @return {?}
674
551
  */
675
- FocusBindingDirective.prototype.alreadyHasFocus =
676
- // Hook method for debugging via tracing.
552
+ AbstractInputComponent.prototype.safelyInvoke = /**
553
+ * @protected
554
+ * @param {?} command
555
+ * @return {?}
556
+ */
557
+ function (command) {
558
+ if (command && command.enabled.value) {
559
+ command.execute();
560
+ }
561
+ };
677
562
  /**
678
563
  * @return {?}
679
564
  */
565
+ AbstractInputComponent.prototype.ngOnInit = /**
566
+ * @return {?}
567
+ */
680
568
  function () {
681
- return this.isFocused(this.focusTarget);
682
569
  };
683
- // Hook method for debugging via tracing.
684
- // Hook method for debugging via tracing.
685
570
  /**
686
- * @param {?} element
687
571
  * @return {?}
688
572
  */
689
- FocusBindingDirective.prototype.isFocused =
690
- // Hook method for debugging via tracing.
691
- /**
692
- * @param {?} element
573
+ AbstractInputComponent.prototype.isEnabled = /**
693
574
  * @return {?}
694
575
  */
695
- function (element) {
696
- return this.document.activeElement === element;
576
+ function () {
577
+ return this.enabled.value;
697
578
  };
579
+ Object.defineProperty(AbstractInputComponent.prototype, "enabled", {
580
+ get: /**
581
+ * @return {?}
582
+ */
583
+ function () {
584
+ return this.valueModel.enabled;
585
+ },
586
+ enumerable: true,
587
+ configurable: true
588
+ });
698
589
  /**
699
- * @param {?=} retries
700
590
  * @return {?}
701
591
  */
702
- FocusBindingDirective.prototype.tryAndFocus = /**
703
- * @param {?=} retries
592
+ AbstractInputComponent.prototype.hasErrors = /**
704
593
  * @return {?}
705
594
  */
706
- function (retries) {
707
- var _this = this;
708
- if (retries === void 0) { retries = 5; }
709
- if (this.modelShouldStillHaveFocus() && this.canFocus()) {
710
- if (!this.alreadyHasFocus()) {
711
- this.focusTarget.focus();
712
- }
713
- // if we didn't get the focus we try again later.
714
- if (!this.alreadyHasFocus()) {
715
- Logger.get(this).log("focus failed, trying " + retries + " more times");
716
- if (retries > 0) {
717
- // try again on the next paint
718
- // TODO: is there an angular way of doing this without calling a window function.
719
- requestAnimationFrame((/**
720
- * @return {?}
721
- */
722
- function () {
723
- _this.tryAndFocus(retries - 1);
724
- }));
725
- }
726
- else {
727
- Logger.get(this).warn("Tried to focus but gave up as the component wasn't enabled or visible.");
728
- }
729
- }
730
- }
595
+ function () {
596
+ return !this.errorList.query().isEmpty();
731
597
  };
732
- Object.defineProperty(FocusBindingDirective.prototype, "focusTarget", {
598
+ Object.defineProperty(AbstractInputComponent.prototype, "errorList", {
733
599
  get: /**
734
600
  * @return {?}
735
601
  */
736
602
  function () {
737
- return this.focusBindingTarget || this.el.nativeElement;
603
+ return this.valueModel.errorList;
738
604
  },
739
605
  enumerable: true,
740
606
  configurable: true
741
607
  });
742
- // Hook method for debugging via tracing.
743
- // Hook method for debugging via tracing.
608
+ Object.defineProperty(AbstractInputComponent.prototype, "firstError", {
609
+ get: /**
610
+ * @return {?}
611
+ */
612
+ function () {
613
+ return this.hasErrors() ? this.errorList.value[0] : null;
614
+ },
615
+ enumerable: true,
616
+ configurable: true
617
+ });
618
+ AbstractInputComponent.propDecorators = {
619
+ userValueModel: [{ type: Input, args: ['valueModel',] }],
620
+ label: [{ type: Input }],
621
+ floatLabel: [{ type: Input }],
622
+ hint: [{ type: Input }],
623
+ placeholder: [{ type: Input }],
624
+ focusCommand: [{ type: Input, args: ['command.focus',] }],
625
+ blurCommand: [{ type: Input, args: ['command.blur',] }],
626
+ enterCommand: [{ type: Input, args: ['command.enter',] }],
627
+ escapeCommand: [{ type: Input, args: ['command.escape',] }],
628
+ clickCommand: [{ type: Input, args: ['command.click',] }],
629
+ focus: [{ type: Output }],
630
+ blur: [{ type: Output }],
631
+ enterKey: [{ type: Output }],
632
+ escapeKey: [{ type: Output }],
633
+ notifyClick: [{ type: HostListener, args: ['click',] }],
634
+ notifyFocusIn: [{ type: HostListener, args: ['focusin',] }],
635
+ notifyFocusOut: [{ type: HostListener, args: ['focusout',] }]
636
+ };
637
+ __decorate([
638
+ UseDelegate(),
639
+ __metadata("design:type", ValueModel),
640
+ __metadata("design:paramtypes", [ValueModel])
641
+ ], AbstractInputComponent.prototype, "userValueModel", null);
642
+ return AbstractInputComponent;
643
+ }(DisposableComponent));
644
+ if (false) {
645
+ /** @type {?} */
646
+ AbstractInputComponent.prototype.valueModel;
647
+ /** @type {?} */
648
+ AbstractInputComponent.prototype.label;
649
+ /** @type {?} */
650
+ AbstractInputComponent.prototype.floatLabel;
651
+ /** @type {?} */
652
+ AbstractInputComponent.prototype.hint;
653
+ /** @type {?} */
654
+ AbstractInputComponent.prototype.placeholder;
655
+ /** @type {?} */
656
+ AbstractInputComponent.prototype.focusCommand;
657
+ /** @type {?} */
658
+ AbstractInputComponent.prototype.blurCommand;
659
+ /** @type {?} */
660
+ AbstractInputComponent.prototype.enterCommand;
661
+ /** @type {?} */
662
+ AbstractInputComponent.prototype.escapeCommand;
663
+ /** @type {?} */
664
+ AbstractInputComponent.prototype.clickCommand;
665
+ /** @type {?} */
666
+ AbstractInputComponent.prototype.focus;
667
+ /** @type {?} */
668
+ AbstractInputComponent.prototype.blur;
669
+ /** @type {?} */
670
+ AbstractInputComponent.prototype.enterKey;
671
+ /** @type {?} */
672
+ AbstractInputComponent.prototype.escapeKey;
673
+ /** @type {?} */
674
+ AbstractInputComponent.prototype.errorStateMatcher;
675
+ }
676
+
677
+ /**
678
+ * @fileoverview added by tsickle
679
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
680
+ */
681
+ var NumberInputComponent = /** @class */ (function (_super) {
682
+ __extends(NumberInputComponent, _super);
683
+ function NumberInputComponent() {
684
+ return _super.call(this) || this;
685
+ }
744
686
  /**
745
687
  * @return {?}
746
688
  */
747
- FocusBindingDirective.prototype.modelShouldStillHaveFocus =
748
- // Hook method for debugging via tracing.
749
- /**
689
+ NumberInputComponent.prototype.ngOnInit = /**
750
690
  * @return {?}
751
691
  */
752
692
  function () {
753
- return this.hasBinding() && this.pectinFocusBinding.focusContext.focused.value;
754
693
  };
755
- // Hook method for debugging via tracing.
756
- // Hook method for debugging via tracing.
694
+ NumberInputComponent.decorators = [
695
+ { type: Component, args: [{
696
+ selector: 'aup-number-input',
697
+ 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",
698
+ styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
699
+ }] }
700
+ ];
701
+ /** @nocollapse */
702
+ NumberInputComponent.ctorParameters = function () { return []; };
703
+ return NumberInputComponent;
704
+ }(AbstractInputComponent));
705
+
706
+ /**
707
+ * @fileoverview added by tsickle
708
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
709
+ */
710
+ var PasswordInputComponent = /** @class */ (function (_super) {
711
+ __extends(PasswordInputComponent, _super);
712
+ function PasswordInputComponent() {
713
+ return _super.call(this) || this;
714
+ }
757
715
  /**
758
716
  * @return {?}
759
717
  */
760
- FocusBindingDirective.prototype.canFocus =
761
- // Hook method for debugging via tracing.
718
+ PasswordInputComponent.prototype.ngOnInit = /**
719
+ * @return {?}
720
+ */
721
+ function () {
722
+ };
723
+ PasswordInputComponent.decorators = [
724
+ { type: Component, args: [{
725
+ selector: 'aup-password-input',
726
+ 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",
727
+ styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
728
+ }] }
729
+ ];
730
+ /** @nocollapse */
731
+ PasswordInputComponent.ctorParameters = function () { return []; };
732
+ return PasswordInputComponent;
733
+ }(AbstractInputComponent));
734
+
735
+ /**
736
+ * @fileoverview added by tsickle
737
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
738
+ */
739
+ /**
740
+ * @template T
741
+ */
742
+ var SelectInputComponent = /** @class */ (function (_super) {
743
+ __extends(SelectInputComponent, _super);
744
+ function SelectInputComponent() {
745
+ var _this = _super.call(this) || this;
746
+ _this.optionLabelFormat = (/**
747
+ * @param {?} option
748
+ * @return {?}
749
+ */
750
+ function (option) { return (option && _this.optionLabel) ? option[_this.optionLabel] : option; });
751
+ return _this;
752
+ }
762
753
  /**
763
754
  * @return {?}
764
755
  */
756
+ SelectInputComponent.prototype.ngOnInit = /**
757
+ * @return {?}
758
+ */
765
759
  function () {
766
- /** @type {?} */
767
- var dimension = this.focusTarget.getBoundingClientRect();
768
- /** @type {?} */
769
- var hasSize = dimension.height >= 0 && dimension.height >= 0;
770
- // tslint:disable-next-line:no-string-literal
771
- return hasSize && !this.focusTarget['disabled'];
772
760
  };
773
- FocusBindingDirective.decorators = [
774
- { type: Directive, args: [{
775
- // tslint:disable-next-line:directive-selector
776
- selector: '[pectinFocusBinding]'
777
- },] }
761
+ SelectInputComponent.decorators = [
762
+ { type: Component, args: [{
763
+ selector: 'aup-select-input',
764
+ 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",
765
+ styles: [":host{display:inline-block}mat-form-field{width:100%}"]
766
+ }] }
778
767
  ];
779
768
  /** @nocollapse */
780
- FocusBindingDirective.ctorParameters = function () { return [
781
- { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
782
- { type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
783
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
784
- ]; };
785
- FocusBindingDirective.propDecorators = {
786
- pectinFocusBinding: [{ type: Input }],
787
- focusBindingTarget: [{ type: Input }],
788
- onFocusIn: [{ type: HostListener, args: ['focusin',] }],
789
- onFocusOut: [{ type: HostListener, args: ['focusout',] }]
769
+ SelectInputComponent.ctorParameters = function () { return []; };
770
+ SelectInputComponent.propDecorators = {
771
+ optionsModel: [{ type: Input }],
772
+ options: [{ type: Input }],
773
+ optionLabel: [{ type: Input }],
774
+ optionLabelFormat: [{ type: Input }]
790
775
  };
791
- return FocusBindingDirective;
792
- }(DisposableComponent));
776
+ __decorate([
777
+ UseDelegate(),
778
+ __metadata("design:type", ListModel)
779
+ ], SelectInputComponent.prototype, "optionsModel", void 0);
780
+ __decorate([
781
+ StoreInListModel('optionsModel'),
782
+ __metadata("design:type", Array)
783
+ ], SelectInputComponent.prototype, "options", void 0);
784
+ return SelectInputComponent;
785
+ }(AbstractInputComponent));
793
786
  if (false) {
794
- /**
795
- * @type {?}
796
- * @private
797
- */
798
- FocusBindingDirective.prototype.document;
799
787
  /** @type {?} */
800
- FocusBindingDirective.prototype.pectinFocusBinding;
788
+ SelectInputComponent.prototype.optionsModel;
801
789
  /** @type {?} */
802
- FocusBindingDirective.prototype.focusBindingTarget;
790
+ SelectInputComponent.prototype.options;
791
+ /** @type {?} */
792
+ SelectInputComponent.prototype.optionLabel;
793
+ /** @type {?} */
794
+ SelectInputComponent.prototype.optionLabelFormat;
795
+ }
796
+
797
+ /**
798
+ * @fileoverview added by tsickle
799
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
800
+ */
801
+ var StringInputComponent = /** @class */ (function (_super) {
802
+ __extends(StringInputComponent, _super);
803
+ function StringInputComponent() {
804
+ return _super.call(this) || this;
805
+ }
803
806
  /**
804
- * @type {?}
805
- * @private
807
+ * @return {?}
806
808
  */
807
- FocusBindingDirective.prototype.el;
808
- /**
809
- * @type {?}
810
- * @private
809
+ StringInputComponent.prototype.ngOnInit = /**
810
+ * @return {?}
811
811
  */
812
- FocusBindingDirective.prototype.ngZone;
813
- }
812
+ function () {
813
+ };
814
+ StringInputComponent.decorators = [
815
+ { type: Component, args: [{
816
+ selector: 'aup-string-input',
817
+ 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",
818
+ styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
819
+ }] }
820
+ ];
821
+ /** @nocollapse */
822
+ StringInputComponent.ctorParameters = function () { return []; };
823
+ return StringInputComponent;
824
+ }(AbstractInputComponent));
825
+
826
+ /**
827
+ * @fileoverview added by tsickle
828
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
829
+ */
830
+ var NoopComponent = /** @class */ (function () {
831
+ function NoopComponent() {
832
+ }
833
+ NoopComponent.decorators = [
834
+ { type: Component, args: [{
835
+ selector: 'aup-noop',
836
+ template: "",
837
+ styles: [":host{display:block}"]
838
+ }] }
839
+ ];
840
+ /** @nocollapse */
841
+ NoopComponent.ctorParameters = function () { return []; };
842
+ return NoopComponent;
843
+ }());
844
+
845
+ /**
846
+ * @fileoverview added by tsickle
847
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
848
+ */
849
+ var ComponentsModule = /** @class */ (function () {
850
+ function ComponentsModule() {
851
+ }
852
+ ComponentsModule.decorators = [
853
+ { type: NgModule, args: [{
854
+ declarations: [
855
+ NumberInputComponent,
856
+ StringInputComponent,
857
+ PasswordInputComponent,
858
+ SelectInputComponent,
859
+ NoopComponent
860
+ ],
861
+ imports: [
862
+ CommonModule,
863
+ BrowserAnimationsModule,
864
+ FormsModule,
865
+ MatInputModule,
866
+ MatFormFieldModule,
867
+ MatSelectModule,
868
+ MatTabsModule,
869
+ DirectivesModule
870
+ ],
871
+ exports: [
872
+ NumberInputComponent,
873
+ StringInputComponent,
874
+ PasswordInputComponent,
875
+ SelectInputComponent,
876
+ NoopComponent
877
+ ]
878
+ },] }
879
+ ];
880
+ return ComponentsModule;
881
+ }());
814
882
 
815
883
  /**
816
884
  * @fileoverview added by tsickle
@@ -1103,7 +1171,7 @@ var ActivityOutletComponent = /** @class */ (function () {
1103
1171
  });
1104
1172
  ActivityOutletComponent.decorators = [
1105
1173
  { type: Component, args: [{
1106
- selector: 'angular-ui-powerups-activity-outlet',
1174
+ selector: 'aup-activity-outlet',
1107
1175
  template: '',
1108
1176
  styles: [":host{display:block}"]
1109
1177
  }] }
@@ -1194,9 +1262,9 @@ var AlertDialogComponent = /** @class */ (function (_super) {
1194
1262
  };
1195
1263
  AlertDialogComponent.decorators = [
1196
1264
  { type: Component, args: [{
1197
- selector: 'angular-ui-powerups-alert-dialog',
1265
+ selector: 'aup-alert-dialog',
1198
1266
  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",
1199
- styles: [":host{display:block;padding:var(--angular-ui-powerups-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1267
+ styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1200
1268
  }] }
1201
1269
  ];
1202
1270
  /** @nocollapse */
@@ -1275,9 +1343,9 @@ var ConfirmThenDialogComponent = /** @class */ (function (_super) {
1275
1343
  };
1276
1344
  ConfirmThenDialogComponent.decorators = [
1277
1345
  { type: Component, args: [{
1278
- selector: 'angular-ui-powerups-confirmation-dialog',
1346
+ selector: 'aup-confirmation-dialog',
1279
1347
  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",
1280
- styles: [":host{display:block;padding:var(--angular-ui-powerups-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1348
+ styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1281
1349
  }] }
1282
1350
  ];
1283
1351
  /** @nocollapse */
@@ -1341,9 +1409,9 @@ var ConfirmationDialogComponent = /** @class */ (function (_super) {
1341
1409
  };
1342
1410
  ConfirmationDialogComponent.decorators = [
1343
1411
  { type: Component, args: [{
1344
- selector: 'angular-ui-powerups-confirmation-dialog',
1412
+ selector: 'aup-confirmation-dialog',
1345
1413
  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",
1346
- styles: [":host{display:block;padding:var(--angular-ui-powerups-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1414
+ styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1347
1415
  }] }
1348
1416
  ];
1349
1417
  /** @nocollapse */
@@ -1482,15 +1550,17 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
1482
1550
  __extends(ActivityContainerComponent, _super);
1483
1551
  function ActivityContainerComponent() {
1484
1552
  var _this = _super.call(this) || this;
1485
- _this.activityFinishedEvents = new MutableStream();
1553
+ _this.throttledNestedActivityFinishEvents = new MutableStream();
1554
+ // tslint:disable-next-line:no-output-rename
1555
+ _this.initialActivityOutletContextEvent = new EventEmitter();
1556
+ _this.dynamicHeight = false;
1486
1557
  _this.activityTabs = new MutableListModel();
1487
- _this.finished = false;
1488
1558
  _this._activityList = new MutableListModel();
1489
1559
  var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
1490
- chain(_this.activityFinishedEvents).throttle(50).subscribe((/**
1560
+ chain(_this.throttledNestedActivityFinishEvents).throttle(50).subscribe((/**
1491
1561
  * @return {?}
1492
1562
  */
1493
- function () { return _this.onActivityFinished(); }));
1563
+ function () { return _this.onNestedActivityFinished(); }));
1494
1564
  return _this;
1495
1565
  }
1496
1566
  Object.defineProperty(ActivityContainerComponent.prototype, "initialActivityOutletContext", {
@@ -1498,33 +1568,37 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
1498
1568
  * @return {?}
1499
1569
  */
1500
1570
  function () {
1501
- return this.activityTabs.length > 0 ? this.activityTabs.value[0] : null;
1571
+ return this._initialActivityOutletContext;
1502
1572
  },
1503
1573
  set: /**
1504
1574
  * @param {?} initialContext
1505
1575
  * @return {?}
1506
1576
  */
1507
1577
  function (initialContext) {
1508
- var _this = this;
1509
- assert.isNil(this.initialActivityOutletContext);
1510
- this.activityTabs.push(new TabContext(initialContext.activityData, initialContext.activityClass, this, {
1511
- onDone: (/**
1512
- * @param {?} result
1513
- * @return {?}
1514
- */
1515
- function (result) {
1516
- _this.finished = true;
1517
- return initialContext.onDone(result);
1518
- }),
1519
- onCancel: (/**
1520
- * @param {?} error
1521
- * @return {?}
1522
- */
1523
- function (error) {
1524
- _this.finished = true;
1525
- return initialContext.onCancel(error);
1526
- })
1527
- }));
1578
+ assert.isNil(this._initialActivityOutletContext);
1579
+ /** @type {?} */
1580
+ var self = this;
1581
+ if (initialContext) {
1582
+ this._initialActivityOutletContext = initialContext;
1583
+ this.activityTabs.push(new TabContext(initialContext.activityData, initialContext.activityClass, this, {
1584
+ onDone: (/**
1585
+ * @param {?} result
1586
+ * @return {?}
1587
+ */
1588
+ function (result) {
1589
+ self.finishInitialActivity();
1590
+ initialContext.onDone(result);
1591
+ }),
1592
+ onCancel: (/**
1593
+ * @param {?} error
1594
+ * @return {?}
1595
+ */
1596
+ function (error) {
1597
+ self.finishInitialActivity();
1598
+ initialContext.onCancel(error);
1599
+ })
1600
+ }));
1601
+ }
1528
1602
  },
1529
1603
  enumerable: true,
1530
1604
  configurable: true
@@ -1536,7 +1610,7 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
1536
1610
  * @return {?}
1537
1611
  */
1538
1612
  function () {
1539
- return this.parentInteractionContext.isActive();
1613
+ return this._activityList.length > 0;
1540
1614
  };
1541
1615
  Object.defineProperty(ActivityContainerComponent.prototype, "activityList", {
1542
1616
  get: /**
@@ -1548,6 +1622,16 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
1548
1622
  enumerable: true,
1549
1623
  configurable: true
1550
1624
  });
1625
+ Object.defineProperty(ActivityContainerComponent.prototype, "isFinished", {
1626
+ get: /**
1627
+ * @return {?}
1628
+ */
1629
+ function () {
1630
+ return !this._initialActivityOutletContext;
1631
+ },
1632
+ enumerable: true,
1633
+ configurable: true
1634
+ });
1551
1635
  /**
1552
1636
  * @return {?}
1553
1637
  */
@@ -1608,7 +1692,7 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
1608
1692
  */
1609
1693
  function (result) {
1610
1694
  resolve(result);
1611
- self.activityFinishedEvents.publish({});
1695
+ self.throttledNestedActivityFinishEvents.publish({});
1612
1696
  }),
1613
1697
  onCancel: (/**
1614
1698
  * @param {?} error
@@ -1616,7 +1700,7 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
1616
1700
  */
1617
1701
  function (error) {
1618
1702
  reject(error);
1619
- self.activityFinishedEvents.publish({});
1703
+ self.throttledNestedActivityFinishEvents.publish({});
1620
1704
  })
1621
1705
  });
1622
1706
  self.activityTabs.push(context);
@@ -1666,13 +1750,27 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
1666
1750
  data: data
1667
1751
  });
1668
1752
  };
1753
+ /**
1754
+ * @private
1755
+ * @return {?}
1756
+ */
1757
+ ActivityContainerComponent.prototype.finishInitialActivity = /**
1758
+ * @private
1759
+ * @return {?}
1760
+ */
1761
+ function () {
1762
+ this._initialActivityOutletContext = null;
1763
+ this.activityTabs.value = [];
1764
+ this._activityList.value = [];
1765
+ this.initialActivityOutletContextEvent.emit(null);
1766
+ };
1669
1767
  // @Trace()
1670
1768
  // @Trace()
1671
1769
  /**
1672
1770
  * @private
1673
1771
  * @return {?}
1674
1772
  */
1675
- ActivityContainerComponent.prototype.onActivityFinished =
1773
+ ActivityContainerComponent.prototype.onNestedActivityFinished =
1676
1774
  // @Trace()
1677
1775
  /**
1678
1776
  * @private
@@ -1680,12 +1778,10 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
1680
1778
  */
1681
1779
  function () {
1682
1780
  // don't do anything if job already queued up.
1683
- if (!this.finished) {
1684
- if (this.synchroniseSelectedTabIndex()) {
1685
- this.cleanupStaleActivities();
1686
- }
1687
- this.updateActivityList();
1781
+ if (this.synchroniseSelectedTabIndex()) {
1782
+ this.cleanupStaleNestedActivities();
1688
1783
  }
1784
+ this.updateActivityList();
1689
1785
  };
1690
1786
  // @Trace()
1691
1787
  // @Trace()
@@ -1693,7 +1789,7 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
1693
1789
  * @private
1694
1790
  * @return {?}
1695
1791
  */
1696
- ActivityContainerComponent.prototype.cleanupStaleActivities =
1792
+ ActivityContainerComponent.prototype.cleanupStaleNestedActivities =
1697
1793
  // @Trace()
1698
1794
  /**
1699
1795
  * @private
@@ -1701,7 +1797,6 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
1701
1797
  */
1702
1798
  function () {
1703
1799
  var _this = this;
1704
- // clean up old tabs
1705
1800
  if (this.tabs.selectedIndex < this.activityTabs.length - 1) {
1706
1801
  this.activityTabs.runInTransaction((/**
1707
1802
  * @param {?} draft
@@ -1746,88 +1841,254 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
1746
1841
  * @private
1747
1842
  * @return {?}
1748
1843
  */
1749
- ActivityContainerComponent.prototype.onAnimationFinished =
1750
- // @Trace()
1751
- /**
1752
- * @private
1844
+ ActivityContainerComponent.prototype.onAnimationFinished =
1845
+ // @Trace()
1846
+ /**
1847
+ * @private
1848
+ * @return {?}
1849
+ */
1850
+ function () {
1851
+ this.getSelectedOutlet().component.onActivityReady();
1852
+ this.cleanupStaleNestedActivities();
1853
+ this.updateActivityList();
1854
+ };
1855
+ /**
1856
+ * @private
1857
+ * @return {?}
1858
+ */
1859
+ ActivityContainerComponent.prototype.updateActivityList = /**
1860
+ * @private
1861
+ * @return {?}
1862
+ */
1863
+ function () {
1864
+ this._activityList.value = this.activityTabs.value.filter((/**
1865
+ * @param {?} t
1866
+ * @return {?}
1867
+ */
1868
+ function (t) { return !t.isComplete() && t.isComponentRealised(); })).map((/**
1869
+ * @param {?} t
1870
+ * @return {?}
1871
+ */
1872
+ function (t) { return t.component; }));
1873
+ };
1874
+ /**
1875
+ * @private
1876
+ * @return {?}
1877
+ */
1878
+ ActivityContainerComponent.prototype.getSelectedOutlet = /**
1879
+ * @private
1880
+ * @return {?}
1881
+ */
1882
+ function () {
1883
+ return this.outlets.toArray()[this.tabs.selectedIndex];
1884
+ };
1885
+ ActivityContainerComponent.decorators = [
1886
+ { type: Component, args: [{
1887
+ selector: 'aup-activity-container',
1888
+ 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",
1889
+ styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}"]
1890
+ }] }
1891
+ ];
1892
+ /** @nocollapse */
1893
+ ActivityContainerComponent.ctorParameters = function () { return []; };
1894
+ ActivityContainerComponent.propDecorators = {
1895
+ initialActivityOutletContext: [{ type: Input }],
1896
+ initialActivityOutletContextEvent: [{ type: Output, args: ['initialActivityOutletContext',] }],
1897
+ dynamicHeight: [{ type: Input }],
1898
+ tabs: [{ type: ViewChild, args: ['tabs', { static: true },] }],
1899
+ outlets: [{ type: ViewChildren, args: [ActivityOutletComponent,] }]
1900
+ };
1901
+ return ActivityContainerComponent;
1902
+ }(InteractionContext));
1903
+ if (false) {
1904
+ /**
1905
+ * @type {?}
1906
+ * @private
1907
+ */
1908
+ ActivityContainerComponent.prototype.throttledNestedActivityFinishEvents;
1909
+ /**
1910
+ * @type {?}
1911
+ * @private
1912
+ */
1913
+ ActivityContainerComponent.prototype._initialActivityOutletContext;
1914
+ /** @type {?} */
1915
+ ActivityContainerComponent.prototype.initialActivityOutletContextEvent;
1916
+ /** @type {?} */
1917
+ ActivityContainerComponent.prototype.dynamicHeight;
1918
+ /** @type {?} */
1919
+ ActivityContainerComponent.prototype.tabs;
1920
+ /** @type {?} */
1921
+ ActivityContainerComponent.prototype.outlets;
1922
+ /** @type {?} */
1923
+ ActivityContainerComponent.prototype.activityTabs;
1924
+ /**
1925
+ * @type {?}
1926
+ * @private
1927
+ */
1928
+ ActivityContainerComponent.prototype._activityList;
1929
+ }
1930
+
1931
+ /**
1932
+ * @fileoverview added by tsickle
1933
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1934
+ */
1935
+ /**
1936
+ * @template D, R, E
1937
+ */
1938
+ var InplaceInteractionContextComponent = /** @class */ (function (_super) {
1939
+ __extends(InplaceInteractionContextComponent, _super);
1940
+ function InplaceInteractionContextComponent() {
1941
+ return _super.call(this) || this;
1942
+ }
1943
+ /**
1944
+ * @return {?}
1945
+ */
1946
+ InplaceInteractionContextComponent.prototype.ngOnInit = /**
1947
+ * @return {?}
1948
+ */
1949
+ function () {
1950
+ };
1951
+ Object.defineProperty(InplaceInteractionContextComponent.prototype, "activityList", {
1952
+ get: /**
1953
+ * @return {?}
1954
+ */
1955
+ function () {
1956
+ return this.interactionContext.activityList;
1957
+ },
1958
+ enumerable: true,
1959
+ configurable: true
1960
+ });
1961
+ /**
1962
+ * @return {?}
1963
+ */
1964
+ InplaceInteractionContextComponent.prototype.isActive = /**
1965
+ * @return {?}
1966
+ */
1967
+ function () {
1968
+ return this.interactionContext.isActive();
1969
+ };
1970
+ /**
1971
+ * @param {?} alert
1972
+ * @return {?}
1973
+ */
1974
+ InplaceInteractionContextComponent.prototype.alert = /**
1975
+ * @param {?} alert
1976
+ * @return {?}
1977
+ */
1978
+ function (alert) {
1979
+ // TODO: Test disableClose === false
1980
+ return this._startActivity(AlertDialogComponent, alert);
1981
+ };
1982
+ /**
1983
+ * @param {?} confirm
1984
+ * @return {?}
1985
+ */
1986
+ InplaceInteractionContextComponent.prototype.confirm = /**
1987
+ * @param {?} confirm
1988
+ * @return {?}
1989
+ */
1990
+ function (confirm) {
1991
+ return this._startActivity(ConfirmationDialogComponent, confirm);
1992
+ };
1993
+ /**
1994
+ * @template D1, R1, E1
1995
+ * @param {?} confirm
1996
+ * @param {?} activityType
1997
+ * @param {?=} data
1998
+ * @return {?}
1999
+ */
2000
+ InplaceInteractionContextComponent.prototype.confirmThen = /**
2001
+ * @template D1, R1, E1
2002
+ * @param {?} confirm
2003
+ * @param {?} activityType
2004
+ * @param {?=} data
1753
2005
  * @return {?}
1754
2006
  */
1755
- function () {
1756
- this.getSelectedOutlet().component.onActivityReady();
1757
- this.cleanupStaleActivities();
1758
- this.updateActivityList();
2007
+ function (confirm, activityType, data) {
2008
+ return this._startActivity(ConfirmThenDialogComponent, {
2009
+ confirm: confirm,
2010
+ activityType: activityType,
2011
+ data: data
2012
+ });
1759
2013
  };
1760
2014
  /**
1761
- * @private
2015
+ * @template D1, R1, E1
2016
+ * @param {?} activityType
2017
+ * @param {?=} data
1762
2018
  * @return {?}
1763
2019
  */
1764
- ActivityContainerComponent.prototype.updateActivityList = /**
1765
- * @private
2020
+ InplaceInteractionContextComponent.prototype.startActivity = /**
2021
+ * @template D1, R1, E1
2022
+ * @param {?} activityType
2023
+ * @param {?=} data
1766
2024
  * @return {?}
1767
2025
  */
1768
- function () {
1769
- this._activityList.value = this.activityTabs.value.filter((/**
1770
- * @param {?} t
1771
- * @return {?}
1772
- */
1773
- function (t) { return !t.isComplete() && t.isComponentRealised(); })).map((/**
1774
- * @param {?} t
1775
- * @return {?}
1776
- */
1777
- function (t) { return t.component; }));
2026
+ function (activityType, data) {
2027
+ return this._startActivity(activityType, data);
1778
2028
  };
1779
2029
  /**
1780
- * @private
2030
+ * @protected
2031
+ * @template D1, R1, E1
2032
+ * @param {?} activityType
2033
+ * @param {?=} data
1781
2034
  * @return {?}
1782
2035
  */
1783
- ActivityContainerComponent.prototype.getSelectedOutlet = /**
1784
- * @private
2036
+ InplaceInteractionContextComponent.prototype._startActivity = /**
2037
+ * @protected
2038
+ * @template D1, R1, E1
2039
+ * @param {?} activityType
2040
+ * @param {?=} data
1785
2041
  * @return {?}
1786
2042
  */
1787
- function () {
1788
- return this.outlets.toArray()[this.tabs.selectedIndex];
2043
+ function (activityType, data) {
2044
+ var _this = this;
2045
+ /** @type {?} */
2046
+ var self = this;
2047
+ return new Promise((/**
2048
+ * @param {?} resolve
2049
+ * @param {?} reject
2050
+ * @return {?}
2051
+ */
2052
+ function (resolve, reject) {
2053
+ _this.interactionContext.initialActivityOutletContext = {
2054
+ activityClass: activityType,
2055
+ activityData: data,
2056
+ onDone: /**
2057
+ * @param {?} result
2058
+ * @return {?}
2059
+ */
2060
+ function (result) {
2061
+ resolve(result);
2062
+ },
2063
+ onCancel: /**
2064
+ * @param {?} error
2065
+ * @return {?}
2066
+ */
2067
+ function (error) {
2068
+ reject(error);
2069
+ }
2070
+ };
2071
+ }));
1789
2072
  };
1790
- ActivityContainerComponent.decorators = [
2073
+ InplaceInteractionContextComponent.decorators = [
1791
2074
  { type: Component, args: [{
1792
- selector: 'angular-ui-powerups-activity-container',
1793
- template: "<mat-tab-group #tabs no-tab-header [dynamicHeight]=\"true\">\n <mat-tab *ngFor=\"let tab of activityTabs.value\">\n <angular-ui-powerups-activity-outlet [interactionContext]=\"this\"\n [activityContext]=\"tab\"></angular-ui-powerups-activity-outlet>\n </mat-tab>\n</mat-tab-group>\n",
1794
- styles: [":host{display:block}"]
2075
+ selector: 'aup-inplace-interaction-context',
2076
+ 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",
2077
+ styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}"]
1795
2078
  }] }
1796
2079
  ];
1797
2080
  /** @nocollapse */
1798
- ActivityContainerComponent.ctorParameters = function () { return []; };
1799
- ActivityContainerComponent.propDecorators = {
1800
- parentInteractionContext: [{ type: Input }],
1801
- initialActivityOutletContext: [{ type: Input }],
1802
- tabs: [{ type: ViewChild, args: ['tabs', { static: true },] }],
1803
- outlets: [{ type: ViewChildren, args: [ActivityOutletComponent,] }]
2081
+ InplaceInteractionContextComponent.ctorParameters = function () { return []; };
2082
+ InplaceInteractionContextComponent.propDecorators = {
2083
+ interactionContext: [{ type: ViewChild, args: ["activityContainer", { static: true },] }]
1804
2084
  };
1805
- return ActivityContainerComponent;
2085
+ return InplaceInteractionContextComponent;
1806
2086
  }(InteractionContext));
1807
2087
  if (false) {
1808
- /**
1809
- * @type {?}
1810
- * @private
1811
- */
1812
- ActivityContainerComponent.prototype.activityFinishedEvents;
1813
- /** @type {?} */
1814
- ActivityContainerComponent.prototype.parentInteractionContext;
1815
- /** @type {?} */
1816
- ActivityContainerComponent.prototype.tabs;
1817
2088
  /** @type {?} */
1818
- ActivityContainerComponent.prototype.outlets;
2089
+ InplaceInteractionContextComponent.prototype.interactionContext;
1819
2090
  /** @type {?} */
1820
- ActivityContainerComponent.prototype.activityTabs;
1821
- /**
1822
- * @type {?}
1823
- * @private
1824
- */
1825
- ActivityContainerComponent.prototype.finished;
1826
- /**
1827
- * @type {?}
1828
- * @private
1829
- */
1830
- ActivityContainerComponent.prototype._activityList;
2091
+ InplaceInteractionContextComponent.prototype.initialActivityContext;
1831
2092
  }
1832
2093
 
1833
2094
  /**
@@ -1839,7 +2100,7 @@ var InteractionOutletComponent = /** @class */ (function () {
1839
2100
  }
1840
2101
  InteractionOutletComponent.decorators = [
1841
2102
  { type: Component, args: [{
1842
- selector: 'angular-ui-powerups-interaction-outlet',
2103
+ selector: 'aup-interaction-outlet',
1843
2104
  template: "<router-outlet name=\"interaction-context\"></router-outlet>\n",
1844
2105
  styles: [":host{display:block}"]
1845
2106
  }] }
@@ -1928,7 +2189,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
1928
2189
  * @return {?}
1929
2190
  */
1930
2191
  function () {
1931
- return !!this.currentActivityId;
2192
+ return this._activityList.length > 0;
1932
2193
  };
1933
2194
  /**
1934
2195
  * @return {?}
@@ -1994,7 +2255,8 @@ var DialogInteractionService = /** @class */ (function (_super) {
1994
2255
  * @return {?}
1995
2256
  */
1996
2257
  function () {
1997
- _this.currentActivityId = v1();
2258
+ console.log('###### STARTING');
2259
+ // this.currentActivityId = uuid.v1();
1998
2260
  // this.location.go(this.router.routerState.snapshot.url, "aup");
1999
2261
  /** @type {?} */
2000
2262
  var self = _this;
@@ -2014,7 +2276,6 @@ var DialogInteractionService = /** @class */ (function (_super) {
2014
2276
  function (resolve, reject) {
2015
2277
  /** @type {?} */
2016
2278
  var activityContainer = matDialogRef.componentInstance;
2017
- activityContainer.parentInteractionContext = _this;
2018
2279
  self.safelyUpdateActivityListDelegate(activityContainer.activityList);
2019
2280
  activityContainer.initialActivityOutletContext = {
2020
2281
  activityClass: activityType,
@@ -2036,13 +2297,16 @@ var DialogInteractionService = /** @class */ (function (_super) {
2036
2297
  matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
2037
2298
  }
2038
2299
  };
2300
+ // we need to check if our onDone/onCancel methods above we called or if we were
2301
+ // closed by the user clicking the backdrop. If the later then we need to reject
2302
+ // our promise.
2039
2303
  matDialogRef.afterClosed().subscribe((/**
2040
2304
  * @param {?} promiseAlreadyFinished
2041
2305
  * @return {?}
2042
2306
  */
2043
2307
  function (promiseAlreadyFinished) {
2044
2308
  if (!promiseAlreadyFinished) {
2045
- reject("auto-closed");
2309
+ reject('auto-closed');
2046
2310
  }
2047
2311
  }));
2048
2312
  matDialogRef.updateSize();
@@ -2050,7 +2314,8 @@ var DialogInteractionService = /** @class */ (function (_super) {
2050
2314
  * @return {?}
2051
2315
  */
2052
2316
  function () {
2053
- _this.currentActivityId = null;
2317
+ console.log('###### FINISHED');
2318
+ // this.currentActivityId = null;
2054
2319
  self.safelyUpdateActivityListDelegate(null);
2055
2320
  }));
2056
2321
  }));
@@ -2180,7 +2445,7 @@ var InteractionModule = /** @class */ (function () {
2180
2445
  CommonModule,
2181
2446
  MatButtonModule,
2182
2447
  MatDialogModule,
2183
- MatTabsModule,
2448
+ MatTabsModule$1,
2184
2449
  PortalModule,
2185
2450
  RouterModule
2186
2451
  ],
@@ -2190,12 +2455,14 @@ var InteractionModule = /** @class */ (function () {
2190
2455
  ConfirmThenDialogComponent,
2191
2456
  AlertDialogComponent,
2192
2457
  ActivityOutletComponent,
2193
- InteractionOutletComponent
2458
+ InteractionOutletComponent,
2459
+ InplaceInteractionContextComponent
2194
2460
  ],
2195
2461
  exports: [
2196
2462
  ActivityContainerComponent,
2197
2463
  ActivityOutletComponent,
2198
- InteractionOutletComponent
2464
+ InteractionOutletComponent,
2465
+ InplaceInteractionContextComponent
2199
2466
  ],
2200
2467
  entryComponents: [
2201
2468
  ActivityContainerComponent,
@@ -2228,7 +2495,7 @@ var BusyOverlayComponent = /** @class */ (function () {
2228
2495
  };
2229
2496
  BusyOverlayComponent.decorators = [
2230
2497
  { type: Component, args: [{
2231
- selector: 'angular-ui-powerups-busy-overlay',
2498
+ selector: 'aup-busy-overlay',
2232
2499
  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",
2233
2500
  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}"]
2234
2501
  }] }
@@ -2273,9 +2540,9 @@ var EmptyStateComponent = /** @class */ (function () {
2273
2540
  };
2274
2541
  EmptyStateComponent.decorators = [
2275
2542
  { type: Component, args: [{
2276
- selector: 'angular-ui-powerups-empty-state',
2543
+ selector: 'aup-empty-state',
2277
2544
  template: "\n <div class=\"container\">\n <ng-content></ng-content>\n </div>\n ",
2278
- styles: [":host{display:flex;flex-direction:column;justify-content:center;align-items:center}.container{padding:var(--angular-ui-powerups-default-padding);border:2px dashed rgba(0,0,0,.2);border-radius:5px;font-size:14px;font-weight:300}"]
2545
+ 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}"]
2279
2546
  }] }
2280
2547
  ];
2281
2548
  /** @nocollapse */
@@ -2590,11 +2857,10 @@ if (false) {
2590
2857
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2591
2858
  */
2592
2859
  var PlaceDefinition = /** @class */ (function () {
2593
- function PlaceDefinition(component, path, authenticate, order, data, routeParameters, children) {
2860
+ function PlaceDefinition(component, path, authenticate, data, routeParameters, children) {
2594
2861
  this.component = component;
2595
2862
  this.path = path;
2596
2863
  this.authenticate = authenticate;
2597
- this.order = order;
2598
2864
  this.data = data;
2599
2865
  this.routeParameters = routeParameters;
2600
2866
  this.children = children;
@@ -2900,8 +3166,6 @@ if (false) {
2900
3166
  /** @type {?} */
2901
3167
  PlaceDefinition.prototype.authenticate;
2902
3168
  /** @type {?} */
2903
- PlaceDefinition.prototype.order;
2904
- /** @type {?} */
2905
3169
  PlaceDefinition.prototype.data;
2906
3170
  /** @type {?} */
2907
3171
  PlaceDefinition.prototype.routeParameters;
@@ -3051,6 +3315,8 @@ if (false) {
3051
3315
  * @private
3052
3316
  */
3053
3317
  PlaceComponent.prototype.visit;
3318
+ /** @type {?} */
3319
+ PlaceComponent.prototype.interactionContext;
3054
3320
  }
3055
3321
  (function (PlaceComponent) {
3056
3322
  /**
@@ -3092,136 +3358,182 @@ if (false) {
3092
3358
  * @fileoverview added by tsickle
3093
3359
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3094
3360
  */
3095
- var AbstractPlaceNavigationComponent = /** @class */ (function (_super) {
3096
- __extends(AbstractPlaceNavigationComponent, _super);
3097
- function AbstractPlaceNavigationComponent() {
3098
- var _this = _super.call(this) || this;
3099
- var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
3100
- _this.placeDefinitions = chain(_this.placesModel).map((/**
3101
- * @param {?} c
3102
- * @return {?}
3103
- */
3104
- function (c) { return PlaceComponent.getDefinition(c); }));
3105
- return _this;
3361
+ /**
3362
+ * @record
3363
+ */
3364
+ function Params() { }
3365
+ var Visit = /** @class */ (function () {
3366
+ function Visit(placeDefinition, visitParameters) {
3367
+ if (visitParameters === void 0) { visitParameters = {}; }
3368
+ this.placeDefinition = placeDefinition;
3369
+ this.visitParameters = visitParameters;
3106
3370
  }
3371
+ // @Trace()
3372
+ // @Trace()
3107
3373
  /**
3108
- * @param {?} placeDef
3109
3374
  * @return {?}
3110
3375
  */
3111
- AbstractPlaceNavigationComponent.prototype.getNav = /**
3112
- * @param {?} placeDef
3376
+ Visit.prototype.getRouteId =
3377
+ // @Trace()
3378
+ /**
3113
3379
  * @return {?}
3114
3380
  */
3115
- function (placeDef) {
3116
- /** @type {?} */
3117
- var navItem = (/** @type {?} */ (placeDef.getPlaceData('nav')));
3118
- return {
3119
- title: (/**
3120
- * @return {?}
3121
- */
3122
- function () { return navItem ? navItem.title() : placeDef.searchPlaceData(['navTitle', 'title']); }),
3123
- tooltip: (/**
3124
- * @return {?}
3125
- */
3126
- function () { return navItem && navItem.tooltip ? navItem.tooltip() : placeDef.getPlaceData('navTooltip', null); }),
3127
- icon: (/**
3128
- * @return {?}
3129
- */
3130
- function () { return navItem && navItem.icon ? navItem.icon() : placeDef.getPlaceData('navIcon', null); })
3131
- };
3381
+ function () {
3382
+ return this.placeDefinition.getRouteIdFrom(this);
3132
3383
  };
3384
+ // @Trace()
3385
+ // @Trace()
3133
3386
  /**
3134
3387
  * @return {?}
3135
3388
  */
3136
- AbstractPlaceNavigationComponent.prototype.ngOnInit = /**
3389
+ Visit.prototype.hasRouteId =
3390
+ // @Trace()
3391
+ /**
3137
3392
  * @return {?}
3138
3393
  */
3139
3394
  function () {
3395
+ return !isNil(this.getRouteId());
3140
3396
  };
3141
- AbstractPlaceNavigationComponent.propDecorators = {
3142
- places: [{ type: Input }],
3143
- placesModel: [{ type: Input }]
3397
+ /**
3398
+ * Returns the value of the place parameter with the specified name. The parameter
3399
+ * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
3400
+ * same as the the ValueModel property name.
3401
+ * @param parameterName the field name of the property model or the `as` option if specified.
3402
+ */
3403
+ /**
3404
+ * Returns the value of the place parameter with the specified name. The parameter
3405
+ * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
3406
+ * same as the the ValueModel property name.
3407
+ * @param {?} parameterName the field name of the property model or the `as` option if specified.
3408
+ * @return {?}
3409
+ */
3410
+ Visit.prototype.getParameter = /**
3411
+ * Returns the value of the place parameter with the specified name. The parameter
3412
+ * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
3413
+ * same as the the ValueModel property name.
3414
+ * @param {?} parameterName the field name of the property model or the `as` option if specified.
3415
+ * @return {?}
3416
+ */
3417
+ function (parameterName) {
3418
+ return this.visitParameters[parameterName];
3419
+ };
3420
+ // @Trace()
3421
+ // @Trace()
3422
+ /**
3423
+ * @param {?} parameterName
3424
+ * @return {?}
3425
+ */
3426
+ Visit.prototype.hasParameter =
3427
+ // @Trace()
3428
+ /**
3429
+ * @param {?} parameterName
3430
+ * @return {?}
3431
+ */
3432
+ function (parameterName) {
3433
+ return Object.keys(this.visitParameters).includes(parameterName);
3434
+ };
3435
+ /**
3436
+ * @template S
3437
+ * @param {?} parameter
3438
+ * @param {?} value
3439
+ * @return {?}
3440
+ */
3441
+ Visit.prototype.replace = /**
3442
+ * @template S
3443
+ * @param {?} parameter
3444
+ * @param {?} value
3445
+ * @return {?}
3446
+ */
3447
+ function (parameter, value) {
3448
+ var _a;
3449
+ return new Visit(this.placeDefinition, __assign({}, this.visitParameters, (_a = {}, _a[parameter.name] = value, _a)));
3450
+ };
3451
+ /**
3452
+ * @template S
3453
+ * @param {?} routeParams
3454
+ * @return {?}
3455
+ */
3456
+ Visit.prototype.mergeRouteParameters = /**
3457
+ * @template S
3458
+ * @param {?} routeParams
3459
+ * @return {?}
3460
+ */
3461
+ function (routeParams) {
3462
+ var _this = this;
3463
+ // todo: whitelist parameters.
3464
+ /** @type {?} */
3465
+ var routeParameterKeys = Object.keys(routeParams);
3466
+ /** @type {?} */
3467
+ var params = {};
3468
+ this.placeDefinition.getVisitParameterDefs().forEach((/**
3469
+ * @param {?} def
3470
+ * @return {?}
3471
+ */
3472
+ function (def) {
3473
+ if (def.isRouteId || def.isRouteParameter) {
3474
+ if (routeParameterKeys.includes(def.name)) {
3475
+ params[def.name] = routeParams[def.name];
3476
+ }
3477
+ }
3478
+ else {
3479
+ // copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
3480
+ // defaults and remember sanitisation process.
3481
+ if (_this.hasParameter(def.name)) {
3482
+ params[def.name] = _this.getParameter(def.name);
3483
+ }
3484
+ }
3485
+ }));
3486
+ return new Visit(this.placeDefinition, params);
3144
3487
  };
3145
- __decorate([
3146
- StoreInListModel('placesModel'),
3147
- __metadata("design:type", Array)
3148
- ], AbstractPlaceNavigationComponent.prototype, "places", void 0);
3149
- __decorate([
3150
- UseDelegate(),
3151
- __metadata("design:type", ListModel)
3152
- ], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
3153
- __decorate([
3154
- Memoize(),
3155
- __metadata("design:type", Function),
3156
- __metadata("design:paramtypes", [PlaceDefinition]),
3157
- __metadata("design:returntype", Object)
3158
- ], AbstractPlaceNavigationComponent.prototype, "getNav", null);
3159
- return AbstractPlaceNavigationComponent;
3160
- }(DisposableComponent));
3161
- if (false) {
3162
- /** @type {?} */
3163
- AbstractPlaceNavigationComponent.prototype.places;
3164
- /** @type {?} */
3165
- AbstractPlaceNavigationComponent.prototype.placesModel;
3166
- /** @type {?} */
3167
- AbstractPlaceNavigationComponent.prototype.placeDefinitions;
3168
- }
3169
-
3170
- /**
3171
- * @fileoverview added by tsickle
3172
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3173
- */
3174
- var ListPlaceNavComponent = /** @class */ (function (_super) {
3175
- __extends(ListPlaceNavComponent, _super);
3176
- function ListPlaceNavComponent() {
3177
- var _this = _super.call(this) || this;
3178
- _this.expanded = true;
3179
- return _this;
3180
- }
3181
3488
  /**
3489
+ * @param {?} other
3182
3490
  * @return {?}
3183
3491
  */
3184
- ListPlaceNavComponent.prototype.expandMenu = /**
3492
+ Visit.prototype.hasRoutingChangedFrom = /**
3493
+ * @param {?} other
3185
3494
  * @return {?}
3186
3495
  */
3187
- function () {
3188
- this.expanded = true;
3496
+ function (other) {
3497
+ /** @type {?} */
3498
+ var samePlace = other.placeDefinition === this.placeDefinition;
3499
+ /** @type {?} */
3500
+ var sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
3501
+ return !samePlace || !sameRouteParameters;
3189
3502
  };
3190
3503
  /**
3504
+ * @param {?} other
3191
3505
  * @return {?}
3192
3506
  */
3193
- ListPlaceNavComponent.prototype.collapseMenu = /**
3507
+ Visit.prototype.hasChangedFrom = /**
3508
+ * @param {?} other
3194
3509
  * @return {?}
3195
3510
  */
3196
- function () {
3197
- this.expanded = false;
3511
+ function (other) {
3512
+ /** @type {?} */
3513
+ var sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
3514
+ return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
3198
3515
  };
3199
3516
  /**
3200
3517
  * @return {?}
3201
3518
  */
3202
- ListPlaceNavComponent.prototype.toggleMenu = /**
3519
+ Visit.prototype.getUrlSegments = /**
3203
3520
  * @return {?}
3204
3521
  */
3205
3522
  function () {
3206
- this.expanded = !this.expanded;
3207
- };
3208
- ListPlaceNavComponent.decorators = [
3209
- { type: Component, args: [{
3210
- selector: 'angular-ui-powerups-list-place-nav',
3211
- 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",
3212
- 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}"]
3213
- }] }
3214
- ];
3215
- /** @nocollapse */
3216
- ListPlaceNavComponent.ctorParameters = function () { return []; };
3217
- ListPlaceNavComponent.propDecorators = {
3218
- expanded: [{ type: HostBinding, args: ['class.expanded',] }]
3523
+ return this.placeDefinition.hasRouteId() ?
3524
+ [new UrlSegment(this.placeDefinition.path, {}), new UrlSegment(this.placeDefinition.getFormattedRouteId(this), this.placeDefinition.getFormattedRouteParameters(this))] :
3525
+ [new UrlSegment(this.placeDefinition.path, this.placeDefinition.getFormattedRouteParameters(this))];
3219
3526
  };
3220
- return ListPlaceNavComponent;
3221
- }(AbstractPlaceNavigationComponent));
3527
+ return Visit;
3528
+ }());
3222
3529
  if (false) {
3223
3530
  /** @type {?} */
3224
- ListPlaceNavComponent.prototype.expanded;
3531
+ Visit.prototype.placeDefinition;
3532
+ /**
3533
+ * @type {?}
3534
+ * @private
3535
+ */
3536
+ Visit.prototype.visitParameters;
3225
3537
  }
3226
3538
 
3227
3539
  /**
@@ -3479,196 +3791,25 @@ var PlaceHistory = /** @class */ (function () {
3479
3791
  { type: Injectable, args: [{
3480
3792
  providedIn: 'root'
3481
3793
  },] }
3482
- ];
3483
- /** @nocollapse */
3484
- PlaceHistory.ctorParameters = function () { return [
3485
- { type: Router }
3486
- ]; };
3487
- /** @nocollapse */ PlaceHistory.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(ɵɵinject(Router)); }, token: PlaceHistory, providedIn: "root" });
3488
- return PlaceHistory;
3489
- }());
3490
- if (false) {
3491
- /**
3492
- * @type {?}
3493
- * @private
3494
- */
3495
- PlaceHistory.prototype._history;
3496
- /**
3497
- * @type {?}
3498
- * @private
3499
- */
3500
- PlaceHistory.prototype.router;
3501
- }
3502
-
3503
- /**
3504
- * @fileoverview added by tsickle
3505
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3506
- */
3507
- /**
3508
- * @record
3509
- */
3510
- function Params() { }
3511
- var Visit = /** @class */ (function () {
3512
- function Visit(placeDefinition, visitParameters) {
3513
- if (visitParameters === void 0) { visitParameters = {}; }
3514
- this.placeDefinition = placeDefinition;
3515
- this.visitParameters = visitParameters;
3516
- }
3517
- // @Trace()
3518
- // @Trace()
3519
- /**
3520
- * @return {?}
3521
- */
3522
- Visit.prototype.getRouteId =
3523
- // @Trace()
3524
- /**
3525
- * @return {?}
3526
- */
3527
- function () {
3528
- return this.placeDefinition.getRouteIdFrom(this);
3529
- };
3530
- // @Trace()
3531
- // @Trace()
3532
- /**
3533
- * @return {?}
3534
- */
3535
- Visit.prototype.hasRouteId =
3536
- // @Trace()
3537
- /**
3538
- * @return {?}
3539
- */
3540
- function () {
3541
- return !isNil(this.getRouteId());
3542
- };
3543
- /**
3544
- * Returns the value of the place parameter with the specified name. The parameter
3545
- * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
3546
- * same as the the ValueModel property name.
3547
- * @param parameterName the field name of the property model or the `as` option if specified.
3548
- */
3549
- /**
3550
- * Returns the value of the place parameter with the specified name. The parameter
3551
- * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
3552
- * same as the the ValueModel property name.
3553
- * @param {?} parameterName the field name of the property model or the `as` option if specified.
3554
- * @return {?}
3555
- */
3556
- Visit.prototype.getParameter = /**
3557
- * Returns the value of the place parameter with the specified name. The parameter
3558
- * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
3559
- * same as the the ValueModel property name.
3560
- * @param {?} parameterName the field name of the property model or the `as` option if specified.
3561
- * @return {?}
3562
- */
3563
- function (parameterName) {
3564
- return this.visitParameters[parameterName];
3565
- };
3566
- // @Trace()
3567
- // @Trace()
3568
- /**
3569
- * @param {?} parameterName
3570
- * @return {?}
3571
- */
3572
- Visit.prototype.hasParameter =
3573
- // @Trace()
3574
- /**
3575
- * @param {?} parameterName
3576
- * @return {?}
3577
- */
3578
- function (parameterName) {
3579
- return Object.keys(this.visitParameters).includes(parameterName);
3580
- };
3581
- /**
3582
- * @template S
3583
- * @param {?} parameter
3584
- * @param {?} value
3585
- * @return {?}
3586
- */
3587
- Visit.prototype.replace = /**
3588
- * @template S
3589
- * @param {?} parameter
3590
- * @param {?} value
3591
- * @return {?}
3592
- */
3593
- function (parameter, value) {
3594
- var _a;
3595
- return new Visit(this.placeDefinition, __assign({}, this.visitParameters, (_a = {}, _a[parameter.name] = value, _a)));
3596
- };
3597
- /**
3598
- * @template S
3599
- * @param {?} routeParams
3600
- * @return {?}
3601
- */
3602
- Visit.prototype.mergeRouteParameters = /**
3603
- * @template S
3604
- * @param {?} routeParams
3605
- * @return {?}
3606
- */
3607
- function (routeParams) {
3608
- var _this = this;
3609
- // todo: whitelist parameters.
3610
- /** @type {?} */
3611
- var routeParameterKeys = Object.keys(routeParams);
3612
- /** @type {?} */
3613
- var params = {};
3614
- this.placeDefinition.getVisitParameterDefs().forEach((/**
3615
- * @param {?} def
3616
- * @return {?}
3617
- */
3618
- function (def) {
3619
- if (def.isRouteId || def.isRouteParameter) {
3620
- if (routeParameterKeys.includes(def.name)) {
3621
- params[def.name] = routeParams[def.name];
3622
- }
3623
- }
3624
- else {
3625
- // copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
3626
- // defaults and remember sanitisation process.
3627
- if (_this.hasParameter(def.name)) {
3628
- params[def.name] = _this.getParameter(def.name);
3629
- }
3630
- }
3631
- }));
3632
- return new Visit(this.placeDefinition, params);
3633
- };
3634
- /**
3635
- * @param {?} other
3636
- * @return {?}
3637
- */
3638
- Visit.prototype.hasRoutingChangedFrom = /**
3639
- * @param {?} other
3640
- * @return {?}
3641
- */
3642
- function (other) {
3643
- /** @type {?} */
3644
- var samePlace = other.placeDefinition === this.placeDefinition;
3645
- /** @type {?} */
3646
- var sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
3647
- return !samePlace || !sameRouteParameters;
3648
- };
3649
- /**
3650
- * @param {?} other
3651
- * @return {?}
3652
- */
3653
- Visit.prototype.hasChangedFrom = /**
3654
- * @param {?} other
3655
- * @return {?}
3656
- */
3657
- function (other) {
3658
- /** @type {?} */
3659
- var sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
3660
- return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
3661
- };
3662
- return Visit;
3794
+ ];
3795
+ /** @nocollapse */
3796
+ PlaceHistory.ctorParameters = function () { return [
3797
+ { type: Router }
3798
+ ]; };
3799
+ /** @nocollapse */ PlaceHistory.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(ɵɵinject(Router)); }, token: PlaceHistory, providedIn: "root" });
3800
+ return PlaceHistory;
3663
3801
  }());
3664
3802
  if (false) {
3665
- /** @type {?} */
3666
- Visit.prototype.placeDefinition;
3667
3803
  /**
3668
3804
  * @type {?}
3669
3805
  * @private
3670
3806
  */
3671
- Visit.prototype.visitParameters;
3807
+ PlaceHistory.prototype._history;
3808
+ /**
3809
+ * @type {?}
3810
+ * @private
3811
+ */
3812
+ PlaceHistory.prototype.router;
3672
3813
  }
3673
3814
 
3674
3815
  /**
@@ -3800,13 +3941,17 @@ var PlaceRouter = /** @class */ (function (_super) {
3800
3941
  });
3801
3942
  });
3802
3943
  };
3944
+ // @Trace()
3945
+ // @Trace()
3803
3946
  /**
3804
3947
  * @param {?} activatedRoute
3805
3948
  * @param {?} previous
3806
3949
  * @param {?} next
3807
3950
  * @return {?}
3808
3951
  */
3809
- PlaceRouter.prototype.pushVisitChangesToRoute = /**
3952
+ PlaceRouter.prototype.pushVisitChangesToRoute =
3953
+ // @Trace()
3954
+ /**
3810
3955
  * @param {?} activatedRoute
3811
3956
  * @param {?} previous
3812
3957
  * @param {?} next
@@ -3826,13 +3971,16 @@ var PlaceRouter = /** @class */ (function (_super) {
3826
3971
  * @return {?}
3827
3972
  */
3828
3973
  function (router) {
3974
+ // we have to to use the definition for route id as our redirection always includes
3975
+ // the id in the url segements (but leaves it blank when there's no id). I.e. in the
3976
+ // no id case we're doing the following redirect [<placePath>, ""] -> ["..", <id>]
3829
3977
  /** @type {?} */
3830
3978
  var relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
3831
3979
  /** @type {?} */
3832
3980
  var commands = __spread([
3833
3981
  relativePath
3834
3982
  ], _this.createRouteParameters(next), _this.extractChildPath(activatedRoute.snapshot));
3835
- console.log('### Redirect', commands);
3983
+ console.log('### Push Changes to route Redirect', { commands: commands, relativeTo: activatedRoute.snapshot.url });
3836
3984
  return router.navigate(commands, {
3837
3985
  relativeTo: activatedRoute
3838
3986
  });
@@ -3981,12 +4129,6 @@ var PlaceRouter = /** @class */ (function (_super) {
3981
4129
  __metadata("design:paramtypes", [Visit, Object]),
3982
4130
  __metadata("design:returntype", Promise)
3983
4131
  ], PlaceRouter.prototype, "navigate", null);
3984
- __decorate([
3985
- Trace(),
3986
- __metadata("design:type", Function),
3987
- __metadata("design:paramtypes", [ActivatedRoute, Visit, Visit]),
3988
- __metadata("design:returntype", Promise)
3989
- ], PlaceRouter.prototype, "pushVisitChangesToRoute", null);
3990
4132
  return PlaceRouter;
3991
4133
  }(GarbageCollector));
3992
4134
  if (false) {
@@ -4100,18 +4242,45 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4100
4242
  var _this = _super.call(this) || this;
4101
4243
  _this.router = router;
4102
4244
  _this.placeRouter = placeRouter;
4103
- _this.parentOutlet = parentOutlet;
4104
4245
  _this.animate = true;
4105
4246
  _this.placeChanged = new EventEmitter();
4106
4247
  _this._activePlace = new MutableValueModel();
4248
+ _this._placeVisit = new MutableValueModel();
4107
4249
  _this._inOutletUpdate = new Guard$1();
4108
4250
  _this._activatedRouteModel = new MutableValueModel();
4109
4251
  _this._placeDefinition = new MutableValueModel();
4110
- /**
4111
- * TODO: This is now really a visit
4112
- */
4113
- _this._placeVisit = new MutableValueModel();
4252
+ _this.isOnInitialPlace = true;
4114
4253
  var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
4254
+ _this.parentOutletModel = new MutableValueModel(parentOutlet);
4255
+ /** @type {?} */
4256
+ var defaultPlaceAnimationOrder = chain(_this.parentOutletModel)
4257
+ .pullValueModel((/**
4258
+ * @param {?} o
4259
+ * @return {?}
4260
+ */
4261
+ function (o) { return o.activePlaceModel; }))
4262
+ .pluck("placeDefinition")
4263
+ .pluckList("children")
4264
+ .pluck("component");
4265
+ /** @type {?} */
4266
+ var activatePlaceType = chain(_this.activePlaceModel).map((/**
4267
+ * @param {?} p
4268
+ * @return {?}
4269
+ */
4270
+ function (p) { return (/** @type {?} */ (p.constructor)); }));
4271
+ _this.placeAnimationOrder = chain(_this.customPlaceAnimationOrderModel)
4272
+ .otherwise(defaultPlaceAnimationOrder)
4273
+ .indexOf(activatePlaceType)
4274
+ .map((/**
4275
+ * @param {?} order
4276
+ * @return {?}
4277
+ */
4278
+ function (order) {
4279
+ // we get -1 on the first load which triggers an animation to the first page, so alway pin it to 0
4280
+ // if we're animating.
4281
+ return _this.isOnInitialPlace ? 0 :
4282
+ _this.animate ? Math.max(order, 0) : 0;
4283
+ }));
4115
4284
  // Push incoming changes into the component
4116
4285
  /** @type {?} */
4117
4286
  var routeVisit = chain(_this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
@@ -4175,6 +4344,16 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4175
4344
  relativeTo: this.parentOutlet ? this.parentOutlet.activatedRouteModel.value : null
4176
4345
  });
4177
4346
  };
4347
+ Object.defineProperty(PlaceOutletComponent.prototype, "parentOutlet", {
4348
+ get: /**
4349
+ * @return {?}
4350
+ */
4351
+ function () {
4352
+ return this.parentOutletModel.value;
4353
+ },
4354
+ enumerable: true,
4355
+ configurable: true
4356
+ });
4178
4357
  /**
4179
4358
  * @param {?} next
4180
4359
  * @param {?} previous
@@ -4210,12 +4389,16 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4210
4389
  enumerable: true,
4211
4390
  configurable: true
4212
4391
  });
4392
+ // @Trace()
4393
+ // @Trace()
4213
4394
  /**
4214
4395
  * @param {?} routerOutlet
4215
4396
  * @param {?} place
4216
4397
  * @return {?}
4217
4398
  */
4218
- PlaceOutletComponent.prototype.onOutletActivated = /**
4399
+ PlaceOutletComponent.prototype.onOutletActivated =
4400
+ // @Trace()
4401
+ /**
4219
4402
  * @param {?} routerOutlet
4220
4403
  * @param {?} place
4221
4404
  * @return {?}
@@ -4241,132 +4424,307 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4241
4424
  this.animationDone();
4242
4425
  }
4243
4426
  };
4427
+ // @Trace()
4428
+ // @Trace()
4429
+ /**
4430
+ * @param {?} routerOutlet
4431
+ * @param {?} $event
4432
+ * @return {?}
4433
+ */
4434
+ PlaceOutletComponent.prototype.onOutletDeactivated =
4435
+ // @Trace()
4436
+ /**
4437
+ * @param {?} routerOutlet
4438
+ * @param {?} $event
4439
+ * @return {?}
4440
+ */
4441
+ function (routerOutlet, $event) {
4442
+ var _this = this;
4443
+ this._inOutletUpdate.whileTrue((/**
4444
+ * @return {?}
4445
+ */
4446
+ function () {
4447
+ _this.isOnInitialPlace = false;
4448
+ _this._activePlace.value = null;
4449
+ _this._activatedRouteModel.value = null;
4450
+ _this._placeDefinition.value = null;
4451
+ }));
4452
+ };
4453
+ /**
4454
+ * @return {?}
4455
+ */
4456
+ PlaceOutletComponent.prototype.animationDone = /**
4457
+ * @return {?}
4458
+ */
4459
+ function () {
4460
+ if (this._activePlace.value) {
4461
+ this._activePlace.value.onPlaceReady();
4462
+ }
4463
+ };
4464
+ PlaceOutletComponent.decorators = [
4465
+ { type: Component, args: [{
4466
+ selector: 'aup-place-outlet',
4467
+ 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",
4468
+ animations: [LEFT_RIGHT_PLACE_ANIMATION],
4469
+ 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}"]
4470
+ }] }
4471
+ ];
4472
+ /** @nocollapse */
4473
+ PlaceOutletComponent.ctorParameters = function () { return [
4474
+ { type: Router },
4475
+ { type: PlaceRouter },
4476
+ { type: PlaceOutletComponent, decorators: [{ type: SkipSelf }, { type: Optional }] }
4477
+ ]; };
4478
+ PlaceOutletComponent.propDecorators = {
4479
+ animate: [{ type: Input }],
4480
+ customPlaceAnimationOrderModel: [{ type: Input, args: ['placeAnimationOrderModel',] }],
4481
+ customPlaceAnimationOrder: [{ type: Input, args: ['placeAnimationOrder',] }],
4482
+ placeChanged: [{ type: Output }],
4483
+ routerOut: [{ type: ViewChild, args: ['routeOutlet', { static: true },] }]
4484
+ };
4485
+ __decorate([
4486
+ UseDelegate(),
4487
+ __metadata("design:type", ListModel)
4488
+ ], PlaceOutletComponent.prototype, "customPlaceAnimationOrderModel", void 0);
4489
+ __decorate([
4490
+ StoreInListModel("customPlaceAnimationOrderModel"),
4491
+ __metadata("design:type", Array)
4492
+ ], PlaceOutletComponent.prototype, "customPlaceAnimationOrder", void 0);
4493
+ __decorate([
4494
+ Trace(),
4495
+ __metadata("design:type", Function),
4496
+ __metadata("design:paramtypes", [Visit]),
4497
+ __metadata("design:returntype", void 0)
4498
+ ], PlaceOutletComponent.prototype, "navigate", null);
4499
+ return PlaceOutletComponent;
4500
+ }(DisposableComponent));
4501
+ if (false) {
4502
+ /** @type {?} */
4503
+ PlaceOutletComponent.prototype.animate;
4504
+ /** @type {?} */
4505
+ PlaceOutletComponent.prototype.customPlaceAnimationOrderModel;
4506
+ /** @type {?} */
4507
+ PlaceOutletComponent.prototype.customPlaceAnimationOrder;
4508
+ /** @type {?} */
4509
+ PlaceOutletComponent.prototype.placeChanged;
4510
+ /** @type {?} */
4511
+ PlaceOutletComponent.prototype.routerOut;
4512
+ /**
4513
+ * @type {?}
4514
+ * @private
4515
+ */
4516
+ PlaceOutletComponent.prototype._activePlace;
4517
+ /**
4518
+ * @type {?}
4519
+ * @private
4520
+ */
4521
+ PlaceOutletComponent.prototype._placeVisit;
4522
+ /**
4523
+ * @type {?}
4524
+ * @private
4525
+ */
4526
+ PlaceOutletComponent.prototype._inOutletUpdate;
4527
+ /**
4528
+ * @type {?}
4529
+ * @private
4530
+ */
4531
+ PlaceOutletComponent.prototype._activatedRouteModel;
4532
+ /**
4533
+ * @type {?}
4534
+ * @private
4535
+ */
4536
+ PlaceOutletComponent.prototype._placeDefinition;
4537
+ /**
4538
+ * @type {?}
4539
+ * @private
4540
+ */
4541
+ PlaceOutletComponent.prototype.parentOutletModel;
4542
+ /** @type {?} */
4543
+ PlaceOutletComponent.prototype.placeAnimationOrder;
4544
+ /**
4545
+ * @type {?}
4546
+ * @private
4547
+ */
4548
+ PlaceOutletComponent.prototype.isOnInitialPlace;
4549
+ /**
4550
+ * @type {?}
4551
+ * @private
4552
+ */
4553
+ PlaceOutletComponent.prototype.router;
4554
+ /**
4555
+ * @type {?}
4556
+ * @private
4557
+ */
4558
+ PlaceOutletComponent.prototype.placeRouter;
4559
+ }
4560
+
4561
+ /**
4562
+ * @fileoverview added by tsickle
4563
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4564
+ */
4565
+ var AbstractPlaceNavigationComponent = /** @class */ (function (_super) {
4566
+ __extends(AbstractPlaceNavigationComponent, _super);
4567
+ function AbstractPlaceNavigationComponent() {
4568
+ var _this = _super.call(this) || this;
4569
+ var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
4570
+ _this.placeDefinitions = chain(_this.placesModel).map((/**
4571
+ * @param {?} c
4572
+ * @return {?}
4573
+ */
4574
+ function (c) { return PlaceComponent.getDefinition(c); }));
4575
+ _this.relativeToModel = chain(_this.placeOutletModel).pullValueModel((/**
4576
+ * @param {?} o
4577
+ * @return {?}
4578
+ */
4579
+ function (o) { return o.activatedRouteModel; }));
4580
+ _this.commandFactory = Command.createFactory((/**
4581
+ * @param {?} placeDefinition
4582
+ * @return {?}
4583
+ */
4584
+ function (placeDefinition) {
4585
+ _this.placeOutlet.navigate(new Visit(placeDefinition));
4586
+ }));
4587
+ return _this;
4588
+ }
4589
+ /**
4590
+ * @param {?} placeDef
4591
+ * @return {?}
4592
+ */
4593
+ AbstractPlaceNavigationComponent.prototype.getNav = /**
4594
+ * @param {?} placeDef
4595
+ * @return {?}
4596
+ */
4597
+ function (placeDef) {
4598
+ /** @type {?} */
4599
+ var navItem = (/** @type {?} */ (placeDef.getPlaceData('nav')));
4600
+ return {
4601
+ title: (/**
4602
+ * @return {?}
4603
+ */
4604
+ function () { return navItem ? navItem.title() : placeDef.searchPlaceData(['navTitle', 'title']); }),
4605
+ tooltip: (/**
4606
+ * @return {?}
4607
+ */
4608
+ function () { return navItem && navItem.tooltip ? navItem.tooltip() : placeDef.getPlaceData('navTooltip', null); }),
4609
+ icon: (/**
4610
+ * @return {?}
4611
+ */
4612
+ function () { return navItem && navItem.icon ? navItem.icon() : placeDef.getPlaceData('navIcon', null); })
4613
+ };
4614
+ };
4615
+ /**
4616
+ * @return {?}
4617
+ */
4618
+ AbstractPlaceNavigationComponent.prototype.ngOnInit = /**
4619
+ * @return {?}
4620
+ */
4621
+ function () {
4622
+ };
4623
+ AbstractPlaceNavigationComponent.propDecorators = {
4624
+ places: [{ type: Input }],
4625
+ placesModel: [{ type: Input }],
4626
+ placeOutlet: [{ type: Input }],
4627
+ placeOutletModel: [{ type: Input }]
4628
+ };
4629
+ __decorate([
4630
+ StoreInListModel('placesModel'),
4631
+ __metadata("design:type", Array)
4632
+ ], AbstractPlaceNavigationComponent.prototype, "places", void 0);
4633
+ __decorate([
4634
+ UseDelegate(),
4635
+ __metadata("design:type", ListModel)
4636
+ ], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
4637
+ __decorate([
4638
+ StoreInValueModel('placeOutletModel'),
4639
+ __metadata("design:type", PlaceOutletComponent)
4640
+ ], AbstractPlaceNavigationComponent.prototype, "placeOutlet", void 0);
4641
+ __decorate([
4642
+ UseDelegate(),
4643
+ __metadata("design:type", ValueModel)
4644
+ ], AbstractPlaceNavigationComponent.prototype, "placeOutletModel", void 0);
4645
+ __decorate([
4646
+ Memoize(),
4647
+ __metadata("design:type", Function),
4648
+ __metadata("design:paramtypes", [PlaceDefinition]),
4649
+ __metadata("design:returntype", Object)
4650
+ ], AbstractPlaceNavigationComponent.prototype, "getNav", null);
4651
+ return AbstractPlaceNavigationComponent;
4652
+ }(DisposableComponent));
4653
+ if (false) {
4654
+ /** @type {?} */
4655
+ AbstractPlaceNavigationComponent.prototype.places;
4656
+ /** @type {?} */
4657
+ AbstractPlaceNavigationComponent.prototype.placesModel;
4658
+ /** @type {?} */
4659
+ AbstractPlaceNavigationComponent.prototype.placeOutlet;
4660
+ /** @type {?} */
4661
+ AbstractPlaceNavigationComponent.prototype.placeOutletModel;
4662
+ /** @type {?} */
4663
+ AbstractPlaceNavigationComponent.prototype.placeDefinitions;
4664
+ /**
4665
+ * @type {?}
4666
+ * @protected
4667
+ */
4668
+ AbstractPlaceNavigationComponent.prototype.relativeToModel;
4669
+ /** @type {?} */
4670
+ AbstractPlaceNavigationComponent.prototype.commandFactory;
4671
+ }
4672
+
4673
+ /**
4674
+ * @fileoverview added by tsickle
4675
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4676
+ */
4677
+ var ListPlaceNavComponent = /** @class */ (function (_super) {
4678
+ __extends(ListPlaceNavComponent, _super);
4679
+ function ListPlaceNavComponent() {
4680
+ var _this = _super.call(this) || this;
4681
+ _this.expanded = true;
4682
+ return _this;
4683
+ }
4244
4684
  /**
4245
- * @param {?} routerOutlet
4246
- * @param {?} $event
4247
4685
  * @return {?}
4248
4686
  */
4249
- PlaceOutletComponent.prototype.onOutletDeactivated = /**
4250
- * @param {?} routerOutlet
4251
- * @param {?} $event
4687
+ ListPlaceNavComponent.prototype.expandMenu = /**
4252
4688
  * @return {?}
4253
4689
  */
4254
- function (routerOutlet, $event) {
4255
- var _this = this;
4256
- this._inOutletUpdate.whileTrue((/**
4257
- * @return {?}
4258
- */
4259
- function () {
4260
- _this._activePlace.value = null;
4261
- _this._activatedRouteModel.value = null;
4262
- _this._placeDefinition.value = null;
4263
- }));
4690
+ function () {
4691
+ this.expanded = true;
4264
4692
  };
4265
4693
  /**
4266
- * @param {?} outlet
4267
4694
  * @return {?}
4268
4695
  */
4269
- PlaceOutletComponent.prototype.getPlaceOrder = /**
4270
- * @param {?} outlet
4696
+ ListPlaceNavComponent.prototype.collapseMenu = /**
4271
4697
  * @return {?}
4272
4698
  */
4273
- function (outlet) {
4274
- return this.animate && outlet && outlet.activatedRouteData && outlet.activatedRouteData['placeOrder'];
4699
+ function () {
4700
+ this.expanded = false;
4275
4701
  };
4276
4702
  /**
4277
4703
  * @return {?}
4278
4704
  */
4279
- PlaceOutletComponent.prototype.animationDone = /**
4705
+ ListPlaceNavComponent.prototype.toggleMenu = /**
4280
4706
  * @return {?}
4281
4707
  */
4282
4708
  function () {
4283
- if (this._activePlace.value) {
4284
- this._activePlace.value.onPlaceReady();
4285
- }
4709
+ this.expanded = !this.expanded;
4286
4710
  };
4287
- PlaceOutletComponent.decorators = [
4711
+ ListPlaceNavComponent.decorators = [
4288
4712
  { type: Component, args: [{
4289
- selector: 'angular-ui-powerups-place-outlet',
4290
- template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"getPlaceOrder(routerOutlet)\"\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",
4291
- animations: [LEFT_RIGHT_PLACE_ANIMATION],
4292
- 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}"]
4713
+ selector: 'aup-list-place-nav',
4714
+ 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",
4715
+ 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}"]
4293
4716
  }] }
4294
4717
  ];
4295
4718
  /** @nocollapse */
4296
- PlaceOutletComponent.ctorParameters = function () { return [
4297
- { type: Router },
4298
- { type: PlaceRouter },
4299
- { type: PlaceOutletComponent, decorators: [{ type: SkipSelf }, { type: Optional }] }
4300
- ]; };
4301
- PlaceOutletComponent.propDecorators = {
4302
- animate: [{ type: Input }],
4303
- placeChanged: [{ type: Output }],
4304
- routerOut: [{ type: ViewChild, args: ['routeOutlet', { static: true },] }]
4719
+ ListPlaceNavComponent.ctorParameters = function () { return []; };
4720
+ ListPlaceNavComponent.propDecorators = {
4721
+ expanded: [{ type: HostBinding, args: ['class.expanded',] }]
4305
4722
  };
4306
- __decorate([
4307
- Trace(),
4308
- __metadata("design:type", Function),
4309
- __metadata("design:paramtypes", [Visit]),
4310
- __metadata("design:returntype", void 0)
4311
- ], PlaceOutletComponent.prototype, "navigate", null);
4312
- __decorate([
4313
- Trace(),
4314
- __metadata("design:type", Function),
4315
- __metadata("design:paramtypes", [RouterOutlet, PlaceComponent]),
4316
- __metadata("design:returntype", void 0)
4317
- ], PlaceOutletComponent.prototype, "onOutletActivated", null);
4318
- __decorate([
4319
- Trace(),
4320
- __metadata("design:type", Function),
4321
- __metadata("design:paramtypes", [RouterOutlet, Object]),
4322
- __metadata("design:returntype", void 0)
4323
- ], PlaceOutletComponent.prototype, "onOutletDeactivated", null);
4324
- return PlaceOutletComponent;
4325
- }(DisposableComponent));
4723
+ return ListPlaceNavComponent;
4724
+ }(AbstractPlaceNavigationComponent));
4326
4725
  if (false) {
4327
4726
  /** @type {?} */
4328
- PlaceOutletComponent.prototype.animate;
4329
- /** @type {?} */
4330
- PlaceOutletComponent.prototype.placeChanged;
4331
- /** @type {?} */
4332
- PlaceOutletComponent.prototype.routerOut;
4333
- /**
4334
- * @type {?}
4335
- * @private
4336
- */
4337
- PlaceOutletComponent.prototype._activePlace;
4338
- /**
4339
- * @type {?}
4340
- * @private
4341
- */
4342
- PlaceOutletComponent.prototype._inOutletUpdate;
4343
- /**
4344
- * @type {?}
4345
- * @private
4346
- */
4347
- PlaceOutletComponent.prototype._activatedRouteModel;
4348
- /**
4349
- * @type {?}
4350
- * @private
4351
- */
4352
- PlaceOutletComponent.prototype._placeDefinition;
4353
- /**
4354
- * TODO: This is now really a visit
4355
- * @type {?}
4356
- */
4357
- PlaceOutletComponent.prototype._placeVisit;
4358
- /**
4359
- * @type {?}
4360
- * @private
4361
- */
4362
- PlaceOutletComponent.prototype.router;
4363
- /**
4364
- * @type {?}
4365
- * @private
4366
- */
4367
- PlaceOutletComponent.prototype.placeRouter;
4368
- /** @type {?} */
4369
- PlaceOutletComponent.prototype.parentOutlet;
4727
+ ListPlaceNavComponent.prototype.expanded;
4370
4728
  }
4371
4729
 
4372
4730
  /**
@@ -4380,8 +4738,8 @@ var TabbedPlaceNavigationComponent = /** @class */ (function (_super) {
4380
4738
  }
4381
4739
  TabbedPlaceNavigationComponent.decorators = [
4382
4740
  { type: Component, args: [{
4383
- selector: 'angular-ui-powerups-tabbed-place-navigation',
4384
- template: "<nav mat-tab-nav-bar>\n <a mat-tab-link *ngFor=\"let place of placeDefinitions.value\"\n [routerLink]='place.path'\n [replaceUrl]=\"true\"\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",
4741
+ selector: 'aup-tabbed-place-navigation',
4742
+ 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",
4385
4743
  styles: [""]
4386
4744
  }] }
4387
4745
  ];
@@ -4404,10 +4762,11 @@ var PlaceModule = /** @class */ (function () {
4404
4762
  BrowserAnimationsModule,
4405
4763
  MatProgressSpinnerModule,
4406
4764
  RouterModule,
4407
- MatTabsModule$1,
4765
+ MatTabsModule,
4408
4766
  MatListModule,
4409
4767
  MatTooltipModule,
4410
- MatIconModule
4768
+ MatIconModule,
4769
+ DirectivesModule
4411
4770
  ],
4412
4771
  declarations: [
4413
4772
  EmptyStateComponent,
@@ -4439,15 +4798,7 @@ var AngularUiPowerupsModule = /** @class */ (function () {
4439
4798
  }
4440
4799
  AngularUiPowerupsModule.decorators = [
4441
4800
  { type: NgModule, args: [{
4442
- declarations: [
4443
- CommandDirective,
4444
- FocusBindingDirective,
4445
- NumberInputComponent,
4446
- StringInputComponent,
4447
- PasswordInputComponent,
4448
- SelectInputComponent,
4449
- NoopComponent
4450
- ],
4801
+ declarations: [],
4451
4802
  imports: [
4452
4803
  CommonModule,
4453
4804
  BrowserAnimationsModule,
@@ -4455,19 +4806,17 @@ var AngularUiPowerupsModule = /** @class */ (function () {
4455
4806
  MatInputModule,
4456
4807
  MatFormFieldModule,
4457
4808
  MatSelectModule,
4458
- MatTabsModule$1,
4809
+ MatTabsModule,
4810
+ DirectivesModule,
4811
+ ComponentsModule,
4459
4812
  PlaceModule,
4460
4813
  InteractionModule
4461
4814
  ],
4462
4815
  exports: [
4463
- CommandDirective,
4464
- FocusBindingDirective,
4465
- NumberInputComponent,
4466
- StringInputComponent,
4467
- PasswordInputComponent,
4468
- SelectInputComponent,
4469
4816
  InteractionModule,
4470
4817
  PlaceModule,
4818
+ DirectivesModule,
4819
+ ComponentsModule,
4471
4820
  NoopComponent
4472
4821
  ]
4473
4822
  },] }
@@ -4963,7 +5312,7 @@ function Place(options) {
4963
5312
  */
4964
5313
  function (target) {
4965
5314
  if (PlaceComponent.isPlaceComponentConstructor(target)) {
4966
- PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, isNil(options.authenticate) ? false : options.authenticate, options.order, options.data, PlaceComponent.getRouteParameters(target), (options.children || []).map((/**
5315
+ PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, isNil(options.authenticate) ? false : options.authenticate, options.data, PlaceComponent.getRouteParameters(target), (options.children || []).map((/**
4967
5316
  * @param {?} c
4968
5317
  * @return {?}
4969
5318
  */
@@ -4983,8 +5332,6 @@ function Place(options) {
4983
5332
  if (false) {
4984
5333
  /** @type {?} */
4985
5334
  Options.prototype.path;
4986
- /** @type {?} */
4987
- Options.prototype.order;
4988
5335
  /** @type {?|undefined} */
4989
5336
  Options.prototype.data;
4990
5337
  /** @type {?|undefined} */
@@ -5285,221 +5632,82 @@ var VisitSanitiser = /** @class */ (function () {
5285
5632
  return __generator(this, function (_a) {
5286
5633
  switch (_a.label) {
5287
5634
  case 0:
5288
- placeDef = visit.placeDefinition;
5289
- if (!placeDef.hasRouteId()) return [3 /*break*/, 2];
5290
- routeIdDef = placeDef.getRouteIdParameterDef();
5291
- routeId = visit.getRouteId();
5292
- return [4 /*yield*/, routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector)];
5293
- case 1:
5294
- sanitisedValue = _a.sent();
5295
- console.log({ routeId: routeId, sanitisedValue: sanitisedValue });
5296
- // ###------- EARLY EXIT --------###
5297
- if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
5298
- // if the route id has changed we redirect immediately as other
5299
- // parameter sanitisers might use it.
5300
- return [2 /*return*/, visit.replace(routeIdDef, sanitisedValue)];
5301
- }
5302
- _a.label = 2;
5303
- case 2:
5304
- // if we didn't replace the routeId we continue the url present parameters.
5305
- parameterDefs = placeDef.getVisitParameterDefs({
5306
- includeRouteParameters: true,
5307
- includeNonRouteParameters: true
5308
- });
5309
- sanitisedVisit = visit;
5310
- i = 0;
5311
- _a.label = 3;
5312
- case 3:
5313
- if (!(i < parameterDefs.length)) return [3 /*break*/, 6];
5314
- def = parameterDefs[i];
5315
- value = visit.getParameter(def.name);
5316
- return [4 /*yield*/, def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector)];
5317
- case 4:
5318
- sanitisedValue = _a.sent();
5319
- if (def.hasChanged(value, sanitisedValue)) {
5320
- sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
5321
- }
5322
- _a.label = 5;
5323
- case 5:
5324
- i++;
5325
- return [3 /*break*/, 3];
5326
- case 6: return [2 /*return*/, sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit];
5327
- }
5328
- });
5329
- });
5330
- };
5331
- return VisitSanitiser;
5332
- }());
5333
- if (false) {
5334
- /**
5335
- * @type {?}
5336
- * @private
5337
- */
5338
- VisitSanitiser.prototype.activatedRoute;
5339
- /**
5340
- * @type {?}
5341
- * @private
5342
- */
5343
- VisitSanitiser.prototype.router;
5344
- /**
5345
- * @type {?}
5346
- * @private
5347
- */
5348
- VisitSanitiser.prototype.placeHistory;
5349
- /**
5350
- * @type {?}
5351
- * @private
5352
- */
5353
- VisitSanitiser.prototype.injector;
5354
- }
5355
-
5356
- /**
5357
- * @fileoverview added by tsickle
5358
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5359
- */
5360
- var LeavePlaceGuard = /** @class */ (function () {
5361
- function LeavePlaceGuard(router, injector, placeRouter, interactionContext, angularLocation) {
5362
- this.router = router;
5363
- this.injector = injector;
5364
- this.placeRouter = placeRouter;
5365
- this.interactionContext = interactionContext;
5366
- this.angularLocation = angularLocation;
5367
- }
5368
- /**
5369
- * @private
5370
- * @param {?} nextState
5371
- * @param {?} placeDefinitionPath
5372
- * @return {?}
5373
- */
5374
- LeavePlaceGuard.prototype.isLeavingTheCurrentPlace = /**
5375
- * @private
5376
- * @param {?} nextState
5377
- * @param {?} placeDefinitionPath
5378
- * @return {?}
5379
- */
5380
- function (nextState, placeDefinitionPath) {
5381
- // TODO: this will break with child routes... need to examine the router states properly.
5382
- return !nextState.url.startsWith(placeDefinitionPath);
5383
- };
5384
- /**
5385
- * @param {?} component
5386
- * @param {?} currentRoute
5387
- * @param {?} currentState
5388
- * @param {?=} nextState
5389
- * @return {?}
5390
- */
5391
- LeavePlaceGuard.prototype.canDeactivate = /**
5392
- * @param {?} component
5393
- * @param {?} currentRoute
5394
- * @param {?} currentState
5395
- * @param {?=} nextState
5396
- * @return {?}
5397
- */
5398
- function (component, currentRoute, currentState, nextState) {
5399
- return __awaiter(this, void 0, void 0, function () {
5400
- var placeDefinitionPath, self_1, canLeave;
5401
- return __generator(this, function (_a) {
5402
- switch (_a.label) {
5403
- case 0:
5404
- placeDefinitionPath = "/" + component.placeDefinition.path;
5405
- if (!this.placeRouter.navigationSession.alreadyAccepted(component)) return [3 /*break*/, 1];
5406
- // We'll get called multiple times if there's any parameter sanitisation so
5407
- // we always return true if we accepted on a previous cycle of the current
5408
- // navigation session.
5409
- return [2 /*return*/, true];
5635
+ placeDef = visit.placeDefinition;
5636
+ if (!placeDef.hasRouteId()) return [3 /*break*/, 2];
5637
+ routeIdDef = placeDef.getRouteIdParameterDef();
5638
+ routeId = visit.getRouteId();
5639
+ return [4 /*yield*/, routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector)];
5410
5640
  case 1:
5411
- self_1 = this;
5412
- canLeave = true;
5413
- if (!this.isLeavingTheCurrentPlace(nextState, placeDefinitionPath)) return [3 /*break*/, 4];
5414
- // we check the interaction first, so that components that don't need to check if they're in an
5415
- // interaction during the canDeactivate cycle.
5416
- // TODO: Add tests: show dialog -> hit back -> same route
5417
- if (this.interactionContext.isActive()) {
5418
- canLeave = false;
5419
- console.log('cancelling', { activity: this.interactionContext.currentActivity });
5420
- this.interactionContext.currentActivity.cancel(null);
5641
+ sanitisedValue = _a.sent();
5642
+ console.log({ routeId: routeId, sanitisedValue: sanitisedValue });
5643
+ // ###------- EARLY EXIT --------###
5644
+ if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
5645
+ // if the route id has changed we redirect immediately as other
5646
+ // parameter sanitisers might use it.
5647
+ return [2 /*return*/, visit.replace(routeIdDef, sanitisedValue)];
5421
5648
  }
5422
- if (!canLeave) return [3 /*break*/, 3];
5423
- return [4 /*yield*/, component.canDeactivate()];
5649
+ _a.label = 2;
5424
5650
  case 2:
5425
- // TODO: Add tests: hit back -> confirm leave dialog -> hit back -> close dialog -> hit back -> confirm leave dialog.
5426
- canLeave = _a.sent();
5651
+ // if we didn't replace the routeId we continue the url present parameters.
5652
+ parameterDefs = placeDef.getVisitParameterDefs({
5653
+ includeRouteParameters: true,
5654
+ includeNonRouteParameters: true
5655
+ });
5656
+ sanitisedVisit = visit;
5657
+ i = 0;
5427
5658
  _a.label = 3;
5428
- case 3: return [3 /*break*/, 5];
5659
+ case 3:
5660
+ if (!(i < parameterDefs.length)) return [3 /*break*/, 6];
5661
+ def = parameterDefs[i];
5662
+ value = visit.getParameter(def.name);
5663
+ return [4 /*yield*/, def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector)];
5429
5664
  case 4:
5430
- if (this.interactionContext.isActive()) {
5431
- console.log('cancelling', { activity: this.interactionContext.currentActivity });
5432
- this.interactionContext.currentActivity.cancel(null);
5433
- canLeave = false;
5434
- }
5435
- else {
5436
- canLeave = true;
5665
+ sanitisedValue = _a.sent();
5666
+ if (def.hasChanged(value, sanitisedValue)) {
5667
+ sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
5437
5668
  }
5438
5669
  _a.label = 5;
5439
5670
  case 5:
5440
- if (canLeave) {
5441
- // We'll get called multiple times if there's any parameter sanitisation so
5442
- // we remember the acceptance for the duration of the current navigation session.
5443
- self_1.placeRouter.navigationSession.rememberAcceptanceOf(component);
5444
- }
5445
- else {
5446
- // Angular doesn't preserve the url when a guard cancels the back button.
5447
- // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
5448
- if (this.placeRouter.navigationSession.isPopState) {
5449
- console.log('cancelled during popstate');
5450
- this.angularLocation.go(this.placeRouter.navigationSession.popStateReturnUrl);
5451
- }
5452
- }
5453
- return [2 /*return*/, canLeave];
5671
+ i++;
5672
+ return [3 /*break*/, 3];
5673
+ case 6: return [2 /*return*/, sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit];
5454
5674
  }
5455
5675
  });
5456
5676
  });
5457
5677
  };
5458
- LeavePlaceGuard.decorators = [
5459
- { type: Injectable, args: [{
5460
- providedIn: 'root'
5461
- },] }
5462
- ];
5463
- /** @nocollapse */
5464
- LeavePlaceGuard.ctorParameters = function () { return [
5465
- { type: Router },
5466
- { type: Injector },
5467
- { type: PlaceRouter },
5468
- { type: InteractionContext },
5469
- { type: Location }
5470
- ]; };
5471
- /** @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" });
5472
- return LeavePlaceGuard;
5678
+ return VisitSanitiser;
5473
5679
  }());
5474
5680
  if (false) {
5475
5681
  /**
5476
5682
  * @type {?}
5477
5683
  * @private
5478
5684
  */
5479
- LeavePlaceGuard.prototype.router;
5685
+ VisitSanitiser.prototype.activatedRoute;
5480
5686
  /**
5481
5687
  * @type {?}
5482
5688
  * @private
5483
5689
  */
5484
- LeavePlaceGuard.prototype.injector;
5690
+ VisitSanitiser.prototype.router;
5485
5691
  /**
5486
5692
  * @type {?}
5487
5693
  * @private
5488
5694
  */
5489
- LeavePlaceGuard.prototype.placeRouter;
5490
- /** @type {?} */
5491
- LeavePlaceGuard.prototype.interactionContext;
5492
- /** @type {?} */
5493
- LeavePlaceGuard.prototype.angularLocation;
5695
+ VisitSanitiser.prototype.placeHistory;
5696
+ /**
5697
+ * @type {?}
5698
+ * @private
5699
+ */
5700
+ VisitSanitiser.prototype.injector;
5494
5701
  }
5495
5702
 
5496
5703
  /**
5497
5704
  * @fileoverview added by tsickle
5498
5705
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5499
5706
  */
5500
- var PlaceRouteGuard = /** @class */ (function () {
5501
- function PlaceRouteGuard(router, placeRouter, placeHistory, injector) {
5707
+ var EnterPlaceGuard = /** @class */ (function () {
5708
+ function EnterPlaceGuard(router, urlSerializer, placeRouter, placeHistory, injector) {
5502
5709
  this.router = router;
5710
+ this.urlSerializer = urlSerializer;
5503
5711
  this.placeRouter = placeRouter;
5504
5712
  this.placeHistory = placeHistory;
5505
5713
  this.injector = injector;
@@ -5511,7 +5719,7 @@ var PlaceRouteGuard = /** @class */ (function () {
5511
5719
  * @param {?} state
5512
5720
  * @return {?}
5513
5721
  */
5514
- PlaceRouteGuard.prototype.canActivate =
5722
+ EnterPlaceGuard.prototype.canActivate =
5515
5723
  // @Trace()
5516
5724
  /**
5517
5725
  * @param {?} activatedRoute
@@ -5520,14 +5728,14 @@ var PlaceRouteGuard = /** @class */ (function () {
5520
5728
  */
5521
5729
  function (activatedRoute, state) {
5522
5730
  return __awaiter(this, void 0, void 0, function () {
5523
- var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit, parameterCommands, commands;
5731
+ var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit, routerStateUrlTree, commands;
5524
5732
  return __generator(this, function (_a) {
5525
5733
  switch (_a.label) {
5526
5734
  case 0:
5527
5735
  if (!PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) return [3 /*break*/, 2];
5528
5736
  placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);
5529
5737
  // Parse our route params.
5530
- params = new PlaceRouteGuard.ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
5738
+ params = new EnterPlaceGuard.ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
5531
5739
  parsedParams = placeDefinition.parseRouteParams(params);
5532
5740
  initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
5533
5741
  sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
@@ -5537,11 +5745,10 @@ var PlaceRouteGuard = /** @class */ (function () {
5537
5745
  // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
5538
5746
  this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
5539
5747
  if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
5540
- parameterCommands = sanitisedVisit.hasRouteId() ?
5541
- [placeDefinition.getFormattedRouteId(sanitisedVisit), placeDefinition.getFormattedRouteParameters(sanitisedVisit)] :
5542
- [placeDefinition.getFormattedRouteParameters(sanitisedVisit)];
5543
- commands = [(activatedRoute.url[0].path)].concat(parameterCommands, this.placeRouter.extractChildPath(activatedRoute));
5544
- console.log('##### Redirect', commands);
5748
+ routerStateUrlTree = this.urlSerializer.parse(state.url);
5749
+ // Regenerate the url
5750
+ commands = this.createRedirectCommands(sanitisedVisit, __spread(routerStateUrlTree.root.children.primary.segments)).commands;
5751
+ console.log('##### Place Guard Redirect', commands);
5545
5752
  return [2 /*return*/, this.router.createUrlTree(commands, {
5546
5753
  replaceUrl: true,
5547
5754
  skipLocationChange: false
@@ -5557,44 +5764,90 @@ var PlaceRouteGuard = /** @class */ (function () {
5557
5764
  });
5558
5765
  });
5559
5766
  };
5560
- PlaceRouteGuard.decorators = [
5767
+ /**
5768
+ * @private
5769
+ * @param {?} sanitisedVisit
5770
+ * @param {?} path
5771
+ * @return {?}
5772
+ */
5773
+ EnterPlaceGuard.prototype.createRedirectCommands = /**
5774
+ * @private
5775
+ * @param {?} sanitisedVisit
5776
+ * @param {?} path
5777
+ * @return {?}
5778
+ */
5779
+ function (sanitisedVisit, path) {
5780
+ // Ugly, but it works for now.
5781
+ /** @type {?} */
5782
+ var newSegments = sanitisedVisit.getUrlSegments();
5783
+ /** @type {?} */
5784
+ var replaceAt = path.findIndex((/**
5785
+ * @param {?} segment
5786
+ * @return {?}
5787
+ */
5788
+ function (segment) { return segment.path === newSegments[0].path; }));
5789
+ /** @type {?} */
5790
+ var newPath = __spread(path);
5791
+ newPath.splice.apply(newPath, __spread([replaceAt, newSegments.length], newSegments)); // do not use the return value, it's the items that were removed!
5792
+ // do not use the return value, it's the items that were removed!
5793
+ /** @type {?} */
5794
+ var commands = [];
5795
+ newPath.forEach((/**
5796
+ * @param {?} s
5797
+ * @return {?}
5798
+ */
5799
+ function (s) {
5800
+ commands.push(s.path);
5801
+ if (s.parameterMap.keys.length > 0) {
5802
+ commands.push(s.parameters);
5803
+ }
5804
+ }));
5805
+ return { newPath: newPath, commands: commands };
5806
+ };
5807
+ EnterPlaceGuard.decorators = [
5561
5808
  { type: Injectable, args: [{
5562
5809
  providedIn: 'root'
5563
5810
  },] }
5564
5811
  ];
5565
5812
  /** @nocollapse */
5566
- PlaceRouteGuard.ctorParameters = function () { return [
5813
+ EnterPlaceGuard.ctorParameters = function () { return [
5567
5814
  { type: Router },
5815
+ { type: UrlSerializer },
5568
5816
  { type: PlaceRouter },
5569
5817
  { type: PlaceHistory },
5570
5818
  { type: Injector }
5571
5819
  ]; };
5572
- /** @nocollapse */ PlaceRouteGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouteGuard_Factory() { return new PlaceRouteGuard(ɵɵinject(Router), ɵɵinject(PlaceRouter), ɵɵinject(PlaceHistory), ɵɵinject(INJECTOR)); }, token: PlaceRouteGuard, providedIn: "root" });
5573
- return PlaceRouteGuard;
5820
+ /** @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" });
5821
+ return EnterPlaceGuard;
5574
5822
  }());
5575
5823
  if (false) {
5576
5824
  /**
5577
5825
  * @type {?}
5578
5826
  * @private
5579
5827
  */
5580
- PlaceRouteGuard.prototype.router;
5828
+ EnterPlaceGuard.prototype.router;
5829
+ /**
5830
+ * @type {?}
5831
+ * @private
5832
+ */
5833
+ EnterPlaceGuard.prototype.urlSerializer;
5581
5834
  /**
5582
5835
  * @type {?}
5583
5836
  * @private
5584
5837
  */
5585
- PlaceRouteGuard.prototype.placeRouter;
5838
+ EnterPlaceGuard.prototype.placeRouter;
5586
5839
  /**
5587
5840
  * @type {?}
5588
5841
  * @private
5589
5842
  */
5590
- PlaceRouteGuard.prototype.placeHistory;
5843
+ EnterPlaceGuard.prototype.placeHistory;
5591
5844
  /**
5592
5845
  * @type {?}
5593
5846
  * @private
5594
5847
  */
5595
- PlaceRouteGuard.prototype.injector;
5848
+ EnterPlaceGuard.prototype.injector;
5596
5849
  }
5597
- (function (PlaceRouteGuard) {
5850
+ (function (EnterPlaceGuard) {
5598
5851
  /**
5599
5852
  * This a work around for the fact that an activated route with multiple segments doesn't
5600
5853
  * include the segment params in the paramMap as well as each segment returns an empty
@@ -5683,7 +5936,7 @@ if (false) {
5683
5936
  ], ConsolidatedParameterMap.prototype, "keys", null);
5684
5937
  return ConsolidatedParameterMap;
5685
5938
  }());
5686
- PlaceRouteGuard.ConsolidatedParameterMap = ConsolidatedParameterMap;
5939
+ EnterPlaceGuard.ConsolidatedParameterMap = ConsolidatedParameterMap;
5687
5940
  if (false) {
5688
5941
  /**
5689
5942
  * @type {?}
@@ -5749,7 +6002,209 @@ if (false) {
5749
6002
  */
5750
6003
  ParamMapAdapter.prototype.params;
5751
6004
  }
5752
- })(PlaceRouteGuard || (PlaceRouteGuard = {}));
6005
+ })(EnterPlaceGuard || (EnterPlaceGuard = {}));
6006
+
6007
+ /**
6008
+ * @fileoverview added by tsickle
6009
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6010
+ */
6011
+ var LeavePlaceGuard = /** @class */ (function () {
6012
+ function LeavePlaceGuard(router, injector, placeRouter, interactionContext, angularLocation) {
6013
+ this.router = router;
6014
+ this.injector = injector;
6015
+ this.placeRouter = placeRouter;
6016
+ this.interactionContext = interactionContext;
6017
+ this.angularLocation = angularLocation;
6018
+ }
6019
+ /**
6020
+ * @private
6021
+ * @param {?} nextState
6022
+ * @param {?} placeDefinition
6023
+ * @return {?}
6024
+ */
6025
+ LeavePlaceGuard.prototype.isLeavingTheCurrentPlace = /**
6026
+ * @private
6027
+ * @param {?} nextState
6028
+ * @param {?} placeDefinition
6029
+ * @return {?}
6030
+ */
6031
+ function (nextState, placeDefinition) {
6032
+ // TODO: this will break with child routes... need to examine the router states properly.
6033
+ // console.log('canDeactivate', {
6034
+ // staticPath: placeDefinitionPath,
6035
+ // currentStateUrl: currentState.url,
6036
+ // nextStateUrl: nextState.url
6037
+ // // alreadyDeclined: this._alreadyAccepted
6038
+ // });
6039
+ // Example of the above when navigating to a different child route.
6040
+ // canDeactivate {staticPath: "/hero-details",
6041
+ // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-details",
6042
+ // nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats"
6043
+ // }
6044
+ // TODO: this will break with child routes... need to examine the router states properly.
6045
+ // console.log('canDeactivate', {
6046
+ // staticPath: placeDefinitionPath,
6047
+ // currentStateUrl: currentState.url,
6048
+ // nextStateUrl: nextState.url
6049
+ // // alreadyDeclined: this._alreadyAccepted
6050
+ // });
6051
+ // Example of the above when navigating to a different child route.
6052
+ // canDeactivate {staticPath: "/hero-details",
6053
+ // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-details",
6054
+ // nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats"
6055
+ // }
6056
+ // Example clicking on router tab of the parent component (de-activates the parent due to route param changes)
6057
+ // canDeactivate {
6058
+ // staticPath: "/hero-stats",
6059
+ // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
6060
+ // nextStateUrl: "/route-parameters/"
6061
+ // }
6062
+ // canDeactivate {
6063
+ // staticPath: "/route-parameters",
6064
+ // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
6065
+ // nextStateUrl: "/route-parameters/"
6066
+ // }
6067
+ // logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: undefined, dl: Array(0), …}
6068
+ // parameter-snapshot.ts:20 {name: "idModel", mine: -1, theirs: null}
6069
+ // place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
6070
+ // canDeactivate {
6071
+ // staticPath: "/hero-stats",
6072
+ // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
6073
+ // nextStateUrl: "/route-parameters/-1"
6074
+ // }
6075
+ // canDeactivate {
6076
+ // staticPath: "/route-parameters",
6077
+ // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
6078
+ // nextStateUrl: "/route-parameters/-1"
6079
+ // }
6080
+ // logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: "A", dl: Array(3), …}
6081
+ // parameter-snapshot.ts:20 {name: "dv", mine: "A", theirs: undefined}
6082
+ // place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
6083
+ // canDeactivate {
6084
+ // staticPath: "/hero-stats",
6085
+ // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
6086
+ // nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c"
6087
+ // }
6088
+ /** @type {?} */
6089
+ var placeDefinitionPath = "/" + placeDefinition.path;
6090
+ return !nextState.url.startsWith(placeDefinitionPath);
6091
+ };
6092
+ /**
6093
+ * @param {?} component
6094
+ * @param {?} currentRoute
6095
+ * @param {?} currentState
6096
+ * @param {?=} nextState
6097
+ * @return {?}
6098
+ */
6099
+ LeavePlaceGuard.prototype.canDeactivate = /**
6100
+ * @param {?} component
6101
+ * @param {?} currentRoute
6102
+ * @param {?} currentState
6103
+ * @param {?=} nextState
6104
+ * @return {?}
6105
+ */
6106
+ function (component, currentRoute, currentState, nextState) {
6107
+ return __awaiter(this, void 0, void 0, function () {
6108
+ var self_1, canLeave;
6109
+ return __generator(this, function (_a) {
6110
+ switch (_a.label) {
6111
+ case 0:
6112
+ if (!this.placeRouter.navigationSession.alreadyAccepted(component)) return [3 /*break*/, 1];
6113
+ // We'll get called multiple times if there's any parameter sanitisation so
6114
+ // we always return true if we accepted on a previous cycle of the current
6115
+ // navigation session.
6116
+ return [2 /*return*/, true];
6117
+ case 1:
6118
+ self_1 = this;
6119
+ canLeave = true;
6120
+ if (!this.isLeavingTheCurrentPlace(nextState, component.placeDefinition)) return [3 /*break*/, 4];
6121
+ // we check the interaction first, so that components that don't need to check if they're in an
6122
+ // interaction during the canDeactivate cycle.
6123
+ // TODO: Add tests: show dialog -> hit back -> same route
6124
+ if (component.interactionContext && component.interactionContext.isActive()) {
6125
+ canLeave = false;
6126
+ console.log('cancelling', { activity: component.interactionContext.currentActivity });
6127
+ component.interactionContext.currentActivity.cancel(null);
6128
+ }
6129
+ if (!canLeave) return [3 /*break*/, 3];
6130
+ return [4 /*yield*/, component.canDeactivate()];
6131
+ case 2:
6132
+ // TODO: Add tests: hit back -> confirm leave dialog -> hit back -> close dialog -> hit back -> confirm leave dialog.
6133
+ canLeave = _a.sent();
6134
+ _a.label = 3;
6135
+ case 3: return [3 /*break*/, 5];
6136
+ case 4:
6137
+ if (this.interactionContext.isActive()) {
6138
+ console.log('cancelling', { activity: this.interactionContext.currentActivity });
6139
+ this.interactionContext.currentActivity.cancel(null);
6140
+ canLeave = false;
6141
+ }
6142
+ else {
6143
+ canLeave = true;
6144
+ }
6145
+ _a.label = 5;
6146
+ case 5:
6147
+ if (canLeave) {
6148
+ // We'll get called multiple times if there's any parameter sanitisation so
6149
+ // we remember the acceptance for the duration of the current navigation session.
6150
+ self_1.placeRouter.navigationSession.rememberAcceptanceOf(component);
6151
+ }
6152
+ else {
6153
+ // Angular doesn't preserve the url when a guard cancels the back button.
6154
+ // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
6155
+ if (this.placeRouter.navigationSession.isPopState) {
6156
+ console.log('cancelled during popstate');
6157
+ this.angularLocation.go(this.placeRouter.navigationSession.popStateReturnUrl);
6158
+ }
6159
+ }
6160
+ return [2 /*return*/, canLeave];
6161
+ }
6162
+ });
6163
+ });
6164
+ };
6165
+ LeavePlaceGuard.decorators = [
6166
+ { type: Injectable, args: [{
6167
+ providedIn: 'root'
6168
+ },] }
6169
+ ];
6170
+ /** @nocollapse */
6171
+ LeavePlaceGuard.ctorParameters = function () { return [
6172
+ { type: Router },
6173
+ { type: Injector },
6174
+ { type: PlaceRouter },
6175
+ { type: InteractionContext },
6176
+ { type: Location }
6177
+ ]; };
6178
+ /** @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" });
6179
+ __decorate([
6180
+ Trace(),
6181
+ __metadata("design:type", Function),
6182
+ __metadata("design:paramtypes", [RouterStateSnapshot, PlaceDefinition]),
6183
+ __metadata("design:returntype", void 0)
6184
+ ], LeavePlaceGuard.prototype, "isLeavingTheCurrentPlace", null);
6185
+ return LeavePlaceGuard;
6186
+ }());
6187
+ if (false) {
6188
+ /**
6189
+ * @type {?}
6190
+ * @private
6191
+ */
6192
+ LeavePlaceGuard.prototype.router;
6193
+ /**
6194
+ * @type {?}
6195
+ * @private
6196
+ */
6197
+ LeavePlaceGuard.prototype.injector;
6198
+ /**
6199
+ * @type {?}
6200
+ * @private
6201
+ */
6202
+ LeavePlaceGuard.prototype.placeRouter;
6203
+ /** @type {?} */
6204
+ LeavePlaceGuard.prototype.interactionContext;
6205
+ /** @type {?} */
6206
+ LeavePlaceGuard.prototype.angularLocation;
6207
+ }
5753
6208
 
5754
6209
  /**
5755
6210
  * @fileoverview added by tsickle
@@ -5771,5 +6226,5 @@ if (false) {
5771
6226
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5772
6227
  */
5773
6228
 
5774
- 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, PlaceRouteGuard, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, Visit, VisitParameter, VisitParameterList, VisitSanitiser, leftRightPlaceAnimation, slideDownAndUpAnimation, CommandDirective as ɵa, FocusBindingDirective as ɵb, ACTIVITY_DATA as ɵba, Activity as ɵbb, ConfirmThenDialogComponent as ɵbd, AlertDialogComponent as ɵbe, InteractionOutletComponent as ɵbg, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbh, DialogInteractionService as ɵbi, DisposableComponent as ɵc, NumberInputComponent as ɵd, AbstractInputComponent as ɵe, StringInputComponent as ɵf, PasswordInputComponent as ɵg, SelectInputComponent as ɵh, NoopComponent as ɵi, PlaceModule as ɵj, EmptyStateComponent as ɵk, BusyOverlayComponent as ɵl, PlaceOutletComponent as ɵm, leftRightPlaceAnimation as ɵn, LEFT_RIGHT_PLACE_ANIMATION as ɵo, PlaceRouter as ɵp, PlaceHistory as ɵq, TabbedPlaceNavigationComponent as ɵr, AbstractPlaceNavigationComponent as ɵs, ListPlaceNavComponent as ɵt, InteractionModule as ɵu, ActivityContainerComponent as ɵv, InteractionContext as ɵw, ActivityOutletComponent as ɵx, ConfirmationDialogComponent as ɵy, AbstractActivity as ɵz };
6229
+ 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 };
5775
6230
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map