@coolon/angular-ui-powerups 0.0.71 → 0.0.74

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 (102) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +1514 -1260
  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 +34 -32
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/coolon-angular-ui-powerups.js +34 -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 +3 -3
  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/interaction-outlet/interaction-outlet.component.js +2 -2
  25. package/esm2015/lib/interaction/services/dialog-interaction.service.js +3 -1
  26. package/esm2015/lib/place/components/abstract-place-navigation.component.js +38 -3
  27. package/esm2015/lib/place/components/busy-overlay/busy-overlay.component.js +2 -2
  28. package/esm2015/lib/place/components/empty-state/empty-state.component.js +3 -3
  29. package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js +3 -3
  30. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +64 -29
  31. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +3 -3
  32. package/esm2015/lib/place/index.js +2 -2
  33. package/esm2015/lib/place/place-definition.js +2 -6
  34. package/esm2015/lib/place/place-router.js +7 -9
  35. package/esm2015/lib/place/place.decorator.js +4 -4
  36. package/esm2015/lib/place/place.module.js +4 -2
  37. package/esm2015/lib/place/route/guards/enter-place-guard.service.js +283 -0
  38. package/esm2015/lib/place/route/guards/leave-place.guard.js +70 -50
  39. package/esm2015/lib/place/visit.js +10 -1
  40. package/esm2015/public_api.js +4 -4
  41. package/esm5/coolon-angular-ui-powerups.js +34 -32
  42. package/esm5/index.js +2 -2
  43. package/esm5/lib/angular-ui-powerups.module.js +8 -22
  44. package/esm5/lib/components/components.module.js +51 -0
  45. package/esm5/lib/components/forms/number-input/number-input.component.js +2 -2
  46. package/esm5/lib/components/forms/password-input/password-input.component.js +2 -2
  47. package/esm5/lib/components/forms/select-input/select-input.component.js +2 -2
  48. package/esm5/lib/components/forms/string-input/string-input.component.js +2 -2
  49. package/esm5/lib/components/index.js +2 -1
  50. package/esm5/lib/components/noop/noop.component.js +2 -2
  51. package/esm5/lib/directives/directives.module.js +40 -0
  52. package/esm5/lib/directives/index.js +2 -1
  53. package/esm5/lib/interaction/components/activity-container/activity-container.component.js +3 -3
  54. package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.js +2 -2
  55. package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js +3 -3
  56. package/esm5/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +3 -3
  57. package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +3 -3
  58. package/esm5/lib/interaction/components/interaction-outlet/interaction-outlet.component.js +2 -2
  59. package/esm5/lib/interaction/services/dialog-interaction.service.js +3 -1
  60. package/esm5/lib/place/components/abstract-place-navigation.component.js +38 -3
  61. package/esm5/lib/place/components/busy-overlay/busy-overlay.component.js +2 -2
  62. package/esm5/lib/place/components/empty-state/empty-state.component.js +3 -3
  63. package/esm5/lib/place/components/list-place-nav/list-place-nav.component.js +3 -3
  64. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +72 -34
  65. package/esm5/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +3 -3
  66. package/esm5/lib/place/index.js +2 -2
  67. package/esm5/lib/place/place-definition.js +2 -5
  68. package/esm5/lib/place/place-router.js +11 -10
  69. package/esm5/lib/place/place.decorator.js +4 -4
  70. package/esm5/lib/place/place.module.js +4 -2
  71. package/esm5/lib/place/route/guards/enter-place-guard.service.js +319 -0
  72. package/esm5/lib/place/route/guards/leave-place.guard.js +72 -8
  73. package/esm5/lib/place/visit.js +13 -1
  74. package/esm5/public_api.js +4 -4
  75. package/fesm2015/coolon-angular-ui-powerups.js +1176 -992
  76. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  77. package/fesm5/coolon-angular-ui-powerups.js +1444 -1194
  78. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  79. package/lib/components/components.module.d.ts +2 -0
  80. package/lib/components/index.d.ts +1 -0
  81. package/lib/directives/directives.module.d.ts +2 -0
  82. package/lib/directives/index.d.ts +1 -0
  83. package/lib/place/components/abstract-place-navigation.component.d.ts +7 -1
  84. package/lib/place/components/place-outlet/place-outlet.component.d.ts +7 -5
  85. package/lib/place/index.d.ts +1 -1
  86. package/lib/place/place-definition.d.ts +1 -2
  87. package/lib/place/place.decorator.d.ts +1 -1
  88. package/lib/place/route/guards/{place-route.guard.d.ts → enter-place-guard.service.d.ts} +6 -4
  89. package/lib/place/visit.d.ts +2 -0
  90. package/package.json +1 -1
  91. package/schematics/place-routes/place-builder.js +0 -1
  92. package/schematics/place-routes/place-builder.js.map +1 -1
  93. package/schematics/place-routes/place-class-scanner.d.ts +1 -0
  94. package/schematics/place-routes/place-class-scanner.js +7 -2
  95. package/schematics/place-routes/place-class-scanner.js.map +1 -1
  96. package/schematics/place-routes/place-def.d.ts +4 -3
  97. package/schematics/place-routes/place-def.js +40 -25
  98. package/schematics/place-routes/place-def.js.map +1 -1
  99. package/schematics/place-routes/templates/place-routes.ts.template +1 -1
  100. package/styles/styles.scss +1 -1
  101. package/esm2015/lib/place/route/guards/place-route.guard.js +0 -243
  102. package/esm5/lib/place/route/guards/place-route.guard.js +0 -273
@@ -1,13 +1,13 @@
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, RouterOutlet, 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';
@@ -21,70 +21,35 @@ import 'reflect-metadata';
21
21
  import { style, query, group, animate, trigger, transition } from '@angular/animations';
22
22
  import ResizeObserver from 'resize-observer-polyfill';
23
23
 
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
24
  /**
46
25
  * @fileoverview added by tsickle
47
26
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
48
27
  */
49
28
  /**
50
- * @abstract
51
- * @template T
29
+ * @template P
52
30
  */
53
- var AbstractInputComponent = /** @class */ (function (_super) {
54
- __extends(AbstractInputComponent, _super);
55
- function AbstractInputComponent() {
31
+ var CommandDirective = /** @class */ (function (_super) {
32
+ __extends(CommandDirective, _super);
33
+ function CommandDirective(elementRef) {
56
34
  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
- };
35
+ _this.elementRef = elementRef;
36
+ _this._commandParameterProvided = false;
79
37
  return _this;
80
38
  }
81
- Object.defineProperty(AbstractInputComponent.prototype, "userValueModel", {
39
+ Object.defineProperty(CommandDirective.prototype, "commandParameter", {
40
+ get: /**
41
+ * @return {?}
42
+ */
43
+ function () {
44
+ return this._commandParameter;
45
+ },
82
46
  set: /**
83
- * @param {?} model
47
+ * @param {?} value
84
48
  * @return {?}
85
49
  */
86
- function (model) {
87
- this.valueModel.setDelegate(model);
50
+ function (value) {
51
+ this._commandParameterProvided = true;
52
+ this._commandParameter = value;
88
53
  },
89
54
  enumerable: true,
90
55
  configurable: true
@@ -92,725 +57,829 @@ var AbstractInputComponent = /** @class */ (function (_super) {
92
57
  /**
93
58
  * @return {?}
94
59
  */
95
- AbstractInputComponent.prototype.notifyClick = /**
60
+ CommandDirective.prototype.ngOnInit = /**
96
61
  * @return {?}
97
62
  */
98
63
  function () {
99
- this.safelyInvoke(this.clickCommand);
64
+ assert.notNil(this.pectinCommand);
65
+ if (this.pectinCommand instanceof UnaryCommand) {
66
+ if (!this._commandParameterProvided) {
67
+ lang.illegalState('UnaryCommands required the command parameter to be specified.');
68
+ }
69
+ }
70
+ else {
71
+ if (this._commandParameterProvided) {
72
+ lang.illegalState('command parameters are only supported by UnaryCommands');
73
+ }
74
+ }
100
75
  };
101
76
  /**
102
77
  * @return {?}
103
78
  */
104
- AbstractInputComponent.prototype.notifyFocusIn = /**
79
+ CommandDirective.prototype.ngAfterViewInit = /**
105
80
  * @return {?}
106
81
  */
107
82
  function () {
108
- this.safelyInvoke(this.focusCommand);
109
- this.focus.emit();
83
+ var _this = this;
84
+ // for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now
85
+ // we need to do this.
86
+ var chain = Dsl.disposeWith(this).chain;
87
+ chain(this.pectinCommand.enabled).subscribe((/**
88
+ * @param {?} enabled
89
+ * @return {?}
90
+ */
91
+ function (enabled) {
92
+ if (enabled) {
93
+ _this.elementRef.nativeElement.removeAttribute('disabled');
94
+ if (_this.elementRef.nativeElement.tagName === 'A') {
95
+ _this.elementRef.nativeElement.setAttribute('href', 'javascript:void');
96
+ }
97
+ }
98
+ else {
99
+ _this.elementRef.nativeElement.setAttribute('disabled', 'disabled');
100
+ if (_this.elementRef.nativeElement.tagName === 'A') {
101
+ _this.elementRef.nativeElement.removeAttribute('href');
102
+ }
103
+ }
104
+ }));
110
105
  };
111
106
  /**
112
107
  * @return {?}
113
108
  */
114
- AbstractInputComponent.prototype.notifyFocusOut = /**
109
+ CommandDirective.prototype.ngOnDestroy = /**
115
110
  * @return {?}
116
111
  */
117
112
  function () {
118
- this.safelyInvoke(this.blurCommand);
119
- this.blur.emit();
113
+ this.dispose();
120
114
  };
121
115
  /**
116
+ * @param {?} $event
122
117
  * @return {?}
123
118
  */
124
- AbstractInputComponent.prototype.notifyEnterKey = /**
119
+ CommandDirective.prototype.notifyClick = /**
120
+ * @param {?} $event
125
121
  * @return {?}
126
122
  */
127
- function () {
128
- this.safelyInvoke(this.enterCommand);
129
- this.enterKey.emit();
123
+ function ($event) {
124
+ $event.preventDefault();
125
+ $event.stopPropagation();
126
+ if (this.pectinCommand.enabled.value) {
127
+ if (this.pectinCommand instanceof UnaryCommand) {
128
+ this.pectinCommand.withContext({ event: $event }).execute(this.commandParameter);
129
+ }
130
+ else {
131
+ this.pectinCommand.withContext({ event: $event }).execute();
132
+ }
133
+ }
134
+ else {
135
+ console.warn('disabled command clicked, ignoring.');
136
+ }
137
+ };
138
+ CommandDirective.decorators = [
139
+ { type: Directive, args: [{
140
+ // tslint:disable-next-line:directive-selector
141
+ selector: '[pectinCommand]'
142
+ },] }
143
+ ];
144
+ /** @nocollapse */
145
+ CommandDirective.ctorParameters = function () { return [
146
+ { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
147
+ ]; };
148
+ CommandDirective.propDecorators = {
149
+ pectinCommand: [{ type: Input }],
150
+ commandParameter: [{ type: Input }],
151
+ notifyClick: [{ type: HostListener, args: ['click', ['$event'],] }]
130
152
  };
153
+ return CommandDirective;
154
+ }(GarbageCollector));
155
+ if (false) {
156
+ /** @type {?} */
157
+ CommandDirective.prototype.pectinCommand;
158
+ /**
159
+ * @type {?}
160
+ * @private
161
+ */
162
+ CommandDirective.prototype._commandParameter;
163
+ /**
164
+ * @type {?}
165
+ * @private
166
+ */
167
+ CommandDirective.prototype._commandParameterProvided;
168
+ /**
169
+ * @type {?}
170
+ * @private
171
+ */
172
+ CommandDirective.prototype.elementRef;
173
+ }
174
+
175
+ /**
176
+ * @fileoverview added by tsickle
177
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
178
+ */
179
+ var DisposableComponent = /** @class */ (function (_super) {
180
+ __extends(DisposableComponent, _super);
181
+ function DisposableComponent() {
182
+ return _super !== null && _super.apply(this, arguments) || this;
183
+ }
131
184
  /**
132
185
  * @return {?}
133
186
  */
134
- AbstractInputComponent.prototype.notifyEscapeKey = /**
187
+ DisposableComponent.prototype.ngOnDestroy = /**
135
188
  * @return {?}
136
189
  */
137
190
  function () {
138
- this.safelyInvoke(this.escapeCommand);
139
- this.escapeKey.emit();
191
+ this.dispose();
140
192
  };
193
+ return DisposableComponent;
194
+ }(GarbageCollector));
195
+
196
+ /**
197
+ * @fileoverview added by tsickle
198
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
199
+ */
200
+ var FocusBindingDirective = /** @class */ (function (_super) {
201
+ __extends(FocusBindingDirective, _super);
202
+ function FocusBindingDirective(el, ngZone, document) {
203
+ var _this = _super.call(this) || this;
204
+ _this.el = el;
205
+ _this.ngZone = ngZone;
206
+ // @see https://stackoverflow.com/questions/49513359/could-not-resolve-type-document-in-angular5/53715642#53715642
207
+ _this.document = (/** @type {?} */ (document));
208
+ return _this;
209
+ }
141
210
  /**
142
- * @protected
143
- * @param {?} command
144
211
  * @return {?}
145
212
  */
146
- AbstractInputComponent.prototype.safelyInvoke = /**
147
- * @protected
148
- * @param {?} command
213
+ FocusBindingDirective.prototype.onFocusIn = /**
149
214
  * @return {?}
150
215
  */
151
- function (command) {
152
- if (command && command.enabled.value) {
153
- command.execute();
216
+ function () {
217
+ if (this.hasBinding()) {
218
+ this.pectinFocusBinding.focusContext.notifyFocusIn();
154
219
  }
155
220
  };
156
221
  /**
157
222
  * @return {?}
158
223
  */
159
- AbstractInputComponent.prototype.ngOnInit = /**
224
+ FocusBindingDirective.prototype.onFocusOut = /**
160
225
  * @return {?}
161
226
  */
162
227
  function () {
228
+ if (this.hasBinding()) {
229
+ this.pectinFocusBinding.focusContext.notifyFocusOut();
230
+ }
163
231
  };
164
232
  /**
165
233
  * @return {?}
166
234
  */
167
- AbstractInputComponent.prototype.isEnabled = /**
235
+ FocusBindingDirective.prototype.ngOnInit = /**
168
236
  * @return {?}
169
237
  */
170
238
  function () {
171
- return this.enabled.value;
172
239
  };
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
240
  /**
184
241
  * @return {?}
185
242
  */
186
- AbstractInputComponent.prototype.hasErrors = /**
243
+ FocusBindingDirective.prototype.ngAfterViewInit = /**
187
244
  * @return {?}
188
245
  */
189
246
  function () {
190
- return !this.errorList.query().isEmpty();
247
+ var _this = this;
248
+ // TODO: Make this also track the current enabled/disabled state.
249
+ if (this.hasBinding()) {
250
+ var chain = Dsl.disposeWith(this).chain;
251
+ chain(this.pectinFocusBinding.focusContext.focused).subscribe((/**
252
+ * @param {?} focused
253
+ * @return {?}
254
+ */
255
+ function (focused) {
256
+ if (focused && !_this.alreadyHasFocus()) {
257
+ _this.tryAndFocus();
258
+ }
259
+ }));
260
+ }
261
+ else {
262
+ Logger.get(this).warn('pectinFocusBinding was nil');
263
+ }
191
264
  };
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
265
  /**
266
+ * @private
281
267
  * @return {?}
282
268
  */
283
- NumberInputComponent.prototype.ngOnInit = /**
269
+ FocusBindingDirective.prototype.hasBinding = /**
270
+ * @private
284
271
  * @return {?}
285
272
  */
286
273
  function () {
274
+ return !!this.pectinFocusBinding && !!this.pectinFocusBinding.focusContext;
287
275
  };
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
- }
276
+ // Hook method for debugging via tracing.
277
+ // Hook method for debugging via tracing.
309
278
  /**
310
279
  * @return {?}
311
280
  */
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
- }
281
+ FocusBindingDirective.prototype.alreadyHasFocus =
282
+ // Hook method for debugging via tracing.
347
283
  /**
348
284
  * @return {?}
349
285
  */
350
- SelectInputComponent.prototype.ngOnInit = /**
351
- * @return {?}
352
- */
353
286
  function () {
287
+ return this.isFocused(this.focusTarget);
354
288
  };
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
- }
289
+ // Hook method for debugging via tracing.
290
+ // Hook method for debugging via tracing.
400
291
  /**
292
+ * @param {?} element
401
293
  * @return {?}
402
294
  */
403
- StringInputComponent.prototype.ngOnInit = /**
404
- * @return {?}
405
- */
406
- function () {
407
- };
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
- });
295
+ FocusBindingDirective.prototype.isFocused =
296
+ // Hook method for debugging via tracing.
472
297
  /**
298
+ * @param {?} element
473
299
  * @return {?}
474
- */
475
- CommandDirective.prototype.ngOnInit = /**
476
- * @return {?}
477
- */
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.');
483
- }
484
- }
485
- else {
486
- if (this._commandParameterProvided) {
487
- lang.illegalState('command parameters are only supported by UnaryCommands');
488
- }
489
- }
300
+ */
301
+ function (element) {
302
+ return this.document.activeElement === element;
490
303
  };
491
304
  /**
305
+ * @param {?=} retries
492
306
  * @return {?}
493
307
  */
494
- CommandDirective.prototype.ngAfterViewInit = /**
308
+ FocusBindingDirective.prototype.tryAndFocus = /**
309
+ * @param {?=} retries
495
310
  * @return {?}
496
311
  */
497
- function () {
312
+ function (retries) {
498
313
  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
504
- * @return {?}
505
- */
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
- }
314
+ if (retries === void 0) { retries = 5; }
315
+ if (this.modelShouldStillHaveFocus() && this.canFocus()) {
316
+ if (!this.alreadyHasFocus()) {
317
+ this.focusTarget.focus();
512
318
  }
513
- else {
514
- _this.elementRef.nativeElement.setAttribute('disabled', 'disabled');
515
- if (_this.elementRef.nativeElement.tagName === 'A') {
516
- _this.elementRef.nativeElement.removeAttribute('href');
319
+ // if we didn't get the focus we try again later.
320
+ if (!this.alreadyHasFocus()) {
321
+ Logger.get(this).log("focus failed, trying " + retries + " more times");
322
+ if (retries > 0) {
323
+ // try again on the next paint
324
+ // TODO: is there an angular way of doing this without calling a window function.
325
+ requestAnimationFrame((/**
326
+ * @return {?}
327
+ */
328
+ function () {
329
+ _this.tryAndFocus(retries - 1);
330
+ }));
331
+ }
332
+ else {
333
+ Logger.get(this).warn("Tried to focus but gave up as the component wasn't enabled or visible.");
517
334
  }
518
335
  }
519
- }));
336
+ }
520
337
  };
338
+ Object.defineProperty(FocusBindingDirective.prototype, "focusTarget", {
339
+ get: /**
340
+ * @return {?}
341
+ */
342
+ function () {
343
+ return this.focusBindingTarget || this.el.nativeElement;
344
+ },
345
+ enumerable: true,
346
+ configurable: true
347
+ });
348
+ // Hook method for debugging via tracing.
349
+ // Hook method for debugging via tracing.
521
350
  /**
522
351
  * @return {?}
523
352
  */
524
- CommandDirective.prototype.ngOnDestroy = /**
353
+ FocusBindingDirective.prototype.modelShouldStillHaveFocus =
354
+ // Hook method for debugging via tracing.
355
+ /**
525
356
  * @return {?}
526
357
  */
527
358
  function () {
528
- this.dispose();
359
+ return this.hasBinding() && this.pectinFocusBinding.focusContext.focused.value;
529
360
  };
361
+ // Hook method for debugging via tracing.
362
+ // Hook method for debugging via tracing.
530
363
  /**
531
- * @param {?} $event
532
364
  * @return {?}
533
365
  */
534
- CommandDirective.prototype.notifyClick = /**
535
- * @param {?} $event
366
+ FocusBindingDirective.prototype.canFocus =
367
+ // Hook method for debugging via tracing.
368
+ /**
536
369
  * @return {?}
537
370
  */
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
- }
371
+ function () {
372
+ /** @type {?} */
373
+ var dimension = this.focusTarget.getBoundingClientRect();
374
+ /** @type {?} */
375
+ var hasSize = dimension.height >= 0 && dimension.height >= 0;
376
+ // tslint:disable-next-line:no-string-literal
377
+ return hasSize && !this.focusTarget['disabled'];
552
378
  };
553
- CommandDirective.decorators = [
379
+ FocusBindingDirective.decorators = [
554
380
  { type: Directive, args: [{
555
381
  // tslint:disable-next-line:directive-selector
556
- selector: '[pectinCommand]'
382
+ selector: '[pectinFocusBinding]'
557
383
  },] }
558
384
  ];
559
385
  /** @nocollapse */
560
- CommandDirective.ctorParameters = function () { return [
561
- { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
386
+ FocusBindingDirective.ctorParameters = function () { return [
387
+ { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
388
+ { type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
389
+ { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
562
390
  ]; };
563
- CommandDirective.propDecorators = {
564
- pectinCommand: [{ type: Input }],
565
- commandParameter: [{ type: Input }],
566
- notifyClick: [{ type: HostListener, args: ['click', ['$event'],] }]
391
+ FocusBindingDirective.propDecorators = {
392
+ pectinFocusBinding: [{ type: Input }],
393
+ focusBindingTarget: [{ type: Input }],
394
+ onFocusIn: [{ type: HostListener, args: ['focusin',] }],
395
+ onFocusOut: [{ type: HostListener, args: ['focusout',] }]
567
396
  };
568
- return CommandDirective;
569
- }(GarbageCollector));
397
+ return FocusBindingDirective;
398
+ }(DisposableComponent));
570
399
  if (false) {
571
- /** @type {?} */
572
- CommandDirective.prototype.pectinCommand;
573
400
  /**
574
401
  * @type {?}
575
402
  * @private
576
403
  */
577
- CommandDirective.prototype._commandParameter;
404
+ FocusBindingDirective.prototype.document;
405
+ /** @type {?} */
406
+ FocusBindingDirective.prototype.pectinFocusBinding;
407
+ /** @type {?} */
408
+ FocusBindingDirective.prototype.focusBindingTarget;
578
409
  /**
579
410
  * @type {?}
580
411
  * @private
581
412
  */
582
- CommandDirective.prototype._commandParameterProvided;
413
+ FocusBindingDirective.prototype.el;
583
414
  /**
584
415
  * @type {?}
585
416
  * @private
586
417
  */
587
- CommandDirective.prototype.elementRef;
418
+ FocusBindingDirective.prototype.ngZone;
588
419
  }
589
420
 
590
421
  /**
591
422
  * @fileoverview added by tsickle
592
423
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
593
424
  */
594
- var FocusBindingDirective = /** @class */ (function (_super) {
595
- __extends(FocusBindingDirective, _super);
596
- function FocusBindingDirective(el, ngZone, document) {
425
+ var DirectivesModule = /** @class */ (function () {
426
+ function DirectivesModule() {
427
+ }
428
+ DirectivesModule.decorators = [
429
+ { type: NgModule, args: [{
430
+ declarations: [
431
+ CommandDirective,
432
+ FocusBindingDirective
433
+ ],
434
+ imports: [
435
+ CommonModule,
436
+ BrowserAnimationsModule,
437
+ FormsModule,
438
+ MatInputModule,
439
+ MatFormFieldModule,
440
+ MatSelectModule,
441
+ MatTabsModule
442
+ ],
443
+ exports: [
444
+ CommandDirective,
445
+ FocusBindingDirective
446
+ ]
447
+ },] }
448
+ ];
449
+ return DirectivesModule;
450
+ }());
451
+
452
+ /**
453
+ * @fileoverview added by tsickle
454
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
455
+ */
456
+ /**
457
+ * @abstract
458
+ * @template T
459
+ */
460
+ var AbstractInputComponent = /** @class */ (function (_super) {
461
+ __extends(AbstractInputComponent, _super);
462
+ function AbstractInputComponent() {
597
463
  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));
464
+ _this.valueModel = new DelegatingFormValueModel();
465
+ // TODO: fix this.
466
+ // tslint:disable-next-line:no-output-native
467
+ _this.focus = new EventEmitter();
468
+ // tslint:disable-next-line:no-output-native
469
+ _this.blur = new EventEmitter();
470
+ // tslint:disable-next-line:no-output-native
471
+ _this.enterKey = new EventEmitter();
472
+ // tslint:disable-next-line:no-output-native
473
+ _this.escapeKey = new EventEmitter();
474
+ /** @type {?} */
475
+ var self = _this;
476
+ _this.errorStateMatcher = {
477
+ isErrorState: /**
478
+ * @param {?} control
479
+ * @param {?} form
480
+ * @return {?}
481
+ */
482
+ function (control, form) {
483
+ return self.hasErrors();
484
+ }
485
+ };
602
486
  return _this;
603
487
  }
488
+ Object.defineProperty(AbstractInputComponent.prototype, "userValueModel", {
489
+ set: /**
490
+ * @param {?} model
491
+ * @return {?}
492
+ */
493
+ function (model) {
494
+ this.valueModel.setDelegate(model);
495
+ },
496
+ enumerable: true,
497
+ configurable: true
498
+ });
604
499
  /**
605
500
  * @return {?}
606
501
  */
607
- FocusBindingDirective.prototype.onFocusIn = /**
502
+ AbstractInputComponent.prototype.notifyClick = /**
608
503
  * @return {?}
609
504
  */
610
505
  function () {
611
- if (this.hasBinding()) {
612
- this.pectinFocusBinding.focusContext.notifyFocusIn();
613
- }
506
+ this.safelyInvoke(this.clickCommand);
614
507
  };
615
508
  /**
616
509
  * @return {?}
617
510
  */
618
- FocusBindingDirective.prototype.onFocusOut = /**
511
+ AbstractInputComponent.prototype.notifyFocusIn = /**
619
512
  * @return {?}
620
513
  */
621
514
  function () {
622
- if (this.hasBinding()) {
623
- this.pectinFocusBinding.focusContext.notifyFocusOut();
624
- }
515
+ this.safelyInvoke(this.focusCommand);
516
+ this.focus.emit();
625
517
  };
626
518
  /**
627
519
  * @return {?}
628
520
  */
629
- FocusBindingDirective.prototype.ngOnInit = /**
521
+ AbstractInputComponent.prototype.notifyFocusOut = /**
630
522
  * @return {?}
631
523
  */
632
524
  function () {
525
+ this.safelyInvoke(this.blurCommand);
526
+ this.blur.emit();
633
527
  };
634
528
  /**
635
529
  * @return {?}
636
530
  */
637
- FocusBindingDirective.prototype.ngAfterViewInit = /**
531
+ AbstractInputComponent.prototype.notifyEnterKey = /**
638
532
  * @return {?}
639
533
  */
640
534
  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
- }
535
+ this.safelyInvoke(this.enterCommand);
536
+ this.enterKey.emit();
658
537
  };
659
538
  /**
660
- * @private
661
539
  * @return {?}
662
540
  */
663
- FocusBindingDirective.prototype.hasBinding = /**
664
- * @private
541
+ AbstractInputComponent.prototype.notifyEscapeKey = /**
665
542
  * @return {?}
666
543
  */
667
544
  function () {
668
- return !!this.pectinFocusBinding && !!this.pectinFocusBinding.focusContext;
545
+ this.safelyInvoke(this.escapeCommand);
546
+ this.escapeKey.emit();
547
+ };
548
+ /**
549
+ * @protected
550
+ * @param {?} command
551
+ * @return {?}
552
+ */
553
+ AbstractInputComponent.prototype.safelyInvoke = /**
554
+ * @protected
555
+ * @param {?} command
556
+ * @return {?}
557
+ */
558
+ function (command) {
559
+ if (command && command.enabled.value) {
560
+ command.execute();
561
+ }
669
562
  };
670
- // Hook method for debugging via tracing.
671
- // Hook method for debugging via tracing.
672
563
  /**
673
564
  * @return {?}
674
565
  */
675
- FocusBindingDirective.prototype.alreadyHasFocus =
676
- // Hook method for debugging via tracing.
677
- /**
566
+ AbstractInputComponent.prototype.ngOnInit = /**
678
567
  * @return {?}
679
568
  */
680
569
  function () {
681
- return this.isFocused(this.focusTarget);
682
570
  };
683
- // Hook method for debugging via tracing.
684
- // Hook method for debugging via tracing.
685
571
  /**
686
- * @param {?} element
687
572
  * @return {?}
688
573
  */
689
- FocusBindingDirective.prototype.isFocused =
690
- // Hook method for debugging via tracing.
691
- /**
692
- * @param {?} element
574
+ AbstractInputComponent.prototype.isEnabled = /**
693
575
  * @return {?}
694
576
  */
695
- function (element) {
696
- return this.document.activeElement === element;
577
+ function () {
578
+ return this.enabled.value;
697
579
  };
580
+ Object.defineProperty(AbstractInputComponent.prototype, "enabled", {
581
+ get: /**
582
+ * @return {?}
583
+ */
584
+ function () {
585
+ return this.valueModel.enabled;
586
+ },
587
+ enumerable: true,
588
+ configurable: true
589
+ });
698
590
  /**
699
- * @param {?=} retries
700
591
  * @return {?}
701
592
  */
702
- FocusBindingDirective.prototype.tryAndFocus = /**
703
- * @param {?=} retries
593
+ AbstractInputComponent.prototype.hasErrors = /**
704
594
  * @return {?}
705
595
  */
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
- }
596
+ function () {
597
+ return !this.errorList.query().isEmpty();
731
598
  };
732
- Object.defineProperty(FocusBindingDirective.prototype, "focusTarget", {
599
+ Object.defineProperty(AbstractInputComponent.prototype, "errorList", {
733
600
  get: /**
734
601
  * @return {?}
735
602
  */
736
603
  function () {
737
- return this.focusBindingTarget || this.el.nativeElement;
604
+ return this.valueModel.errorList;
738
605
  },
739
606
  enumerable: true,
740
607
  configurable: true
741
608
  });
742
- // Hook method for debugging via tracing.
743
- // Hook method for debugging via tracing.
609
+ Object.defineProperty(AbstractInputComponent.prototype, "firstError", {
610
+ get: /**
611
+ * @return {?}
612
+ */
613
+ function () {
614
+ return this.hasErrors() ? this.errorList.value[0] : null;
615
+ },
616
+ enumerable: true,
617
+ configurable: true
618
+ });
619
+ AbstractInputComponent.propDecorators = {
620
+ userValueModel: [{ type: Input, args: ['valueModel',] }],
621
+ label: [{ type: Input }],
622
+ floatLabel: [{ type: Input }],
623
+ hint: [{ type: Input }],
624
+ placeholder: [{ type: Input }],
625
+ focusCommand: [{ type: Input, args: ['command.focus',] }],
626
+ blurCommand: [{ type: Input, args: ['command.blur',] }],
627
+ enterCommand: [{ type: Input, args: ['command.enter',] }],
628
+ escapeCommand: [{ type: Input, args: ['command.escape',] }],
629
+ clickCommand: [{ type: Input, args: ['command.click',] }],
630
+ focus: [{ type: Output }],
631
+ blur: [{ type: Output }],
632
+ enterKey: [{ type: Output }],
633
+ escapeKey: [{ type: Output }],
634
+ notifyClick: [{ type: HostListener, args: ['click',] }],
635
+ notifyFocusIn: [{ type: HostListener, args: ['focusin',] }],
636
+ notifyFocusOut: [{ type: HostListener, args: ['focusout',] }]
637
+ };
638
+ __decorate([
639
+ UseDelegate(),
640
+ __metadata("design:type", ValueModel),
641
+ __metadata("design:paramtypes", [ValueModel])
642
+ ], AbstractInputComponent.prototype, "userValueModel", null);
643
+ return AbstractInputComponent;
644
+ }(DisposableComponent));
645
+ if (false) {
646
+ /** @type {?} */
647
+ AbstractInputComponent.prototype.valueModel;
648
+ /** @type {?} */
649
+ AbstractInputComponent.prototype.label;
650
+ /** @type {?} */
651
+ AbstractInputComponent.prototype.floatLabel;
652
+ /** @type {?} */
653
+ AbstractInputComponent.prototype.hint;
654
+ /** @type {?} */
655
+ AbstractInputComponent.prototype.placeholder;
656
+ /** @type {?} */
657
+ AbstractInputComponent.prototype.focusCommand;
658
+ /** @type {?} */
659
+ AbstractInputComponent.prototype.blurCommand;
660
+ /** @type {?} */
661
+ AbstractInputComponent.prototype.enterCommand;
662
+ /** @type {?} */
663
+ AbstractInputComponent.prototype.escapeCommand;
664
+ /** @type {?} */
665
+ AbstractInputComponent.prototype.clickCommand;
666
+ /** @type {?} */
667
+ AbstractInputComponent.prototype.focus;
668
+ /** @type {?} */
669
+ AbstractInputComponent.prototype.blur;
670
+ /** @type {?} */
671
+ AbstractInputComponent.prototype.enterKey;
672
+ /** @type {?} */
673
+ AbstractInputComponent.prototype.escapeKey;
674
+ /** @type {?} */
675
+ AbstractInputComponent.prototype.errorStateMatcher;
676
+ }
677
+
678
+ /**
679
+ * @fileoverview added by tsickle
680
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
681
+ */
682
+ var NumberInputComponent = /** @class */ (function (_super) {
683
+ __extends(NumberInputComponent, _super);
684
+ function NumberInputComponent() {
685
+ return _super.call(this) || this;
686
+ }
744
687
  /**
745
688
  * @return {?}
746
689
  */
747
- FocusBindingDirective.prototype.modelShouldStillHaveFocus =
748
- // Hook method for debugging via tracing.
749
- /**
690
+ NumberInputComponent.prototype.ngOnInit = /**
750
691
  * @return {?}
751
692
  */
752
693
  function () {
753
- return this.hasBinding() && this.pectinFocusBinding.focusContext.focused.value;
754
694
  };
755
- // Hook method for debugging via tracing.
756
- // Hook method for debugging via tracing.
695
+ NumberInputComponent.decorators = [
696
+ { type: Component, args: [{
697
+ selector: 'aup-number-input',
698
+ 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",
699
+ styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
700
+ }] }
701
+ ];
702
+ /** @nocollapse */
703
+ NumberInputComponent.ctorParameters = function () { return []; };
704
+ return NumberInputComponent;
705
+ }(AbstractInputComponent));
706
+
707
+ /**
708
+ * @fileoverview added by tsickle
709
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
710
+ */
711
+ var PasswordInputComponent = /** @class */ (function (_super) {
712
+ __extends(PasswordInputComponent, _super);
713
+ function PasswordInputComponent() {
714
+ return _super.call(this) || this;
715
+ }
757
716
  /**
758
717
  * @return {?}
759
718
  */
760
- FocusBindingDirective.prototype.canFocus =
761
- // Hook method for debugging via tracing.
719
+ PasswordInputComponent.prototype.ngOnInit = /**
720
+ * @return {?}
721
+ */
722
+ function () {
723
+ };
724
+ PasswordInputComponent.decorators = [
725
+ { type: Component, args: [{
726
+ selector: 'aup-password-input',
727
+ 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",
728
+ styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
729
+ }] }
730
+ ];
731
+ /** @nocollapse */
732
+ PasswordInputComponent.ctorParameters = function () { return []; };
733
+ return PasswordInputComponent;
734
+ }(AbstractInputComponent));
735
+
736
+ /**
737
+ * @fileoverview added by tsickle
738
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
739
+ */
740
+ /**
741
+ * @template T
742
+ */
743
+ var SelectInputComponent = /** @class */ (function (_super) {
744
+ __extends(SelectInputComponent, _super);
745
+ function SelectInputComponent() {
746
+ var _this = _super.call(this) || this;
747
+ _this.optionLabelFormat = (/**
748
+ * @param {?} option
749
+ * @return {?}
750
+ */
751
+ function (option) { return (option && _this.optionLabel) ? option[_this.optionLabel] : option; });
752
+ return _this;
753
+ }
762
754
  /**
763
755
  * @return {?}
764
756
  */
757
+ SelectInputComponent.prototype.ngOnInit = /**
758
+ * @return {?}
759
+ */
765
760
  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
761
  };
773
- FocusBindingDirective.decorators = [
774
- { type: Directive, args: [{
775
- // tslint:disable-next-line:directive-selector
776
- selector: '[pectinFocusBinding]'
777
- },] }
762
+ SelectInputComponent.decorators = [
763
+ { type: Component, args: [{
764
+ selector: 'aup-select-input',
765
+ 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",
766
+ styles: [":host{display:inline-block}mat-form-field{width:100%}"]
767
+ }] }
778
768
  ];
779
769
  /** @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',] }]
770
+ SelectInputComponent.ctorParameters = function () { return []; };
771
+ SelectInputComponent.propDecorators = {
772
+ optionsModel: [{ type: Input }],
773
+ options: [{ type: Input }],
774
+ optionLabel: [{ type: Input }],
775
+ optionLabelFormat: [{ type: Input }]
790
776
  };
791
- return FocusBindingDirective;
792
- }(DisposableComponent));
777
+ __decorate([
778
+ UseDelegate(),
779
+ __metadata("design:type", ListModel)
780
+ ], SelectInputComponent.prototype, "optionsModel", void 0);
781
+ __decorate([
782
+ StoreInListModel('optionsModel'),
783
+ __metadata("design:type", Array)
784
+ ], SelectInputComponent.prototype, "options", void 0);
785
+ return SelectInputComponent;
786
+ }(AbstractInputComponent));
793
787
  if (false) {
794
- /**
795
- * @type {?}
796
- * @private
797
- */
798
- FocusBindingDirective.prototype.document;
799
788
  /** @type {?} */
800
- FocusBindingDirective.prototype.pectinFocusBinding;
789
+ SelectInputComponent.prototype.optionsModel;
801
790
  /** @type {?} */
802
- FocusBindingDirective.prototype.focusBindingTarget;
791
+ SelectInputComponent.prototype.options;
792
+ /** @type {?} */
793
+ SelectInputComponent.prototype.optionLabel;
794
+ /** @type {?} */
795
+ SelectInputComponent.prototype.optionLabelFormat;
796
+ }
797
+
798
+ /**
799
+ * @fileoverview added by tsickle
800
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
801
+ */
802
+ var StringInputComponent = /** @class */ (function (_super) {
803
+ __extends(StringInputComponent, _super);
804
+ function StringInputComponent() {
805
+ return _super.call(this) || this;
806
+ }
803
807
  /**
804
- * @type {?}
805
- * @private
808
+ * @return {?}
806
809
  */
807
- FocusBindingDirective.prototype.el;
808
- /**
809
- * @type {?}
810
- * @private
810
+ StringInputComponent.prototype.ngOnInit = /**
811
+ * @return {?}
811
812
  */
812
- FocusBindingDirective.prototype.ngZone;
813
- }
813
+ function () {
814
+ };
815
+ StringInputComponent.decorators = [
816
+ { type: Component, args: [{
817
+ selector: 'aup-string-input',
818
+ 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",
819
+ styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
820
+ }] }
821
+ ];
822
+ /** @nocollapse */
823
+ StringInputComponent.ctorParameters = function () { return []; };
824
+ return StringInputComponent;
825
+ }(AbstractInputComponent));
826
+
827
+ /**
828
+ * @fileoverview added by tsickle
829
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
830
+ */
831
+ var NoopComponent = /** @class */ (function () {
832
+ function NoopComponent() {
833
+ }
834
+ NoopComponent.decorators = [
835
+ { type: Component, args: [{
836
+ selector: 'aup-noop',
837
+ template: "",
838
+ styles: [":host{display:block}"]
839
+ }] }
840
+ ];
841
+ /** @nocollapse */
842
+ NoopComponent.ctorParameters = function () { return []; };
843
+ return NoopComponent;
844
+ }());
845
+
846
+ /**
847
+ * @fileoverview added by tsickle
848
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
849
+ */
850
+ var ComponentsModule = /** @class */ (function () {
851
+ function ComponentsModule() {
852
+ }
853
+ ComponentsModule.decorators = [
854
+ { type: NgModule, args: [{
855
+ declarations: [
856
+ NumberInputComponent,
857
+ StringInputComponent,
858
+ PasswordInputComponent,
859
+ SelectInputComponent,
860
+ NoopComponent
861
+ ],
862
+ imports: [
863
+ CommonModule,
864
+ BrowserAnimationsModule,
865
+ FormsModule,
866
+ MatInputModule,
867
+ MatFormFieldModule,
868
+ MatSelectModule,
869
+ MatTabsModule,
870
+ DirectivesModule
871
+ ],
872
+ exports: [
873
+ NumberInputComponent,
874
+ StringInputComponent,
875
+ PasswordInputComponent,
876
+ SelectInputComponent,
877
+ NoopComponent
878
+ ]
879
+ },] }
880
+ ];
881
+ return ComponentsModule;
882
+ }());
814
883
 
815
884
  /**
816
885
  * @fileoverview added by tsickle
@@ -1103,7 +1172,7 @@ var ActivityOutletComponent = /** @class */ (function () {
1103
1172
  });
1104
1173
  ActivityOutletComponent.decorators = [
1105
1174
  { type: Component, args: [{
1106
- selector: 'angular-ui-powerups-activity-outlet',
1175
+ selector: 'aup-activity-outlet',
1107
1176
  template: '',
1108
1177
  styles: [":host{display:block}"]
1109
1178
  }] }
@@ -1194,9 +1263,9 @@ var AlertDialogComponent = /** @class */ (function (_super) {
1194
1263
  };
1195
1264
  AlertDialogComponent.decorators = [
1196
1265
  { type: Component, args: [{
1197
- selector: 'angular-ui-powerups-alert-dialog',
1266
+ selector: 'aup-alert-dialog',
1198
1267
  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}"]
1268
+ styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1200
1269
  }] }
1201
1270
  ];
1202
1271
  /** @nocollapse */
@@ -1275,9 +1344,9 @@ var ConfirmThenDialogComponent = /** @class */ (function (_super) {
1275
1344
  };
1276
1345
  ConfirmThenDialogComponent.decorators = [
1277
1346
  { type: Component, args: [{
1278
- selector: 'angular-ui-powerups-confirmation-dialog',
1347
+ selector: 'aup-confirmation-dialog',
1279
1348
  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}"]
1349
+ styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1281
1350
  }] }
1282
1351
  ];
1283
1352
  /** @nocollapse */
@@ -1341,9 +1410,9 @@ var ConfirmationDialogComponent = /** @class */ (function (_super) {
1341
1410
  };
1342
1411
  ConfirmationDialogComponent.decorators = [
1343
1412
  { type: Component, args: [{
1344
- selector: 'angular-ui-powerups-confirmation-dialog',
1413
+ selector: 'aup-confirmation-dialog',
1345
1414
  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}"]
1415
+ styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1347
1416
  }] }
1348
1417
  ];
1349
1418
  /** @nocollapse */
@@ -1789,8 +1858,8 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
1789
1858
  };
1790
1859
  ActivityContainerComponent.decorators = [
1791
1860
  { 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",
1861
+ selector: 'aup-activity-container',
1862
+ template: "<mat-tab-group #tabs no-tab-header [dynamicHeight]=\"true\">\n <mat-tab *ngFor=\"let tab of activityTabs.value\">\n <aup-activity-outlet [interactionContext]=\"this\"\n [activityContext]=\"tab\"></aup-activity-outlet>\n </mat-tab>\n</mat-tab-group>\n",
1794
1863
  styles: [":host{display:block}"]
1795
1864
  }] }
1796
1865
  ];
@@ -1839,7 +1908,7 @@ var InteractionOutletComponent = /** @class */ (function () {
1839
1908
  }
1840
1909
  InteractionOutletComponent.decorators = [
1841
1910
  { type: Component, args: [{
1842
- selector: 'angular-ui-powerups-interaction-outlet',
1911
+ selector: 'aup-interaction-outlet',
1843
1912
  template: "<router-outlet name=\"interaction-context\"></router-outlet>\n",
1844
1913
  styles: [":host{display:block}"]
1845
1914
  }] }
@@ -1994,6 +2063,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
1994
2063
  * @return {?}
1995
2064
  */
1996
2065
  function () {
2066
+ console.log("###### STARTING");
1997
2067
  _this.currentActivityId = v1();
1998
2068
  // this.location.go(this.router.routerState.snapshot.url, "aup");
1999
2069
  /** @type {?} */
@@ -2050,6 +2120,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
2050
2120
  * @return {?}
2051
2121
  */
2052
2122
  function () {
2123
+ console.log("###### FINISHED");
2053
2124
  _this.currentActivityId = null;
2054
2125
  self.safelyUpdateActivityListDelegate(null);
2055
2126
  }));
@@ -2180,7 +2251,7 @@ var InteractionModule = /** @class */ (function () {
2180
2251
  CommonModule,
2181
2252
  MatButtonModule,
2182
2253
  MatDialogModule,
2183
- MatTabsModule,
2254
+ MatTabsModule$1,
2184
2255
  PortalModule,
2185
2256
  RouterModule
2186
2257
  ],
@@ -2228,7 +2299,7 @@ var BusyOverlayComponent = /** @class */ (function () {
2228
2299
  };
2229
2300
  BusyOverlayComponent.decorators = [
2230
2301
  { type: Component, args: [{
2231
- selector: 'angular-ui-powerups-busy-overlay',
2302
+ selector: 'aup-busy-overlay',
2232
2303
  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
2304
  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
2305
  }] }
@@ -2273,9 +2344,9 @@ var EmptyStateComponent = /** @class */ (function () {
2273
2344
  };
2274
2345
  EmptyStateComponent.decorators = [
2275
2346
  { type: Component, args: [{
2276
- selector: 'angular-ui-powerups-empty-state',
2347
+ selector: 'aup-empty-state',
2277
2348
  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}"]
2349
+ 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
2350
  }] }
2280
2351
  ];
2281
2352
  /** @nocollapse */
@@ -2590,11 +2661,10 @@ if (false) {
2590
2661
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2591
2662
  */
2592
2663
  var PlaceDefinition = /** @class */ (function () {
2593
- function PlaceDefinition(component, path, authenticate, order, data, routeParameters, children) {
2664
+ function PlaceDefinition(component, path, authenticate, data, routeParameters, children) {
2594
2665
  this.component = component;
2595
2666
  this.path = path;
2596
2667
  this.authenticate = authenticate;
2597
- this.order = order;
2598
2668
  this.data = data;
2599
2669
  this.routeParameters = routeParameters;
2600
2670
  this.children = children;
@@ -2900,8 +2970,6 @@ if (false) {
2900
2970
  /** @type {?} */
2901
2971
  PlaceDefinition.prototype.authenticate;
2902
2972
  /** @type {?} */
2903
- PlaceDefinition.prototype.order;
2904
- /** @type {?} */
2905
2973
  PlaceDefinition.prototype.data;
2906
2974
  /** @type {?} */
2907
2975
  PlaceDefinition.prototype.routeParameters;
@@ -3092,136 +3160,182 @@ if (false) {
3092
3160
  * @fileoverview added by tsickle
3093
3161
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3094
3162
  */
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;
3163
+ /**
3164
+ * @record
3165
+ */
3166
+ function Params() { }
3167
+ var Visit = /** @class */ (function () {
3168
+ function Visit(placeDefinition, visitParameters) {
3169
+ if (visitParameters === void 0) { visitParameters = {}; }
3170
+ this.placeDefinition = placeDefinition;
3171
+ this.visitParameters = visitParameters;
3106
3172
  }
3173
+ // @Trace()
3174
+ // @Trace()
3107
3175
  /**
3108
- * @param {?} placeDef
3109
3176
  * @return {?}
3110
3177
  */
3111
- AbstractPlaceNavigationComponent.prototype.getNav = /**
3112
- * @param {?} placeDef
3178
+ Visit.prototype.getRouteId =
3179
+ // @Trace()
3180
+ /**
3113
3181
  * @return {?}
3114
3182
  */
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
- };
3183
+ function () {
3184
+ return this.placeDefinition.getRouteIdFrom(this);
3132
3185
  };
3186
+ // @Trace()
3187
+ // @Trace()
3133
3188
  /**
3134
3189
  * @return {?}
3135
3190
  */
3136
- AbstractPlaceNavigationComponent.prototype.ngOnInit = /**
3191
+ Visit.prototype.hasRouteId =
3192
+ // @Trace()
3193
+ /**
3137
3194
  * @return {?}
3138
3195
  */
3139
3196
  function () {
3197
+ return !isNil(this.getRouteId());
3140
3198
  };
3141
- AbstractPlaceNavigationComponent.propDecorators = {
3142
- places: [{ type: Input }],
3143
- placesModel: [{ type: Input }]
3199
+ /**
3200
+ * Returns the value of the place parameter with the specified name. The parameter
3201
+ * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
3202
+ * same as the the ValueModel property name.
3203
+ * @param parameterName the field name of the property model or the `as` option if specified.
3204
+ */
3205
+ /**
3206
+ * Returns the value of the place parameter with the specified name. The parameter
3207
+ * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
3208
+ * same as the the ValueModel property name.
3209
+ * @param {?} parameterName the field name of the property model or the `as` option if specified.
3210
+ * @return {?}
3211
+ */
3212
+ Visit.prototype.getParameter = /**
3213
+ * Returns the value of the place parameter with the specified name. The parameter
3214
+ * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
3215
+ * same as the the ValueModel property name.
3216
+ * @param {?} parameterName the field name of the property model or the `as` option if specified.
3217
+ * @return {?}
3218
+ */
3219
+ function (parameterName) {
3220
+ return this.visitParameters[parameterName];
3221
+ };
3222
+ // @Trace()
3223
+ // @Trace()
3224
+ /**
3225
+ * @param {?} parameterName
3226
+ * @return {?}
3227
+ */
3228
+ Visit.prototype.hasParameter =
3229
+ // @Trace()
3230
+ /**
3231
+ * @param {?} parameterName
3232
+ * @return {?}
3233
+ */
3234
+ function (parameterName) {
3235
+ return Object.keys(this.visitParameters).includes(parameterName);
3236
+ };
3237
+ /**
3238
+ * @template S
3239
+ * @param {?} parameter
3240
+ * @param {?} value
3241
+ * @return {?}
3242
+ */
3243
+ Visit.prototype.replace = /**
3244
+ * @template S
3245
+ * @param {?} parameter
3246
+ * @param {?} value
3247
+ * @return {?}
3248
+ */
3249
+ function (parameter, value) {
3250
+ var _a;
3251
+ return new Visit(this.placeDefinition, __assign({}, this.visitParameters, (_a = {}, _a[parameter.name] = value, _a)));
3252
+ };
3253
+ /**
3254
+ * @template S
3255
+ * @param {?} routeParams
3256
+ * @return {?}
3257
+ */
3258
+ Visit.prototype.mergeRouteParameters = /**
3259
+ * @template S
3260
+ * @param {?} routeParams
3261
+ * @return {?}
3262
+ */
3263
+ function (routeParams) {
3264
+ var _this = this;
3265
+ // todo: whitelist parameters.
3266
+ /** @type {?} */
3267
+ var routeParameterKeys = Object.keys(routeParams);
3268
+ /** @type {?} */
3269
+ var params = {};
3270
+ this.placeDefinition.getVisitParameterDefs().forEach((/**
3271
+ * @param {?} def
3272
+ * @return {?}
3273
+ */
3274
+ function (def) {
3275
+ if (def.isRouteId || def.isRouteParameter) {
3276
+ if (routeParameterKeys.includes(def.name)) {
3277
+ params[def.name] = routeParams[def.name];
3278
+ }
3279
+ }
3280
+ else {
3281
+ // copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
3282
+ // defaults and remember sanitisation process.
3283
+ if (_this.hasParameter(def.name)) {
3284
+ params[def.name] = _this.getParameter(def.name);
3285
+ }
3286
+ }
3287
+ }));
3288
+ return new Visit(this.placeDefinition, params);
3144
3289
  };
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
3290
  /**
3291
+ * @param {?} other
3182
3292
  * @return {?}
3183
3293
  */
3184
- ListPlaceNavComponent.prototype.expandMenu = /**
3294
+ Visit.prototype.hasRoutingChangedFrom = /**
3295
+ * @param {?} other
3185
3296
  * @return {?}
3186
3297
  */
3187
- function () {
3188
- this.expanded = true;
3298
+ function (other) {
3299
+ /** @type {?} */
3300
+ var samePlace = other.placeDefinition === this.placeDefinition;
3301
+ /** @type {?} */
3302
+ var sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
3303
+ return !samePlace || !sameRouteParameters;
3189
3304
  };
3190
3305
  /**
3306
+ * @param {?} other
3191
3307
  * @return {?}
3192
3308
  */
3193
- ListPlaceNavComponent.prototype.collapseMenu = /**
3309
+ Visit.prototype.hasChangedFrom = /**
3310
+ * @param {?} other
3194
3311
  * @return {?}
3195
3312
  */
3196
- function () {
3197
- this.expanded = false;
3313
+ function (other) {
3314
+ /** @type {?} */
3315
+ var sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
3316
+ return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
3198
3317
  };
3199
3318
  /**
3200
3319
  * @return {?}
3201
3320
  */
3202
- ListPlaceNavComponent.prototype.toggleMenu = /**
3321
+ Visit.prototype.getUrlSegments = /**
3203
3322
  * @return {?}
3204
3323
  */
3205
3324
  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',] }]
3325
+ return this.placeDefinition.hasRouteId() ?
3326
+ [new UrlSegment(this.placeDefinition.path, {}), new UrlSegment(this.placeDefinition.getFormattedRouteId(this), this.placeDefinition.getFormattedRouteParameters(this))] :
3327
+ [new UrlSegment(this.placeDefinition.path, this.placeDefinition.getFormattedRouteParameters(this))];
3219
3328
  };
3220
- return ListPlaceNavComponent;
3221
- }(AbstractPlaceNavigationComponent));
3329
+ return Visit;
3330
+ }());
3222
3331
  if (false) {
3223
3332
  /** @type {?} */
3224
- ListPlaceNavComponent.prototype.expanded;
3333
+ Visit.prototype.placeDefinition;
3334
+ /**
3335
+ * @type {?}
3336
+ * @private
3337
+ */
3338
+ Visit.prototype.visitParameters;
3225
3339
  }
3226
3340
 
3227
3341
  /**
@@ -3478,197 +3592,26 @@ var PlaceHistory = /** @class */ (function () {
3478
3592
  PlaceHistory.decorators = [
3479
3593
  { type: Injectable, args: [{
3480
3594
  providedIn: 'root'
3481
- },] }
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;
3595
+ },] }
3596
+ ];
3597
+ /** @nocollapse */
3598
+ PlaceHistory.ctorParameters = function () { return [
3599
+ { type: Router }
3600
+ ]; };
3601
+ /** @nocollapse */ PlaceHistory.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(ɵɵinject(Router)); }, token: PlaceHistory, providedIn: "root" });
3602
+ return PlaceHistory;
3663
3603
  }());
3664
3604
  if (false) {
3665
- /** @type {?} */
3666
- Visit.prototype.placeDefinition;
3667
3605
  /**
3668
3606
  * @type {?}
3669
3607
  * @private
3670
3608
  */
3671
- Visit.prototype.visitParameters;
3609
+ PlaceHistory.prototype._history;
3610
+ /**
3611
+ * @type {?}
3612
+ * @private
3613
+ */
3614
+ PlaceHistory.prototype.router;
3672
3615
  }
3673
3616
 
3674
3617
  /**
@@ -3800,13 +3743,17 @@ var PlaceRouter = /** @class */ (function (_super) {
3800
3743
  });
3801
3744
  });
3802
3745
  };
3746
+ // @Trace()
3747
+ // @Trace()
3803
3748
  /**
3804
3749
  * @param {?} activatedRoute
3805
3750
  * @param {?} previous
3806
3751
  * @param {?} next
3807
3752
  * @return {?}
3808
3753
  */
3809
- PlaceRouter.prototype.pushVisitChangesToRoute = /**
3754
+ PlaceRouter.prototype.pushVisitChangesToRoute =
3755
+ // @Trace()
3756
+ /**
3810
3757
  * @param {?} activatedRoute
3811
3758
  * @param {?} previous
3812
3759
  * @param {?} next
@@ -3826,13 +3773,16 @@ var PlaceRouter = /** @class */ (function (_super) {
3826
3773
  * @return {?}
3827
3774
  */
3828
3775
  function (router) {
3776
+ // we have to to use the definition for route id as our redirection always includes
3777
+ // the id in the url segements (but leaves it blank when there's no id). I.e. in the
3778
+ // no id case we're doing the following redirect [<placePath>, ""] -> ["..", <id>]
3829
3779
  /** @type {?} */
3830
3780
  var relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
3831
3781
  /** @type {?} */
3832
3782
  var commands = __spread([
3833
3783
  relativePath
3834
3784
  ], _this.createRouteParameters(next), _this.extractChildPath(activatedRoute.snapshot));
3835
- console.log('### Redirect', commands);
3785
+ console.log('### Push Changes to route Redirect', { commands: commands, relativeTo: activatedRoute.snapshot.url });
3836
3786
  return router.navigate(commands, {
3837
3787
  relativeTo: activatedRoute
3838
3788
  });
@@ -3981,12 +3931,6 @@ var PlaceRouter = /** @class */ (function (_super) {
3981
3931
  __metadata("design:paramtypes", [Visit, Object]),
3982
3932
  __metadata("design:returntype", Promise)
3983
3933
  ], 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
3934
  return PlaceRouter;
3991
3935
  }(GarbageCollector));
3992
3936
  if (false) {
@@ -4100,29 +4044,51 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4100
4044
  var _this = _super.call(this) || this;
4101
4045
  _this.router = router;
4102
4046
  _this.placeRouter = placeRouter;
4103
- _this.parentOutlet = parentOutlet;
4104
4047
  _this.animate = true;
4105
4048
  _this.placeChanged = new EventEmitter();
4106
4049
  _this._activePlace = new MutableValueModel();
4050
+ _this._placeVisit = new MutableValueModel();
4107
4051
  _this._inOutletUpdate = new Guard$1();
4108
4052
  _this._activatedRouteModel = new MutableValueModel();
4109
4053
  _this._placeDefinition = new MutableValueModel();
4110
- /**
4111
- * TODO: This is now really a visit
4112
- */
4113
- _this._placeVisit = new MutableValueModel();
4114
4054
  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;
4115
- // Handle incoming route changes.
4055
+ _this.parentOutletModel = new MutableValueModel(parentOutlet);
4116
4056
  /** @type {?} */
4117
- var inRouteVisitUpdate = new Guard$1();
4057
+ var defaultPlaceAnimationOrder = chain(_this.parentOutletModel)
4058
+ .pullValueModel((/**
4059
+ * @param {?} o
4060
+ * @return {?}
4061
+ */
4062
+ function (o) { return o.activePlaceModel; }))
4063
+ .pluck("placeDefinition")
4064
+ .pluckList("children")
4065
+ .pluck("component");
4066
+ /** @type {?} */
4067
+ var activatePlaceType = chain(_this.activePlaceModel).map((/**
4068
+ * @param {?} p
4069
+ * @return {?}
4070
+ */
4071
+ function (p) { return (/** @type {?} */ (p.constructor)); }));
4072
+ _this.placeAnimationOrder = chain(_this.customPlaceAnimationOrderModel)
4073
+ .otherwise(defaultPlaceAnimationOrder)
4074
+ .indexOf(activatePlaceType)
4075
+ .map((/**
4076
+ * @param {?} order
4077
+ * @return {?}
4078
+ */
4079
+ function (order) { return Math.max(order, 0); })); // we get -1 on the first load which triggers an animation to the first page, so alway pin it to 0.
4080
+ // we get -1 on the first load which triggers an animation to the first page, so alway pin it to 0.
4081
+ // Push incoming changes into the component
4118
4082
  /** @type {?} */
4119
4083
  var routeVisit = chain(_this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
4084
+ /** @type {?} */
4085
+ var inRouteVisitUpdate = new Guard$1();
4120
4086
  when.valueOf(routeVisit).changes((/**
4121
4087
  * @param {?} visit
4122
4088
  * @return {?}
4123
4089
  */
4124
4090
  function (visit) {
4125
- if (visit) {
4091
+ if (visit) { // can be null while the place and index sync up
4126
4092
  inRouteVisitUpdate.whileTrue((/**
4127
4093
  * @return {?}
4128
4094
  */
@@ -4175,6 +4141,16 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4175
4141
  relativeTo: this.parentOutlet ? this.parentOutlet.activatedRouteModel.value : null
4176
4142
  });
4177
4143
  };
4144
+ Object.defineProperty(PlaceOutletComponent.prototype, "parentOutlet", {
4145
+ get: /**
4146
+ * @return {?}
4147
+ */
4148
+ function () {
4149
+ return this.parentOutletModel.value;
4150
+ },
4151
+ enumerable: true,
4152
+ configurable: true
4153
+ });
4178
4154
  /**
4179
4155
  * @param {?} next
4180
4156
  * @param {?} previous
@@ -4241,132 +4217,307 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4241
4217
  this.animationDone();
4242
4218
  }
4243
4219
  };
4220
+ // @Trace()
4221
+ // @Trace()
4222
+ /**
4223
+ * @param {?} routerOutlet
4224
+ * @param {?} $event
4225
+ * @return {?}
4226
+ */
4227
+ PlaceOutletComponent.prototype.onOutletDeactivated =
4228
+ // @Trace()
4229
+ /**
4230
+ * @param {?} routerOutlet
4231
+ * @param {?} $event
4232
+ * @return {?}
4233
+ */
4234
+ function (routerOutlet, $event) {
4235
+ var _this = this;
4236
+ this._inOutletUpdate.whileTrue((/**
4237
+ * @return {?}
4238
+ */
4239
+ function () {
4240
+ _this._activePlace.value = null;
4241
+ _this._activatedRouteModel.value = null;
4242
+ _this._placeDefinition.value = null;
4243
+ }));
4244
+ };
4245
+ /**
4246
+ * @return {?}
4247
+ */
4248
+ PlaceOutletComponent.prototype.animationDone = /**
4249
+ * @return {?}
4250
+ */
4251
+ function () {
4252
+ if (this._activePlace.value) {
4253
+ this._activePlace.value.onPlaceReady();
4254
+ }
4255
+ };
4256
+ PlaceOutletComponent.decorators = [
4257
+ { type: Component, args: [{
4258
+ selector: 'aup-place-outlet',
4259
+ 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",
4260
+ animations: [LEFT_RIGHT_PLACE_ANIMATION],
4261
+ 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}"]
4262
+ }] }
4263
+ ];
4264
+ /** @nocollapse */
4265
+ PlaceOutletComponent.ctorParameters = function () { return [
4266
+ { type: Router },
4267
+ { type: PlaceRouter },
4268
+ { type: PlaceOutletComponent, decorators: [{ type: SkipSelf }, { type: Optional }] }
4269
+ ]; };
4270
+ PlaceOutletComponent.propDecorators = {
4271
+ animate: [{ type: Input }],
4272
+ customPlaceAnimationOrderModel: [{ type: Input, args: ['placeAnimationOrderModel',] }],
4273
+ customPlaceAnimationOrder: [{ type: Input, args: ['placeAnimationOrder',] }],
4274
+ placeChanged: [{ type: Output }],
4275
+ routerOut: [{ type: ViewChild, args: ['routeOutlet', { static: true },] }]
4276
+ };
4277
+ __decorate([
4278
+ UseDelegate(),
4279
+ __metadata("design:type", ListModel)
4280
+ ], PlaceOutletComponent.prototype, "customPlaceAnimationOrderModel", void 0);
4281
+ __decorate([
4282
+ StoreInListModel("customPlaceAnimationOrderModel"),
4283
+ __metadata("design:type", Array)
4284
+ ], PlaceOutletComponent.prototype, "customPlaceAnimationOrder", void 0);
4285
+ __decorate([
4286
+ Trace(),
4287
+ __metadata("design:type", Function),
4288
+ __metadata("design:paramtypes", [Visit]),
4289
+ __metadata("design:returntype", void 0)
4290
+ ], PlaceOutletComponent.prototype, "navigate", null);
4291
+ __decorate([
4292
+ Trace(),
4293
+ __metadata("design:type", Function),
4294
+ __metadata("design:paramtypes", [RouterOutlet, PlaceComponent]),
4295
+ __metadata("design:returntype", void 0)
4296
+ ], PlaceOutletComponent.prototype, "onOutletActivated", null);
4297
+ return PlaceOutletComponent;
4298
+ }(DisposableComponent));
4299
+ if (false) {
4300
+ /** @type {?} */
4301
+ PlaceOutletComponent.prototype.animate;
4302
+ /** @type {?} */
4303
+ PlaceOutletComponent.prototype.customPlaceAnimationOrderModel;
4304
+ /** @type {?} */
4305
+ PlaceOutletComponent.prototype.customPlaceAnimationOrder;
4306
+ /** @type {?} */
4307
+ PlaceOutletComponent.prototype.placeChanged;
4308
+ /** @type {?} */
4309
+ PlaceOutletComponent.prototype.routerOut;
4310
+ /**
4311
+ * @type {?}
4312
+ * @private
4313
+ */
4314
+ PlaceOutletComponent.prototype._activePlace;
4315
+ /**
4316
+ * @type {?}
4317
+ * @private
4318
+ */
4319
+ PlaceOutletComponent.prototype._placeVisit;
4320
+ /**
4321
+ * @type {?}
4322
+ * @private
4323
+ */
4324
+ PlaceOutletComponent.prototype._inOutletUpdate;
4325
+ /**
4326
+ * @type {?}
4327
+ * @private
4328
+ */
4329
+ PlaceOutletComponent.prototype._activatedRouteModel;
4330
+ /**
4331
+ * @type {?}
4332
+ * @private
4333
+ */
4334
+ PlaceOutletComponent.prototype._placeDefinition;
4335
+ /**
4336
+ * @type {?}
4337
+ * @private
4338
+ */
4339
+ PlaceOutletComponent.prototype.parentOutletModel;
4340
+ /** @type {?} */
4341
+ PlaceOutletComponent.prototype.placeAnimationOrder;
4342
+ /**
4343
+ * @type {?}
4344
+ * @private
4345
+ */
4346
+ PlaceOutletComponent.prototype.router;
4347
+ /**
4348
+ * @type {?}
4349
+ * @private
4350
+ */
4351
+ PlaceOutletComponent.prototype.placeRouter;
4352
+ }
4353
+
4354
+ /**
4355
+ * @fileoverview added by tsickle
4356
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4357
+ */
4358
+ var AbstractPlaceNavigationComponent = /** @class */ (function (_super) {
4359
+ __extends(AbstractPlaceNavigationComponent, _super);
4360
+ function AbstractPlaceNavigationComponent() {
4361
+ var _this = _super.call(this) || this;
4362
+ 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;
4363
+ _this.placeDefinitions = chain(_this.placesModel).map((/**
4364
+ * @param {?} c
4365
+ * @return {?}
4366
+ */
4367
+ function (c) { return PlaceComponent.getDefinition(c); }));
4368
+ _this.relativeToModel = chain(_this.placeOutletModel).pullValueModel((/**
4369
+ * @param {?} o
4370
+ * @return {?}
4371
+ */
4372
+ function (o) { return o.activatedRouteModel; }));
4373
+ _this.commandFactory = Command.createFactory((/**
4374
+ * @param {?} placeDefinition
4375
+ * @return {?}
4376
+ */
4377
+ function (placeDefinition) {
4378
+ _this.placeOutlet.navigate(new Visit(placeDefinition));
4379
+ }));
4380
+ return _this;
4381
+ }
4382
+ /**
4383
+ * @param {?} placeDef
4384
+ * @return {?}
4385
+ */
4386
+ AbstractPlaceNavigationComponent.prototype.getNav = /**
4387
+ * @param {?} placeDef
4388
+ * @return {?}
4389
+ */
4390
+ function (placeDef) {
4391
+ /** @type {?} */
4392
+ var navItem = (/** @type {?} */ (placeDef.getPlaceData('nav')));
4393
+ return {
4394
+ title: (/**
4395
+ * @return {?}
4396
+ */
4397
+ function () { return navItem ? navItem.title() : placeDef.searchPlaceData(['navTitle', 'title']); }),
4398
+ tooltip: (/**
4399
+ * @return {?}
4400
+ */
4401
+ function () { return navItem && navItem.tooltip ? navItem.tooltip() : placeDef.getPlaceData('navTooltip', null); }),
4402
+ icon: (/**
4403
+ * @return {?}
4404
+ */
4405
+ function () { return navItem && navItem.icon ? navItem.icon() : placeDef.getPlaceData('navIcon', null); })
4406
+ };
4407
+ };
4408
+ /**
4409
+ * @return {?}
4410
+ */
4411
+ AbstractPlaceNavigationComponent.prototype.ngOnInit = /**
4412
+ * @return {?}
4413
+ */
4414
+ function () {
4415
+ };
4416
+ AbstractPlaceNavigationComponent.propDecorators = {
4417
+ places: [{ type: Input }],
4418
+ placesModel: [{ type: Input }],
4419
+ placeOutlet: [{ type: Input }],
4420
+ placeOutletModel: [{ type: Input }]
4421
+ };
4422
+ __decorate([
4423
+ StoreInListModel('placesModel'),
4424
+ __metadata("design:type", Array)
4425
+ ], AbstractPlaceNavigationComponent.prototype, "places", void 0);
4426
+ __decorate([
4427
+ UseDelegate(),
4428
+ __metadata("design:type", ListModel)
4429
+ ], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
4430
+ __decorate([
4431
+ StoreInValueModel('placeOutletModel'),
4432
+ __metadata("design:type", PlaceOutletComponent)
4433
+ ], AbstractPlaceNavigationComponent.prototype, "placeOutlet", void 0);
4434
+ __decorate([
4435
+ UseDelegate(),
4436
+ __metadata("design:type", ValueModel)
4437
+ ], AbstractPlaceNavigationComponent.prototype, "placeOutletModel", void 0);
4438
+ __decorate([
4439
+ Memoize(),
4440
+ __metadata("design:type", Function),
4441
+ __metadata("design:paramtypes", [PlaceDefinition]),
4442
+ __metadata("design:returntype", Object)
4443
+ ], AbstractPlaceNavigationComponent.prototype, "getNav", null);
4444
+ return AbstractPlaceNavigationComponent;
4445
+ }(DisposableComponent));
4446
+ if (false) {
4447
+ /** @type {?} */
4448
+ AbstractPlaceNavigationComponent.prototype.places;
4449
+ /** @type {?} */
4450
+ AbstractPlaceNavigationComponent.prototype.placesModel;
4451
+ /** @type {?} */
4452
+ AbstractPlaceNavigationComponent.prototype.placeOutlet;
4453
+ /** @type {?} */
4454
+ AbstractPlaceNavigationComponent.prototype.placeOutletModel;
4455
+ /** @type {?} */
4456
+ AbstractPlaceNavigationComponent.prototype.placeDefinitions;
4457
+ /**
4458
+ * @type {?}
4459
+ * @protected
4460
+ */
4461
+ AbstractPlaceNavigationComponent.prototype.relativeToModel;
4462
+ /** @type {?} */
4463
+ AbstractPlaceNavigationComponent.prototype.commandFactory;
4464
+ }
4465
+
4466
+ /**
4467
+ * @fileoverview added by tsickle
4468
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4469
+ */
4470
+ var ListPlaceNavComponent = /** @class */ (function (_super) {
4471
+ __extends(ListPlaceNavComponent, _super);
4472
+ function ListPlaceNavComponent() {
4473
+ var _this = _super.call(this) || this;
4474
+ _this.expanded = true;
4475
+ return _this;
4476
+ }
4244
4477
  /**
4245
- * @param {?} routerOutlet
4246
- * @param {?} $event
4247
4478
  * @return {?}
4248
4479
  */
4249
- PlaceOutletComponent.prototype.onOutletDeactivated = /**
4250
- * @param {?} routerOutlet
4251
- * @param {?} $event
4480
+ ListPlaceNavComponent.prototype.expandMenu = /**
4252
4481
  * @return {?}
4253
4482
  */
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
- }));
4483
+ function () {
4484
+ this.expanded = true;
4264
4485
  };
4265
4486
  /**
4266
- * @param {?} outlet
4267
4487
  * @return {?}
4268
4488
  */
4269
- PlaceOutletComponent.prototype.getPlaceOrder = /**
4270
- * @param {?} outlet
4489
+ ListPlaceNavComponent.prototype.collapseMenu = /**
4271
4490
  * @return {?}
4272
4491
  */
4273
- function (outlet) {
4274
- return this.animate && outlet && outlet.activatedRouteData && outlet.activatedRouteData['placeOrder'];
4492
+ function () {
4493
+ this.expanded = false;
4275
4494
  };
4276
4495
  /**
4277
4496
  * @return {?}
4278
4497
  */
4279
- PlaceOutletComponent.prototype.animationDone = /**
4498
+ ListPlaceNavComponent.prototype.toggleMenu = /**
4280
4499
  * @return {?}
4281
4500
  */
4282
4501
  function () {
4283
- if (this._activePlace.value) {
4284
- this._activePlace.value.onPlaceReady();
4285
- }
4502
+ this.expanded = !this.expanded;
4286
4503
  };
4287
- PlaceOutletComponent.decorators = [
4504
+ ListPlaceNavComponent.decorators = [
4288
4505
  { 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}"]
4506
+ selector: 'aup-list-place-nav',
4507
+ 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",
4508
+ 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
4509
  }] }
4294
4510
  ];
4295
4511
  /** @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 },] }]
4512
+ ListPlaceNavComponent.ctorParameters = function () { return []; };
4513
+ ListPlaceNavComponent.propDecorators = {
4514
+ expanded: [{ type: HostBinding, args: ['class.expanded',] }]
4305
4515
  };
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));
4516
+ return ListPlaceNavComponent;
4517
+ }(AbstractPlaceNavigationComponent));
4326
4518
  if (false) {
4327
4519
  /** @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;
4520
+ ListPlaceNavComponent.prototype.expanded;
4370
4521
  }
4371
4522
 
4372
4523
  /**
@@ -4380,8 +4531,8 @@ var TabbedPlaceNavigationComponent = /** @class */ (function (_super) {
4380
4531
  }
4381
4532
  TabbedPlaceNavigationComponent.decorators = [
4382
4533
  { 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",
4534
+ selector: 'aup-tabbed-place-navigation',
4535
+ 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
4536
  styles: [""]
4386
4537
  }] }
4387
4538
  ];
@@ -4404,10 +4555,11 @@ var PlaceModule = /** @class */ (function () {
4404
4555
  BrowserAnimationsModule,
4405
4556
  MatProgressSpinnerModule,
4406
4557
  RouterModule,
4407
- MatTabsModule$1,
4558
+ MatTabsModule,
4408
4559
  MatListModule,
4409
4560
  MatTooltipModule,
4410
- MatIconModule
4561
+ MatIconModule,
4562
+ DirectivesModule
4411
4563
  ],
4412
4564
  declarations: [
4413
4565
  EmptyStateComponent,
@@ -4439,15 +4591,7 @@ var AngularUiPowerupsModule = /** @class */ (function () {
4439
4591
  }
4440
4592
  AngularUiPowerupsModule.decorators = [
4441
4593
  { type: NgModule, args: [{
4442
- declarations: [
4443
- CommandDirective,
4444
- FocusBindingDirective,
4445
- NumberInputComponent,
4446
- StringInputComponent,
4447
- PasswordInputComponent,
4448
- SelectInputComponent,
4449
- NoopComponent
4450
- ],
4594
+ declarations: [],
4451
4595
  imports: [
4452
4596
  CommonModule,
4453
4597
  BrowserAnimationsModule,
@@ -4455,19 +4599,17 @@ var AngularUiPowerupsModule = /** @class */ (function () {
4455
4599
  MatInputModule,
4456
4600
  MatFormFieldModule,
4457
4601
  MatSelectModule,
4458
- MatTabsModule$1,
4602
+ MatTabsModule,
4603
+ DirectivesModule,
4604
+ ComponentsModule,
4459
4605
  PlaceModule,
4460
4606
  InteractionModule
4461
4607
  ],
4462
4608
  exports: [
4463
- CommandDirective,
4464
- FocusBindingDirective,
4465
- NumberInputComponent,
4466
- StringInputComponent,
4467
- PasswordInputComponent,
4468
- SelectInputComponent,
4469
4609
  InteractionModule,
4470
4610
  PlaceModule,
4611
+ DirectivesModule,
4612
+ ComponentsModule,
4471
4613
  NoopComponent
4472
4614
  ]
4473
4615
  },] }
@@ -4963,7 +5105,7 @@ function Place(options) {
4963
5105
  */
4964
5106
  function (target) {
4965
5107
  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((/**
5108
+ PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, isNil(options.authenticate) ? false : options.authenticate, options.data, PlaceComponent.getRouteParameters(target), (options.children || []).map((/**
4967
5109
  * @param {?} c
4968
5110
  * @return {?}
4969
5111
  */
@@ -4983,14 +5125,14 @@ function Place(options) {
4983
5125
  if (false) {
4984
5126
  /** @type {?} */
4985
5127
  Options.prototype.path;
4986
- /** @type {?} */
4987
- Options.prototype.order;
4988
5128
  /** @type {?|undefined} */
4989
5129
  Options.prototype.data;
4990
5130
  /** @type {?|undefined} */
4991
5131
  Options.prototype.authenticate;
4992
5132
  /** @type {?|undefined} */
4993
5133
  Options.prototype.children;
5134
+ /** @type {?|undefined} */
5135
+ Options.prototype.defaultChild;
4994
5136
  }
4995
5137
  })(Place || (Place = {}));
4996
5138
 
@@ -5286,218 +5428,79 @@ var VisitSanitiser = /** @class */ (function () {
5286
5428
  placeDef = visit.placeDefinition;
5287
5429
  if (!placeDef.hasRouteId()) return [3 /*break*/, 2];
5288
5430
  routeIdDef = placeDef.getRouteIdParameterDef();
5289
- routeId = visit.getRouteId();
5290
- return [4 /*yield*/, routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector)];
5291
- case 1:
5292
- sanitisedValue = _a.sent();
5293
- console.log({ routeId: routeId, sanitisedValue: sanitisedValue });
5294
- // ###------- EARLY EXIT --------###
5295
- if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
5296
- // if the route id has changed we redirect immediately as other
5297
- // parameter sanitisers might use it.
5298
- return [2 /*return*/, visit.replace(routeIdDef, sanitisedValue)];
5299
- }
5300
- _a.label = 2;
5301
- case 2:
5302
- // if we didn't replace the routeId we continue the url present parameters.
5303
- parameterDefs = placeDef.getVisitParameterDefs({
5304
- includeRouteParameters: true,
5305
- includeNonRouteParameters: true
5306
- });
5307
- sanitisedVisit = visit;
5308
- i = 0;
5309
- _a.label = 3;
5310
- case 3:
5311
- if (!(i < parameterDefs.length)) return [3 /*break*/, 6];
5312
- def = parameterDefs[i];
5313
- value = visit.getParameter(def.name);
5314
- return [4 /*yield*/, def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector)];
5315
- case 4:
5316
- sanitisedValue = _a.sent();
5317
- if (def.hasChanged(value, sanitisedValue)) {
5318
- sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
5319
- }
5320
- _a.label = 5;
5321
- case 5:
5322
- i++;
5323
- return [3 /*break*/, 3];
5324
- case 6: return [2 /*return*/, sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit];
5325
- }
5326
- });
5327
- });
5328
- };
5329
- return VisitSanitiser;
5330
- }());
5331
- if (false) {
5332
- /**
5333
- * @type {?}
5334
- * @private
5335
- */
5336
- VisitSanitiser.prototype.activatedRoute;
5337
- /**
5338
- * @type {?}
5339
- * @private
5340
- */
5341
- VisitSanitiser.prototype.router;
5342
- /**
5343
- * @type {?}
5344
- * @private
5345
- */
5346
- VisitSanitiser.prototype.placeHistory;
5347
- /**
5348
- * @type {?}
5349
- * @private
5350
- */
5351
- VisitSanitiser.prototype.injector;
5352
- }
5353
-
5354
- /**
5355
- * @fileoverview added by tsickle
5356
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5357
- */
5358
- var LeavePlaceGuard = /** @class */ (function () {
5359
- function LeavePlaceGuard(router, injector, placeRouter, interactionContext, angularLocation) {
5360
- this.router = router;
5361
- this.injector = injector;
5362
- this.placeRouter = placeRouter;
5363
- this.interactionContext = interactionContext;
5364
- this.angularLocation = angularLocation;
5365
- }
5366
- /**
5367
- * @private
5368
- * @param {?} nextState
5369
- * @param {?} placeDefinitionPath
5370
- * @return {?}
5371
- */
5372
- LeavePlaceGuard.prototype.isLeavingTheCurrentPlace = /**
5373
- * @private
5374
- * @param {?} nextState
5375
- * @param {?} placeDefinitionPath
5376
- * @return {?}
5377
- */
5378
- function (nextState, placeDefinitionPath) {
5379
- // TODO: this will break with child routes... need to examine the router states properly.
5380
- return !nextState.url.startsWith(placeDefinitionPath);
5381
- };
5382
- /**
5383
- * @param {?} component
5384
- * @param {?} currentRoute
5385
- * @param {?} currentState
5386
- * @param {?=} nextState
5387
- * @return {?}
5388
- */
5389
- LeavePlaceGuard.prototype.canDeactivate = /**
5390
- * @param {?} component
5391
- * @param {?} currentRoute
5392
- * @param {?} currentState
5393
- * @param {?=} nextState
5394
- * @return {?}
5395
- */
5396
- function (component, currentRoute, currentState, nextState) {
5397
- return __awaiter(this, void 0, void 0, function () {
5398
- var placeDefinitionPath, self_1, canLeave;
5399
- return __generator(this, function (_a) {
5400
- switch (_a.label) {
5401
- case 0:
5402
- placeDefinitionPath = "/" + component.placeDefinition.path;
5403
- if (!this.placeRouter.navigationSession.alreadyAccepted(component)) return [3 /*break*/, 1];
5404
- // We'll get called multiple times if there's any parameter sanitisation so
5405
- // we always return true if we accepted on a previous cycle of the current
5406
- // navigation session.
5407
- return [2 /*return*/, true];
5431
+ routeId = visit.getRouteId();
5432
+ return [4 /*yield*/, routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector)];
5408
5433
  case 1:
5409
- self_1 = this;
5410
- canLeave = true;
5411
- if (!this.isLeavingTheCurrentPlace(nextState, placeDefinitionPath)) return [3 /*break*/, 4];
5412
- // we check the interaction first, so that components that don't need to check if they're in an
5413
- // interaction during the canDeactivate cycle.
5414
- // TODO: Add tests: show dialog -> hit back -> same route
5415
- if (this.interactionContext.isActive()) {
5416
- canLeave = false;
5417
- console.log('cancelling', { activity: this.interactionContext.currentActivity });
5418
- this.interactionContext.currentActivity.cancel(null);
5434
+ sanitisedValue = _a.sent();
5435
+ console.log({ routeId: routeId, sanitisedValue: sanitisedValue });
5436
+ // ###------- EARLY EXIT --------###
5437
+ if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
5438
+ // if the route id has changed we redirect immediately as other
5439
+ // parameter sanitisers might use it.
5440
+ return [2 /*return*/, visit.replace(routeIdDef, sanitisedValue)];
5419
5441
  }
5420
- if (!canLeave) return [3 /*break*/, 3];
5421
- return [4 /*yield*/, component.canDeactivate()];
5442
+ _a.label = 2;
5422
5443
  case 2:
5423
- // TODO: Add tests: hit back -> confirm leave dialog -> hit back -> close dialog -> hit back -> confirm leave dialog.
5424
- canLeave = _a.sent();
5444
+ // if we didn't replace the routeId we continue the url present parameters.
5445
+ parameterDefs = placeDef.getVisitParameterDefs({
5446
+ includeRouteParameters: true,
5447
+ includeNonRouteParameters: true
5448
+ });
5449
+ sanitisedVisit = visit;
5450
+ i = 0;
5425
5451
  _a.label = 3;
5426
- case 3: return [3 /*break*/, 5];
5452
+ case 3:
5453
+ if (!(i < parameterDefs.length)) return [3 /*break*/, 6];
5454
+ def = parameterDefs[i];
5455
+ value = visit.getParameter(def.name);
5456
+ return [4 /*yield*/, def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector)];
5427
5457
  case 4:
5428
- if (this.interactionContext.isActive()) {
5429
- console.log('cancelling', { activity: this.interactionContext.currentActivity });
5430
- this.interactionContext.currentActivity.cancel(null);
5431
- canLeave = false;
5432
- }
5433
- else {
5434
- canLeave = true;
5458
+ sanitisedValue = _a.sent();
5459
+ if (def.hasChanged(value, sanitisedValue)) {
5460
+ sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
5435
5461
  }
5436
5462
  _a.label = 5;
5437
5463
  case 5:
5438
- if (canLeave) {
5439
- // We'll get called multiple times if there's any parameter sanitisation so
5440
- // we remember the acceptance for the duration of the current navigation session.
5441
- self_1.placeRouter.navigationSession.rememberAcceptanceOf(component);
5442
- }
5443
- else {
5444
- // Angular doesn't preserve the url when a guard cancels the back button.
5445
- // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
5446
- if (this.placeRouter.navigationSession.isPopState) {
5447
- console.log('cancelled during popstate');
5448
- this.angularLocation.go(this.placeRouter.navigationSession.popStateReturnUrl);
5449
- }
5450
- }
5451
- return [2 /*return*/, canLeave];
5464
+ i++;
5465
+ return [3 /*break*/, 3];
5466
+ case 6: return [2 /*return*/, sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit];
5452
5467
  }
5453
5468
  });
5454
5469
  });
5455
5470
  };
5456
- LeavePlaceGuard.decorators = [
5457
- { type: Injectable, args: [{
5458
- providedIn: 'root'
5459
- },] }
5460
- ];
5461
- /** @nocollapse */
5462
- LeavePlaceGuard.ctorParameters = function () { return [
5463
- { type: Router },
5464
- { type: Injector },
5465
- { type: PlaceRouter },
5466
- { type: InteractionContext },
5467
- { type: Location }
5468
- ]; };
5469
- /** @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" });
5470
- return LeavePlaceGuard;
5471
+ return VisitSanitiser;
5471
5472
  }());
5472
5473
  if (false) {
5473
5474
  /**
5474
5475
  * @type {?}
5475
5476
  * @private
5476
5477
  */
5477
- LeavePlaceGuard.prototype.router;
5478
+ VisitSanitiser.prototype.activatedRoute;
5478
5479
  /**
5479
5480
  * @type {?}
5480
5481
  * @private
5481
5482
  */
5482
- LeavePlaceGuard.prototype.injector;
5483
+ VisitSanitiser.prototype.router;
5483
5484
  /**
5484
5485
  * @type {?}
5485
5486
  * @private
5486
5487
  */
5487
- LeavePlaceGuard.prototype.placeRouter;
5488
- /** @type {?} */
5489
- LeavePlaceGuard.prototype.interactionContext;
5490
- /** @type {?} */
5491
- LeavePlaceGuard.prototype.angularLocation;
5488
+ VisitSanitiser.prototype.placeHistory;
5489
+ /**
5490
+ * @type {?}
5491
+ * @private
5492
+ */
5493
+ VisitSanitiser.prototype.injector;
5492
5494
  }
5493
5495
 
5494
5496
  /**
5495
5497
  * @fileoverview added by tsickle
5496
5498
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5497
5499
  */
5498
- var PlaceRouteGuard = /** @class */ (function () {
5499
- function PlaceRouteGuard(router, placeRouter, placeHistory, injector) {
5500
+ var EnterPlaceGuard = /** @class */ (function () {
5501
+ function EnterPlaceGuard(router, urlSerializer, placeRouter, placeHistory, injector) {
5500
5502
  this.router = router;
5503
+ this.urlSerializer = urlSerializer;
5501
5504
  this.placeRouter = placeRouter;
5502
5505
  this.placeHistory = placeHistory;
5503
5506
  this.injector = injector;
@@ -5509,7 +5512,7 @@ var PlaceRouteGuard = /** @class */ (function () {
5509
5512
  * @param {?} state
5510
5513
  * @return {?}
5511
5514
  */
5512
- PlaceRouteGuard.prototype.canActivate =
5515
+ EnterPlaceGuard.prototype.canActivate =
5513
5516
  // @Trace()
5514
5517
  /**
5515
5518
  * @param {?} activatedRoute
@@ -5518,14 +5521,14 @@ var PlaceRouteGuard = /** @class */ (function () {
5518
5521
  */
5519
5522
  function (activatedRoute, state) {
5520
5523
  return __awaiter(this, void 0, void 0, function () {
5521
- var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit, parameterCommands, commands;
5524
+ var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit, routerStateUrlTree, commands;
5522
5525
  return __generator(this, function (_a) {
5523
5526
  switch (_a.label) {
5524
5527
  case 0:
5525
5528
  if (!PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) return [3 /*break*/, 2];
5526
5529
  placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);
5527
5530
  // Parse our route params.
5528
- params = new PlaceRouteGuard.ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
5531
+ params = new EnterPlaceGuard.ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
5529
5532
  parsedParams = placeDefinition.parseRouteParams(params);
5530
5533
  initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
5531
5534
  sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
@@ -5535,11 +5538,10 @@ var PlaceRouteGuard = /** @class */ (function () {
5535
5538
  // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
5536
5539
  this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
5537
5540
  if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
5538
- parameterCommands = sanitisedVisit.hasRouteId() ?
5539
- [placeDefinition.getFormattedRouteId(sanitisedVisit), placeDefinition.getFormattedRouteParameters(sanitisedVisit)] :
5540
- [placeDefinition.getFormattedRouteParameters(sanitisedVisit)];
5541
- commands = [(activatedRoute.url[0].path)].concat(parameterCommands, this.placeRouter.extractChildPath(activatedRoute));
5542
- console.log('##### Redirect', commands);
5541
+ routerStateUrlTree = this.urlSerializer.parse(state.url);
5542
+ // Regenerate the url
5543
+ commands = this.createRedirectCommands(sanitisedVisit, __spread(routerStateUrlTree.root.children.primary.segments)).commands;
5544
+ console.log('##### Place Guard Redirect', commands);
5543
5545
  return [2 /*return*/, this.router.createUrlTree(commands, {
5544
5546
  replaceUrl: true,
5545
5547
  skipLocationChange: false
@@ -5555,44 +5557,90 @@ var PlaceRouteGuard = /** @class */ (function () {
5555
5557
  });
5556
5558
  });
5557
5559
  };
5558
- PlaceRouteGuard.decorators = [
5560
+ /**
5561
+ * @private
5562
+ * @param {?} sanitisedVisit
5563
+ * @param {?} path
5564
+ * @return {?}
5565
+ */
5566
+ EnterPlaceGuard.prototype.createRedirectCommands = /**
5567
+ * @private
5568
+ * @param {?} sanitisedVisit
5569
+ * @param {?} path
5570
+ * @return {?}
5571
+ */
5572
+ function (sanitisedVisit, path) {
5573
+ // Ugly, but it works for now.
5574
+ /** @type {?} */
5575
+ var newSegments = sanitisedVisit.getUrlSegments();
5576
+ /** @type {?} */
5577
+ var replaceAt = path.findIndex((/**
5578
+ * @param {?} segment
5579
+ * @return {?}
5580
+ */
5581
+ function (segment) { return segment.path === newSegments[0].path; }));
5582
+ /** @type {?} */
5583
+ var newPath = __spread(path);
5584
+ newPath.splice.apply(newPath, __spread([replaceAt, newSegments.length], newSegments)); // do not use the return value, it's the items that were removed!
5585
+ // do not use the return value, it's the items that were removed!
5586
+ /** @type {?} */
5587
+ var commands = [];
5588
+ newPath.forEach((/**
5589
+ * @param {?} s
5590
+ * @return {?}
5591
+ */
5592
+ function (s) {
5593
+ commands.push(s.path);
5594
+ if (s.parameterMap.keys.length > 0) {
5595
+ commands.push(s.parameters);
5596
+ }
5597
+ }));
5598
+ return { newPath: newPath, commands: commands };
5599
+ };
5600
+ EnterPlaceGuard.decorators = [
5559
5601
  { type: Injectable, args: [{
5560
5602
  providedIn: 'root'
5561
5603
  },] }
5562
5604
  ];
5563
5605
  /** @nocollapse */
5564
- PlaceRouteGuard.ctorParameters = function () { return [
5606
+ EnterPlaceGuard.ctorParameters = function () { return [
5565
5607
  { type: Router },
5608
+ { type: UrlSerializer },
5566
5609
  { type: PlaceRouter },
5567
5610
  { type: PlaceHistory },
5568
5611
  { type: Injector }
5569
5612
  ]; };
5570
- /** @nocollapse */ PlaceRouteGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouteGuard_Factory() { return new PlaceRouteGuard(ɵɵinject(Router), ɵɵinject(PlaceRouter), ɵɵinject(PlaceHistory), ɵɵinject(INJECTOR)); }, token: PlaceRouteGuard, providedIn: "root" });
5571
- return PlaceRouteGuard;
5613
+ /** @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" });
5614
+ return EnterPlaceGuard;
5572
5615
  }());
5573
5616
  if (false) {
5574
5617
  /**
5575
5618
  * @type {?}
5576
5619
  * @private
5577
5620
  */
5578
- PlaceRouteGuard.prototype.router;
5621
+ EnterPlaceGuard.prototype.router;
5579
5622
  /**
5580
5623
  * @type {?}
5581
5624
  * @private
5582
5625
  */
5583
- PlaceRouteGuard.prototype.placeRouter;
5626
+ EnterPlaceGuard.prototype.urlSerializer;
5584
5627
  /**
5585
5628
  * @type {?}
5586
5629
  * @private
5587
5630
  */
5588
- PlaceRouteGuard.prototype.placeHistory;
5631
+ EnterPlaceGuard.prototype.placeRouter;
5589
5632
  /**
5590
5633
  * @type {?}
5591
5634
  * @private
5592
5635
  */
5593
- PlaceRouteGuard.prototype.injector;
5636
+ EnterPlaceGuard.prototype.placeHistory;
5637
+ /**
5638
+ * @type {?}
5639
+ * @private
5640
+ */
5641
+ EnterPlaceGuard.prototype.injector;
5594
5642
  }
5595
- (function (PlaceRouteGuard) {
5643
+ (function (EnterPlaceGuard) {
5596
5644
  /**
5597
5645
  * This a work around for the fact that an activated route with multiple segments doesn't
5598
5646
  * include the segment params in the paramMap as well as each segment returns an empty
@@ -5681,7 +5729,7 @@ if (false) {
5681
5729
  ], ConsolidatedParameterMap.prototype, "keys", null);
5682
5730
  return ConsolidatedParameterMap;
5683
5731
  }());
5684
- PlaceRouteGuard.ConsolidatedParameterMap = ConsolidatedParameterMap;
5732
+ EnterPlaceGuard.ConsolidatedParameterMap = ConsolidatedParameterMap;
5685
5733
  if (false) {
5686
5734
  /**
5687
5735
  * @type {?}
@@ -5747,7 +5795,209 @@ if (false) {
5747
5795
  */
5748
5796
  ParamMapAdapter.prototype.params;
5749
5797
  }
5750
- })(PlaceRouteGuard || (PlaceRouteGuard = {}));
5798
+ })(EnterPlaceGuard || (EnterPlaceGuard = {}));
5799
+
5800
+ /**
5801
+ * @fileoverview added by tsickle
5802
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5803
+ */
5804
+ var LeavePlaceGuard = /** @class */ (function () {
5805
+ function LeavePlaceGuard(router, injector, placeRouter, interactionContext, angularLocation) {
5806
+ this.router = router;
5807
+ this.injector = injector;
5808
+ this.placeRouter = placeRouter;
5809
+ this.interactionContext = interactionContext;
5810
+ this.angularLocation = angularLocation;
5811
+ }
5812
+ /**
5813
+ * @private
5814
+ * @param {?} nextState
5815
+ * @param {?} placeDefinition
5816
+ * @return {?}
5817
+ */
5818
+ LeavePlaceGuard.prototype.isLeavingTheCurrentPlace = /**
5819
+ * @private
5820
+ * @param {?} nextState
5821
+ * @param {?} placeDefinition
5822
+ * @return {?}
5823
+ */
5824
+ function (nextState, placeDefinition) {
5825
+ // TODO: this will break with child routes... need to examine the router states properly.
5826
+ // console.log('canDeactivate', {
5827
+ // staticPath: placeDefinitionPath,
5828
+ // currentStateUrl: currentState.url,
5829
+ // nextStateUrl: nextState.url
5830
+ // // alreadyDeclined: this._alreadyAccepted
5831
+ // });
5832
+ // Example of the above when navigating to a different child route.
5833
+ // canDeactivate {staticPath: "/hero-details",
5834
+ // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-details",
5835
+ // nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats"
5836
+ // }
5837
+ // TODO: this will break with child routes... need to examine the router states properly.
5838
+ // console.log('canDeactivate', {
5839
+ // staticPath: placeDefinitionPath,
5840
+ // currentStateUrl: currentState.url,
5841
+ // nextStateUrl: nextState.url
5842
+ // // alreadyDeclined: this._alreadyAccepted
5843
+ // });
5844
+ // Example of the above when navigating to a different child route.
5845
+ // canDeactivate {staticPath: "/hero-details",
5846
+ // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-details",
5847
+ // nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats"
5848
+ // }
5849
+ // Example clicking on router tab of the parent component (de-activates the parent due to route param changes)
5850
+ // canDeactivate {
5851
+ // staticPath: "/hero-stats",
5852
+ // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
5853
+ // nextStateUrl: "/route-parameters/"
5854
+ // }
5855
+ // canDeactivate {
5856
+ // staticPath: "/route-parameters",
5857
+ // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
5858
+ // nextStateUrl: "/route-parameters/"
5859
+ // }
5860
+ // logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: undefined, dl: Array(0), …}
5861
+ // parameter-snapshot.ts:20 {name: "idModel", mine: -1, theirs: null}
5862
+ // place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
5863
+ // canDeactivate {
5864
+ // staticPath: "/hero-stats",
5865
+ // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
5866
+ // nextStateUrl: "/route-parameters/-1"
5867
+ // }
5868
+ // canDeactivate {
5869
+ // staticPath: "/route-parameters",
5870
+ // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
5871
+ // nextStateUrl: "/route-parameters/-1"
5872
+ // }
5873
+ // logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: "A", dl: Array(3), …}
5874
+ // parameter-snapshot.ts:20 {name: "dv", mine: "A", theirs: undefined}
5875
+ // place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
5876
+ // canDeactivate {
5877
+ // staticPath: "/hero-stats",
5878
+ // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
5879
+ // nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c"
5880
+ // }
5881
+ /** @type {?} */
5882
+ var placeDefinitionPath = "/" + placeDefinition.path;
5883
+ return !nextState.url.startsWith(placeDefinitionPath);
5884
+ };
5885
+ /**
5886
+ * @param {?} component
5887
+ * @param {?} currentRoute
5888
+ * @param {?} currentState
5889
+ * @param {?=} nextState
5890
+ * @return {?}
5891
+ */
5892
+ LeavePlaceGuard.prototype.canDeactivate = /**
5893
+ * @param {?} component
5894
+ * @param {?} currentRoute
5895
+ * @param {?} currentState
5896
+ * @param {?=} nextState
5897
+ * @return {?}
5898
+ */
5899
+ function (component, currentRoute, currentState, nextState) {
5900
+ return __awaiter(this, void 0, void 0, function () {
5901
+ var self_1, canLeave;
5902
+ return __generator(this, function (_a) {
5903
+ switch (_a.label) {
5904
+ case 0:
5905
+ if (!this.placeRouter.navigationSession.alreadyAccepted(component)) return [3 /*break*/, 1];
5906
+ // We'll get called multiple times if there's any parameter sanitisation so
5907
+ // we always return true if we accepted on a previous cycle of the current
5908
+ // navigation session.
5909
+ return [2 /*return*/, true];
5910
+ case 1:
5911
+ self_1 = this;
5912
+ canLeave = true;
5913
+ if (!this.isLeavingTheCurrentPlace(nextState, component.placeDefinition)) return [3 /*break*/, 4];
5914
+ // we check the interaction first, so that components that don't need to check if they're in an
5915
+ // interaction during the canDeactivate cycle.
5916
+ // TODO: Add tests: show dialog -> hit back -> same route
5917
+ if (this.interactionContext.isActive()) {
5918
+ canLeave = false;
5919
+ console.log('cancelling', { activity: this.interactionContext.currentActivity });
5920
+ this.interactionContext.currentActivity.cancel(null);
5921
+ }
5922
+ if (!canLeave) return [3 /*break*/, 3];
5923
+ return [4 /*yield*/, component.canDeactivate()];
5924
+ case 2:
5925
+ // TODO: Add tests: hit back -> confirm leave dialog -> hit back -> close dialog -> hit back -> confirm leave dialog.
5926
+ canLeave = _a.sent();
5927
+ _a.label = 3;
5928
+ case 3: return [3 /*break*/, 5];
5929
+ case 4:
5930
+ if (this.interactionContext.isActive()) {
5931
+ console.log('cancelling', { activity: this.interactionContext.currentActivity });
5932
+ this.interactionContext.currentActivity.cancel(null);
5933
+ canLeave = false;
5934
+ }
5935
+ else {
5936
+ canLeave = true;
5937
+ }
5938
+ _a.label = 5;
5939
+ case 5:
5940
+ if (canLeave) {
5941
+ // We'll get called multiple times if there's any parameter sanitisation so
5942
+ // we remember the acceptance for the duration of the current navigation session.
5943
+ self_1.placeRouter.navigationSession.rememberAcceptanceOf(component);
5944
+ }
5945
+ else {
5946
+ // Angular doesn't preserve the url when a guard cancels the back button.
5947
+ // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
5948
+ if (this.placeRouter.navigationSession.isPopState) {
5949
+ console.log('cancelled during popstate');
5950
+ this.angularLocation.go(this.placeRouter.navigationSession.popStateReturnUrl);
5951
+ }
5952
+ }
5953
+ return [2 /*return*/, canLeave];
5954
+ }
5955
+ });
5956
+ });
5957
+ };
5958
+ LeavePlaceGuard.decorators = [
5959
+ { type: Injectable, args: [{
5960
+ providedIn: 'root'
5961
+ },] }
5962
+ ];
5963
+ /** @nocollapse */
5964
+ LeavePlaceGuard.ctorParameters = function () { return [
5965
+ { type: Router },
5966
+ { type: Injector },
5967
+ { type: PlaceRouter },
5968
+ { type: InteractionContext },
5969
+ { type: Location }
5970
+ ]; };
5971
+ /** @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" });
5972
+ __decorate([
5973
+ Trace(),
5974
+ __metadata("design:type", Function),
5975
+ __metadata("design:paramtypes", [RouterStateSnapshot, PlaceDefinition]),
5976
+ __metadata("design:returntype", void 0)
5977
+ ], LeavePlaceGuard.prototype, "isLeavingTheCurrentPlace", null);
5978
+ return LeavePlaceGuard;
5979
+ }());
5980
+ if (false) {
5981
+ /**
5982
+ * @type {?}
5983
+ * @private
5984
+ */
5985
+ LeavePlaceGuard.prototype.router;
5986
+ /**
5987
+ * @type {?}
5988
+ * @private
5989
+ */
5990
+ LeavePlaceGuard.prototype.injector;
5991
+ /**
5992
+ * @type {?}
5993
+ * @private
5994
+ */
5995
+ LeavePlaceGuard.prototype.placeRouter;
5996
+ /** @type {?} */
5997
+ LeavePlaceGuard.prototype.interactionContext;
5998
+ /** @type {?} */
5999
+ LeavePlaceGuard.prototype.angularLocation;
6000
+ }
5751
6001
 
5752
6002
  /**
5753
6003
  * @fileoverview added by tsickle
@@ -5769,5 +6019,5 @@ if (false) {
5769
6019
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5770
6020
  */
5771
6021
 
5772
- 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 };
6022
+ 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, 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, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbj, DialogInteractionService as ɵbk, 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 };
5773
6023
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map