@coolon/angular-ui-powerups 0.0.1

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 (179) hide show
  1. package/README.md +7 -0
  2. package/bundles/coolon-angular-ui-powerups.umd.js +3373 -0
  3. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -0
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js +2 -0
  5. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -0
  6. package/coolon-angular-ui-powerups.d.ts +12 -0
  7. package/coolon-angular-ui-powerups.metadata.json +1 -0
  8. package/esm2015/coolon-angular-ui-powerups.js +17 -0
  9. package/esm2015/index.js +6 -0
  10. package/esm2015/lib/angular-ui-powerups.module.js +48 -0
  11. package/esm2015/lib/components/disposable-component.js +14 -0
  12. package/esm2015/lib/components/forms/abstract-input.component.js +173 -0
  13. package/esm2015/lib/components/forms/number-input/number-input.component.js +26 -0
  14. package/esm2015/lib/components/forms/password-input/password-input.component.js +26 -0
  15. package/esm2015/lib/components/forms/select-input/select-input.component.js +60 -0
  16. package/esm2015/lib/components/forms/string-input/string-input.component.js +26 -0
  17. package/esm2015/lib/components/index.js +18 -0
  18. package/esm2015/lib/components/resize-aware.component.js +96 -0
  19. package/esm2015/lib/components/types/bounds.class.js +56 -0
  20. package/esm2015/lib/components/types/dimension.class.js +21 -0
  21. package/esm2015/lib/components/types/point.class.js +36 -0
  22. package/esm2015/lib/directives/command.directive.js +91 -0
  23. package/esm2015/lib/directives/focus-binding.directive.js +163 -0
  24. package/esm2015/lib/directives/index.js +10 -0
  25. package/esm2015/lib/interaction/abstract-activity.js +129 -0
  26. package/esm2015/lib/interaction/activity.js +27 -0
  27. package/esm2015/lib/interaction/alert.js +23 -0
  28. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +144 -0
  29. package/esm2015/lib/interaction/components/activity-outlet/activity-outlet-context.js +22 -0
  30. package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.js +169 -0
  31. package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.js +37 -0
  32. package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +46 -0
  33. package/esm2015/lib/interaction/confirm.js +17 -0
  34. package/esm2015/lib/interaction/index.js +21 -0
  35. package/esm2015/lib/interaction/interaction-context.js +35 -0
  36. package/esm2015/lib/interaction/interaction.module.js +41 -0
  37. package/esm2015/lib/interaction/result.js +24 -0
  38. package/esm2015/lib/interaction/services/dialog-interaction.service.js +112 -0
  39. package/esm2015/lib/place/abstract-place-component.js +59 -0
  40. package/esm2015/lib/place/components/busy-overlay/busy-overlay.component.js +44 -0
  41. package/esm2015/lib/place/components/empty-state/empty-state.component.js +28 -0
  42. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +52 -0
  43. package/esm2015/lib/place/guards/leave-place.guard.js +52 -0
  44. package/esm2015/lib/place/guards/place-route.guard.js +74 -0
  45. package/esm2015/lib/place/index.js +25 -0
  46. package/esm2015/lib/place/place-component.js +17 -0
  47. package/esm2015/lib/place/place.decorator.js +67 -0
  48. package/esm2015/lib/place/place.module.js +38 -0
  49. package/esm2015/lib/place/place.service.js +61 -0
  50. package/esm2015/lib/place/route/json-types.js +13 -0
  51. package/esm2015/lib/place/route/parameter-decorators.js +82 -0
  52. package/esm2015/lib/place/route/parameter-definition.class.js +22 -0
  53. package/esm2015/lib/place/route/parameter-sanitiser.js +17 -0
  54. package/esm2015/lib/place/route/parameter-type.js +43 -0
  55. package/esm2015/lib/place/route/route-parameter-bindings.js +282 -0
  56. package/esm2015/lib/place/route/route-parameter-sanitiser.js +148 -0
  57. package/esm2015/public_api.js +10 -0
  58. package/esm5/coolon-angular-ui-powerups.js +17 -0
  59. package/esm5/index.js +6 -0
  60. package/esm5/lib/angular-ui-powerups.module.js +52 -0
  61. package/esm5/lib/components/disposable-component.js +24 -0
  62. package/esm5/lib/components/forms/abstract-input.component.js +218 -0
  63. package/esm5/lib/components/forms/number-input/number-input.component.js +33 -0
  64. package/esm5/lib/components/forms/password-input/password-input.component.js +33 -0
  65. package/esm5/lib/components/forms/select-input/select-input.component.js +67 -0
  66. package/esm5/lib/components/forms/string-input/string-input.component.js +33 -0
  67. package/esm5/lib/components/index.js +18 -0
  68. package/esm5/lib/components/resize-aware.component.js +124 -0
  69. package/esm5/lib/components/types/bounds.class.js +59 -0
  70. package/esm5/lib/components/types/dimension.class.js +19 -0
  71. package/esm5/lib/components/types/point.class.js +43 -0
  72. package/esm5/lib/directives/command.directive.js +107 -0
  73. package/esm5/lib/directives/focus-binding.directive.js +211 -0
  74. package/esm5/lib/directives/index.js +10 -0
  75. package/esm5/lib/interaction/abstract-activity.js +173 -0
  76. package/esm5/lib/interaction/activity.js +27 -0
  77. package/esm5/lib/interaction/alert.js +23 -0
  78. package/esm5/lib/interaction/components/activity-container/activity-container.component.js +181 -0
  79. package/esm5/lib/interaction/components/activity-outlet/activity-outlet-context.js +22 -0
  80. package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.js +206 -0
  81. package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js +42 -0
  82. package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +54 -0
  83. package/esm5/lib/interaction/confirm.js +17 -0
  84. package/esm5/lib/interaction/index.js +21 -0
  85. package/esm5/lib/interaction/interaction-context.js +45 -0
  86. package/esm5/lib/interaction/interaction.module.js +45 -0
  87. package/esm5/lib/interaction/result.js +24 -0
  88. package/esm5/lib/interaction/services/dialog-interaction.service.js +138 -0
  89. package/esm5/lib/place/abstract-place-component.js +66 -0
  90. package/esm5/lib/place/components/busy-overlay/busy-overlay.component.js +49 -0
  91. package/esm5/lib/place/components/empty-state/empty-state.component.js +29 -0
  92. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +62 -0
  93. package/esm5/lib/place/guards/leave-place.guard.js +57 -0
  94. package/esm5/lib/place/guards/place-route.guard.js +78 -0
  95. package/esm5/lib/place/index.js +25 -0
  96. package/esm5/lib/place/place-component.js +17 -0
  97. package/esm5/lib/place/place.decorator.js +64 -0
  98. package/esm5/lib/place/place.module.js +42 -0
  99. package/esm5/lib/place/place.service.js +75 -0
  100. package/esm5/lib/place/route/json-types.js +13 -0
  101. package/esm5/lib/place/route/parameter-decorators.js +82 -0
  102. package/esm5/lib/place/route/parameter-definition.class.js +22 -0
  103. package/esm5/lib/place/route/parameter-sanitiser.js +17 -0
  104. package/esm5/lib/place/route/parameter-type.js +65 -0
  105. package/esm5/lib/place/route/route-parameter-bindings.js +327 -0
  106. package/esm5/lib/place/route/route-parameter-sanitiser.js +203 -0
  107. package/esm5/public_api.js +10 -0
  108. package/fesm2015/coolon-angular-ui-powerups.js +2687 -0
  109. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -0
  110. package/fesm5/coolon-angular-ui-powerups.js +3164 -0
  111. package/fesm5/coolon-angular-ui-powerups.js.map +1 -0
  112. package/index.d.ts +1 -0
  113. package/lib/angular-ui-powerups.module.d.ts +2 -0
  114. package/lib/components/disposable-component.d.ts +5 -0
  115. package/lib/components/forms/abstract-input.component.d.ts +34 -0
  116. package/lib/components/forms/number-input/number-input.component.d.ts +6 -0
  117. package/lib/components/forms/password-input/password-input.component.d.ts +6 -0
  118. package/lib/components/forms/select-input/select-input.component.d.ts +11 -0
  119. package/lib/components/forms/string-input/string-input.component.d.ts +6 -0
  120. package/lib/components/index.d.ts +13 -0
  121. package/lib/components/resize-aware.component.d.ts +22 -0
  122. package/lib/components/types/bounds.class.d.ts +16 -0
  123. package/lib/components/types/dimension.class.d.ts +5 -0
  124. package/lib/components/types/point.class.d.ts +10 -0
  125. package/lib/directives/command.directive.d.ts +11 -0
  126. package/lib/directives/focus-binding.directive.d.ts +21 -0
  127. package/lib/directives/index.d.ts +5 -0
  128. package/lib/interaction/abstract-activity.d.ts +17 -0
  129. package/lib/interaction/activity.d.ts +11 -0
  130. package/lib/interaction/alert.d.ts +5 -0
  131. package/lib/interaction/components/activity-container/activity-container.component.d.ts +32 -0
  132. package/lib/interaction/components/activity-outlet/activity-outlet-context.d.ts +10 -0
  133. package/lib/interaction/components/activity-outlet/activity-outlet.component.d.ts +30 -0
  134. package/lib/interaction/components/alert-dialog/alert-dialog.component.d.ts +8 -0
  135. package/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.d.ts +9 -0
  136. package/lib/interaction/confirm.d.ts +5 -0
  137. package/lib/interaction/index.d.ts +16 -0
  138. package/lib/interaction/interaction-context.d.ts +11 -0
  139. package/lib/interaction/interaction.module.d.ts +2 -0
  140. package/lib/interaction/result.d.ts +8 -0
  141. package/lib/interaction/services/dialog-interaction.service.d.ts +14 -0
  142. package/lib/place/abstract-place-component.d.ts +13 -0
  143. package/lib/place/components/busy-overlay/busy-overlay.component.d.ts +8 -0
  144. package/lib/place/components/empty-state/empty-state.component.d.ts +5 -0
  145. package/lib/place/components/place-outlet/place-outlet.component.d.ts +10 -0
  146. package/lib/place/guards/leave-place.guard.d.ts +10 -0
  147. package/lib/place/guards/place-route.guard.d.ts +9 -0
  148. package/lib/place/index.d.ts +20 -0
  149. package/lib/place/place-component.d.ts +5 -0
  150. package/lib/place/place.decorator.d.ts +18 -0
  151. package/lib/place/place.module.d.ts +2 -0
  152. package/lib/place/place.service.d.ts +8 -0
  153. package/lib/place/route/json-types.d.ts +7 -0
  154. package/lib/place/route/parameter-decorators.d.ts +9 -0
  155. package/lib/place/route/parameter-definition.class.d.ts +10 -0
  156. package/lib/place/route/parameter-sanitiser.d.ts +3 -0
  157. package/lib/place/route/parameter-type.d.ts +16 -0
  158. package/lib/place/route/route-parameter-bindings.d.ts +18 -0
  159. package/lib/place/route/route-parameter-sanitiser.d.ts +15 -0
  160. package/package.json +31 -0
  161. package/public_api.d.ts +5 -0
  162. package/schematics/collection.json +14 -0
  163. package/schematics/ng-add/index.d.ts +2 -0
  164. package/schematics/ng-add/index.js +12 -0
  165. package/schematics/ng-add/index.js.map +1 -0
  166. package/schematics/place-routes/index.d.ts +3 -0
  167. package/schematics/place-routes/index.js +92 -0
  168. package/schematics/place-routes/index.js.map +1 -0
  169. package/schematics/place-routes/place-def.d.ts +31 -0
  170. package/schematics/place-routes/place-def.js +75 -0
  171. package/schematics/place-routes/place-def.js.map +1 -0
  172. package/schematics/place-routes/scanner.d.ts +26 -0
  173. package/schematics/place-routes/scanner.js +124 -0
  174. package/schematics/place-routes/scanner.js.map +1 -0
  175. package/schematics/place-routes/schema.d.ts +7 -0
  176. package/schematics/place-routes/schema.js +3 -0
  177. package/schematics/place-routes/schema.js.map +1 -0
  178. package/schematics/place-routes/schema.json +17 -0
  179. package/schematics/place-routes/templates/apps/__project__/src/app/place-routes.ts.template +31 -0
@@ -0,0 +1,2687 @@
1
+ import { DOCUMENT, CommonModule } from '@angular/common';
2
+ import { EventEmitter, Input, Output, HostListener, Component, Directive, ElementRef, Inject, NgZone, NgModule, InjectionToken, ViewChild, Injector, ComponentFactoryResolver, ViewContainerRef, Injectable, ɵɵdefineInjectable, ɵɵinject, INJECTOR } from '@angular/core';
3
+ import { FormsModule } from '@angular/forms';
4
+ import { MatInputModule, MatFormFieldModule, MatSelectModule, MatDialog, MatButtonModule, MatDialogModule, MatTabsModule, MatProgressSpinnerModule } from '@angular/material';
5
+ import { BrowserModule } from '@angular/platform-browser';
6
+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
+ import { __decorate, __metadata, __awaiter } from 'tslib';
8
+ import { GarbageCollector, MutableListModel, Constant, UseDelegate, MutableValueModel, assert, Dsl, Logger, ListModel, StoreInListModel, ValueHolder, EventListenerList, DelegatingValueModel, lang, Trace, TransactionObserver, Binding, UseDelegatingValueModel, ValueModel, StoreInValueModel } from '@coolon/pectin';
9
+ import ResizeObserver from 'resize-observer-polyfill';
10
+ import { PortalModule } from '@angular/cdk/portal';
11
+ import { Deferred } from '@coolon/pectin/lib/promise/deferred.class';
12
+ import { MatDialog as MatDialog$1 } from '@angular/material/dialog';
13
+ import { Memoize } from '@typescript-plus/fast-memoize-decorator';
14
+ import { isNil } from 'lodash';
15
+ import 'reflect-metadata';
16
+ import { Router, ActivatedRoute, RouterModule, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
17
+ import { Klass, Opts } from '@coolon/typescript-utilities';
18
+ import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator/dist/src';
19
+
20
+ /**
21
+ * @fileoverview added by tsickle
22
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
23
+ */
24
+ class DisposableComponent extends GarbageCollector {
25
+ /**
26
+ * @return {?}
27
+ */
28
+ ngOnDestroy() {
29
+ this.dispose();
30
+ }
31
+ }
32
+
33
+ /**
34
+ * @fileoverview added by tsickle
35
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
36
+ */
37
+ /** @type {?} */
38
+ const EMPTY_ERRORS = new MutableListModel().readonly;
39
+ /**
40
+ * @abstract
41
+ * @template T
42
+ */
43
+ class AbstractInputComponent extends DisposableComponent {
44
+ constructor() {
45
+ super();
46
+ this.focus = new EventEmitter();
47
+ this.blur = new EventEmitter();
48
+ this.enterKey = new EventEmitter();
49
+ this.escapeKey = new EventEmitter();
50
+ /** @type {?} */
51
+ const self = this;
52
+ this.errorStateMatcher = {
53
+ /**
54
+ * @param {?} control
55
+ * @param {?} form
56
+ * @return {?}
57
+ */
58
+ isErrorState(control, form) {
59
+ return self.hasErrors();
60
+ }
61
+ };
62
+ }
63
+ /**
64
+ * @return {?}
65
+ */
66
+ notifyClick() {
67
+ this.safelyInvoke(this.clickCommand);
68
+ }
69
+ /**
70
+ * @return {?}
71
+ */
72
+ notifyFocusIn() {
73
+ this.safelyInvoke(this.focusCommand);
74
+ this.focus.emit();
75
+ }
76
+ /**
77
+ * @return {?}
78
+ */
79
+ notifyFocusOut() {
80
+ this.safelyInvoke(this.blurCommand);
81
+ this.blur.emit();
82
+ }
83
+ /**
84
+ * @return {?}
85
+ */
86
+ notifyEnterKey() {
87
+ this.safelyInvoke(this.enterCommand);
88
+ this.enterKey.emit();
89
+ }
90
+ /**
91
+ * @return {?}
92
+ */
93
+ notifyEscapeKey() {
94
+ this.safelyInvoke(this.escapeCommand);
95
+ this.escapeKey.emit();
96
+ }
97
+ /**
98
+ * @protected
99
+ * @param {?} command
100
+ * @return {?}
101
+ */
102
+ safelyInvoke(command) {
103
+ if (command && command.isEnabled()) {
104
+ command.execute();
105
+ }
106
+ }
107
+ /**
108
+ * @return {?}
109
+ */
110
+ ngOnInit() {
111
+ // this._focused = this.valueModel['focused'] || new ValueHolder();
112
+ }
113
+ /**
114
+ * @return {?}
115
+ */
116
+ isEnabled() {
117
+ return this.enabled.value;
118
+ }
119
+ /**
120
+ * @return {?}
121
+ */
122
+ get enabled() {
123
+ // @ts-ignore
124
+ return ((/** @type {?} */ (this.valueModel))).enabled || Constant.TRUE;
125
+ }
126
+ /**
127
+ * @return {?}
128
+ */
129
+ hasErrors() {
130
+ return !this.errorList.query().isEmpty();
131
+ }
132
+ /**
133
+ * @return {?}
134
+ */
135
+ get errorList() {
136
+ return ((/** @type {?} */ (this.valueModel))).errorList || EMPTY_ERRORS;
137
+ }
138
+ /**
139
+ * @return {?}
140
+ */
141
+ get firstError() {
142
+ return this.hasErrors() ? this.errorList.value[0] : null;
143
+ }
144
+ }
145
+ AbstractInputComponent.propDecorators = {
146
+ valueModel: [{ type: Input }],
147
+ label: [{ type: Input }],
148
+ floatLabel: [{ type: Input }],
149
+ hint: [{ type: Input }],
150
+ placeholder: [{ type: Input }],
151
+ focusCommand: [{ type: Input, args: ['command.focus',] }],
152
+ blurCommand: [{ type: Input, args: ['command.blur',] }],
153
+ enterCommand: [{ type: Input, args: ['command.enter',] }],
154
+ escapeCommand: [{ type: Input, args: ['command.escape',] }],
155
+ clickCommand: [{ type: Input, args: ['command.click',] }],
156
+ focus: [{ type: Output }],
157
+ blur: [{ type: Output }],
158
+ enterKey: [{ type: Output }],
159
+ escapeKey: [{ type: Output }],
160
+ notifyClick: [{ type: HostListener, args: ['click',] }],
161
+ notifyFocusIn: [{ type: HostListener, args: ['focusin',] }],
162
+ notifyFocusOut: [{ type: HostListener, args: ['focusout',] }]
163
+ };
164
+ __decorate([
165
+ UseDelegate(),
166
+ __metadata("design:type", MutableValueModel)
167
+ ], AbstractInputComponent.prototype, "valueModel", void 0);
168
+ if (false) {
169
+ /** @type {?} */
170
+ AbstractInputComponent.prototype.valueModel;
171
+ /** @type {?} */
172
+ AbstractInputComponent.prototype.label;
173
+ /** @type {?} */
174
+ AbstractInputComponent.prototype.floatLabel;
175
+ /** @type {?} */
176
+ AbstractInputComponent.prototype.hint;
177
+ /** @type {?} */
178
+ AbstractInputComponent.prototype.placeholder;
179
+ /** @type {?} */
180
+ AbstractInputComponent.prototype.focusCommand;
181
+ /** @type {?} */
182
+ AbstractInputComponent.prototype.blurCommand;
183
+ /** @type {?} */
184
+ AbstractInputComponent.prototype.enterCommand;
185
+ /** @type {?} */
186
+ AbstractInputComponent.prototype.escapeCommand;
187
+ /** @type {?} */
188
+ AbstractInputComponent.prototype.clickCommand;
189
+ /** @type {?} */
190
+ AbstractInputComponent.prototype.focus;
191
+ /** @type {?} */
192
+ AbstractInputComponent.prototype.blur;
193
+ /** @type {?} */
194
+ AbstractInputComponent.prototype.enterKey;
195
+ /** @type {?} */
196
+ AbstractInputComponent.prototype.escapeKey;
197
+ /** @type {?} */
198
+ AbstractInputComponent.prototype.errorStateMatcher;
199
+ }
200
+
201
+ /**
202
+ * @fileoverview added by tsickle
203
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
204
+ */
205
+ class NumberInputComponent extends AbstractInputComponent {
206
+ constructor() {
207
+ super();
208
+ }
209
+ /**
210
+ * @return {?}
211
+ */
212
+ ngOnInit() {
213
+ }
214
+ }
215
+ NumberInputComponent.decorators = [
216
+ { type: Component, args: [{
217
+ selector: 'angular-ui-powerups-number-input',
218
+ 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",
219
+ styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
220
+ }] }
221
+ ];
222
+ /** @nocollapse */
223
+ NumberInputComponent.ctorParameters = () => [];
224
+
225
+ /**
226
+ * @fileoverview added by tsickle
227
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
228
+ */
229
+ class CommandDirective extends GarbageCollector {
230
+ /**
231
+ * @param {?} elementRef
232
+ */
233
+ constructor(elementRef) {
234
+ super();
235
+ this.elementRef = elementRef;
236
+ }
237
+ /**
238
+ * @return {?}
239
+ */
240
+ ngOnInit() {
241
+ assert.notNil(this.pectinCommand);
242
+ }
243
+ /**
244
+ * @return {?}
245
+ */
246
+ ngAfterViewInit() {
247
+ // for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now
248
+ // we need to do this.
249
+ const { chain } = Dsl.disposeWith(this);
250
+ chain.value(this.pectinCommand.enabled).subscribe((/**
251
+ * @param {?} enabled
252
+ * @return {?}
253
+ */
254
+ enabled => {
255
+ if (enabled) {
256
+ this.elementRef.nativeElement.removeAttribute('disabled');
257
+ if (this.elementRef.nativeElement.tagName === 'A') {
258
+ this.elementRef.nativeElement.setAttribute('href', 'javascript:void');
259
+ }
260
+ }
261
+ else {
262
+ this.elementRef.nativeElement.setAttribute('disabled', 'disabled');
263
+ if (this.elementRef.nativeElement.tagName === 'A') {
264
+ this.elementRef.nativeElement.removeAttribute('href');
265
+ }
266
+ }
267
+ }));
268
+ }
269
+ /**
270
+ * @return {?}
271
+ */
272
+ ngOnDestroy() {
273
+ this.dispose();
274
+ }
275
+ /**
276
+ * @param {?} $event
277
+ * @return {?}
278
+ */
279
+ notifyClick($event) {
280
+ $event.preventDefault();
281
+ $event.stopPropagation();
282
+ if (this.pectinCommand.isEnabled()) {
283
+ this.pectinCommand.execute({ event: $event });
284
+ }
285
+ else {
286
+ console.warn('disabled command clicked, ignoring.');
287
+ }
288
+ }
289
+ }
290
+ CommandDirective.decorators = [
291
+ { type: Directive, args: [{
292
+ // tslint:disable-next-line:directive-selector
293
+ selector: '[pectinCommand]'
294
+ },] }
295
+ ];
296
+ /** @nocollapse */
297
+ CommandDirective.ctorParameters = () => [
298
+ { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
299
+ ];
300
+ CommandDirective.propDecorators = {
301
+ pectinCommand: [{ type: Input }],
302
+ notifyClick: [{ type: HostListener, args: ['click', ['$event'],] }]
303
+ };
304
+ if (false) {
305
+ /** @type {?} */
306
+ CommandDirective.prototype.pectinCommand;
307
+ /**
308
+ * @type {?}
309
+ * @private
310
+ */
311
+ CommandDirective.prototype.elementRef;
312
+ }
313
+
314
+ /**
315
+ * @fileoverview added by tsickle
316
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
317
+ */
318
+ class FocusBindingDirective extends DisposableComponent {
319
+ /**
320
+ * @param {?} el
321
+ * @param {?} ngZone
322
+ * @param {?} document
323
+ */
324
+ constructor(el, ngZone, document) {
325
+ super();
326
+ this.el = el;
327
+ this.ngZone = ngZone;
328
+ // @see https://stackoverflow.com/questions/49513359/could-not-resolve-type-document-in-angular5/53715642#53715642
329
+ this.document = (/** @type {?} */ (document));
330
+ }
331
+ /**
332
+ * @return {?}
333
+ */
334
+ onFocusIn() {
335
+ this.pectinFocusBinding.focusCallbacks.notifyFocusIn();
336
+ }
337
+ /**
338
+ * @return {?}
339
+ */
340
+ onFocusOut() {
341
+ this.pectinFocusBinding.focusCallbacks.notifyFocusOut();
342
+ }
343
+ /**
344
+ * @return {?}
345
+ */
346
+ ngOnInit() {
347
+ }
348
+ /**
349
+ * @return {?}
350
+ */
351
+ ngAfterViewInit() {
352
+ // TODO: Make this also track the current enabled/disabled state.
353
+ const { chain } = Dsl.disposeWith(this);
354
+ chain.value(this.pectinFocusBinding.focused).subscribe((/**
355
+ * @param {?} focused
356
+ * @return {?}
357
+ */
358
+ (focused) => {
359
+ if (focused && !this.alreadyHasFocus()) {
360
+ this.tryAndFocus();
361
+ }
362
+ }));
363
+ }
364
+ // Hook method for debugging via tracing.
365
+ /**
366
+ * @return {?}
367
+ */
368
+ alreadyHasFocus() {
369
+ return this.isFocused(this.focusTarget);
370
+ }
371
+ // Hook method for debugging via tracing.
372
+ /**
373
+ * @param {?} element
374
+ * @return {?}
375
+ */
376
+ isFocused(element) {
377
+ return this.document.activeElement === element;
378
+ }
379
+ /**
380
+ * @param {?=} retries
381
+ * @return {?}
382
+ */
383
+ tryAndFocus(retries = 5) {
384
+ if (this.modelShouldStillHaveFocus() && this.canFocus()) {
385
+ if (!this.alreadyHasFocus()) {
386
+ this.focusTarget.focus();
387
+ }
388
+ // if we didn't get the focus we try again later.
389
+ if (!this.alreadyHasFocus()) {
390
+ Logger.get(this).log(`focus failed, trying ${retries} more times`);
391
+ if (retries > 0) {
392
+ // try again on the next paint
393
+ // TODO: is there an angular way of doing this without calling a window function.
394
+ requestAnimationFrame((/**
395
+ * @return {?}
396
+ */
397
+ () => {
398
+ this.tryAndFocus(retries - 1);
399
+ }));
400
+ }
401
+ else {
402
+ Logger.get(this).warn(`Tried to focus but gave up as the component wasn't enabled or visible.`);
403
+ }
404
+ }
405
+ }
406
+ }
407
+ /**
408
+ * @return {?}
409
+ */
410
+ get focusTarget() {
411
+ return this.focusBindingTarget || this.el.nativeElement;
412
+ }
413
+ // Hook method for debugging via tracing.
414
+ /**
415
+ * @return {?}
416
+ */
417
+ modelShouldStillHaveFocus() {
418
+ return this.pectinFocusBinding.focused.value;
419
+ }
420
+ // Hook method for debugging via tracing.
421
+ /**
422
+ * @return {?}
423
+ */
424
+ canFocus() {
425
+ /** @type {?} */
426
+ const dimension = this.focusTarget.getBoundingClientRect();
427
+ /** @type {?} */
428
+ const hasSize = dimension.height >= 0 && dimension.height >= 0;
429
+ // tslint:disable-next-line:no-string-literal
430
+ return hasSize && !this.focusTarget['disabled'];
431
+ }
432
+ }
433
+ FocusBindingDirective.decorators = [
434
+ { type: Directive, args: [{
435
+ // tslint:disable-next-line:directive-selector
436
+ selector: '[pectinFocusBinding]'
437
+ },] }
438
+ ];
439
+ /** @nocollapse */
440
+ FocusBindingDirective.ctorParameters = () => [
441
+ { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
442
+ { type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
443
+ { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
444
+ ];
445
+ FocusBindingDirective.propDecorators = {
446
+ pectinFocusBinding: [{ type: Input }],
447
+ focusBindingTarget: [{ type: Input }],
448
+ onFocusIn: [{ type: HostListener, args: ['focusin',] }],
449
+ onFocusOut: [{ type: HostListener, args: ['focusout',] }]
450
+ };
451
+ if (false) {
452
+ /**
453
+ * @type {?}
454
+ * @private
455
+ */
456
+ FocusBindingDirective.prototype.document;
457
+ /** @type {?} */
458
+ FocusBindingDirective.prototype.pectinFocusBinding;
459
+ /** @type {?} */
460
+ FocusBindingDirective.prototype.focusBindingTarget;
461
+ /**
462
+ * @type {?}
463
+ * @private
464
+ */
465
+ FocusBindingDirective.prototype.el;
466
+ /**
467
+ * @type {?}
468
+ * @private
469
+ */
470
+ FocusBindingDirective.prototype.ngZone;
471
+ }
472
+
473
+ /**
474
+ * @fileoverview added by tsickle
475
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
476
+ */
477
+ class StringInputComponent extends AbstractInputComponent {
478
+ constructor() {
479
+ super();
480
+ }
481
+ /**
482
+ * @return {?}
483
+ */
484
+ ngOnInit() {
485
+ }
486
+ }
487
+ StringInputComponent.decorators = [
488
+ { type: Component, args: [{
489
+ selector: 'angular-ui-powerups-string-input',
490
+ 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",
491
+ styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
492
+ }] }
493
+ ];
494
+ /** @nocollapse */
495
+ StringInputComponent.ctorParameters = () => [];
496
+
497
+ /**
498
+ * @fileoverview added by tsickle
499
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
500
+ */
501
+ class PasswordInputComponent extends AbstractInputComponent {
502
+ constructor() {
503
+ super();
504
+ }
505
+ /**
506
+ * @return {?}
507
+ */
508
+ ngOnInit() {
509
+ }
510
+ }
511
+ PasswordInputComponent.decorators = [
512
+ { type: Component, args: [{
513
+ selector: 'angular-ui-powerups-password-input',
514
+ 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",
515
+ styles: [":host{display:block}input,mat-form-field{width:100%}input mat-hint.faux-error,mat-form-field mat-hint.faux-error{color:#f44336}"]
516
+ }] }
517
+ ];
518
+ /** @nocollapse */
519
+ PasswordInputComponent.ctorParameters = () => [];
520
+
521
+ /**
522
+ * @fileoverview added by tsickle
523
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
524
+ */
525
+ /**
526
+ * @template T
527
+ */
528
+ class SelectInputComponent extends AbstractInputComponent {
529
+ constructor() {
530
+ super();
531
+ this.optionLabelFormat = (/**
532
+ * @param {?} option
533
+ * @return {?}
534
+ */
535
+ (option) => (option && this.optionLabel) ? option[this.optionLabel] : option);
536
+ }
537
+ /**
538
+ * @return {?}
539
+ */
540
+ ngOnInit() {
541
+ }
542
+ }
543
+ SelectInputComponent.decorators = [
544
+ { type: Component, args: [{
545
+ selector: 'angular-ui-powerups-select-input',
546
+ 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",
547
+ styles: [":host{display:inline-block}mat-form-field{width:100%}"]
548
+ }] }
549
+ ];
550
+ /** @nocollapse */
551
+ SelectInputComponent.ctorParameters = () => [];
552
+ SelectInputComponent.propDecorators = {
553
+ optionsModel: [{ type: Input }],
554
+ options: [{ type: Input }],
555
+ optionLabel: [{ type: Input }],
556
+ optionLabelFormat: [{ type: Input }]
557
+ };
558
+ __decorate([
559
+ UseDelegate(),
560
+ __metadata("design:type", ListModel)
561
+ ], SelectInputComponent.prototype, "optionsModel", void 0);
562
+ __decorate([
563
+ StoreInListModel('optionsModel'),
564
+ __metadata("design:type", Array)
565
+ ], SelectInputComponent.prototype, "options", void 0);
566
+ if (false) {
567
+ /** @type {?} */
568
+ SelectInputComponent.prototype.optionsModel;
569
+ /** @type {?} */
570
+ SelectInputComponent.prototype.options;
571
+ /** @type {?} */
572
+ SelectInputComponent.prototype.optionLabel;
573
+ /** @type {?} */
574
+ SelectInputComponent.prototype.optionLabelFormat;
575
+ }
576
+
577
+ /**
578
+ * @fileoverview added by tsickle
579
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
580
+ */
581
+ class AngularUiPowerupsModule {
582
+ }
583
+ AngularUiPowerupsModule.decorators = [
584
+ { type: NgModule, args: [{
585
+ declarations: [
586
+ CommandDirective,
587
+ FocusBindingDirective,
588
+ NumberInputComponent,
589
+ StringInputComponent,
590
+ PasswordInputComponent,
591
+ SelectInputComponent,
592
+ ],
593
+ imports: [
594
+ CommonModule,
595
+ BrowserModule,
596
+ BrowserAnimationsModule,
597
+ FormsModule,
598
+ MatInputModule,
599
+ MatFormFieldModule,
600
+ MatSelectModule
601
+ ],
602
+ exports: [
603
+ CommandDirective,
604
+ FocusBindingDirective,
605
+ NumberInputComponent,
606
+ StringInputComponent,
607
+ PasswordInputComponent,
608
+ SelectInputComponent,
609
+ ]
610
+ },] }
611
+ ];
612
+
613
+ /**
614
+ * @fileoverview added by tsickle
615
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
616
+ */
617
+ class Dimension {
618
+ /**
619
+ * @param {?} width
620
+ * @param {?} height
621
+ */
622
+ constructor(width, height) {
623
+ this.width = width;
624
+ this.height = height;
625
+ }
626
+ }
627
+ if (false) {
628
+ /** @type {?} */
629
+ Dimension.prototype.width;
630
+ /** @type {?} */
631
+ Dimension.prototype.height;
632
+ }
633
+
634
+ /**
635
+ * @fileoverview added by tsickle
636
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
637
+ */
638
+ class Point {
639
+ /**
640
+ * @param {?} x
641
+ * @param {?} y
642
+ */
643
+ constructor(x, y) {
644
+ this.x = x;
645
+ this.y = y;
646
+ }
647
+ /**
648
+ * @param {?} data
649
+ * @return {?}
650
+ */
651
+ static from(data) {
652
+ return new Point(data.x, data.y);
653
+ }
654
+ /**
655
+ * @param {?} x
656
+ * @param {?} y
657
+ * @return {?}
658
+ */
659
+ translate(x, y) {
660
+ return new Point(this.x + x, this.y + y);
661
+ }
662
+ }
663
+ if (false) {
664
+ /** @type {?} */
665
+ Point.prototype.x;
666
+ /** @type {?} */
667
+ Point.prototype.y;
668
+ }
669
+
670
+ /**
671
+ * @fileoverview added by tsickle
672
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
673
+ */
674
+ class Bounds extends Dimension {
675
+ /**
676
+ * @param {?} top
677
+ * @param {?} left
678
+ * @param {?} width
679
+ * @param {?} height
680
+ */
681
+ constructor(top, left, width, height) {
682
+ super(width, height);
683
+ this.top = top;
684
+ this.left = left;
685
+ this.width = width;
686
+ this.height = height;
687
+ }
688
+ /**
689
+ * @param {?} point
690
+ * @return {?}
691
+ */
692
+ relativePositionOf(point) {
693
+ if (point instanceof MouseEvent) {
694
+ return new Point(point.clientX - this.left, point.clientY - this.top);
695
+ }
696
+ else {
697
+ return new Point(point.x - this.left, point.y - this.top);
698
+ }
699
+ }
700
+ }
701
+ if (false) {
702
+ /** @type {?} */
703
+ Bounds.prototype.top;
704
+ /** @type {?} */
705
+ Bounds.prototype.left;
706
+ /** @type {?} */
707
+ Bounds.prototype.width;
708
+ /** @type {?} */
709
+ Bounds.prototype.height;
710
+ }
711
+ (function (Bounds) {
712
+ /**
713
+ * @param {?} element
714
+ * @return {?}
715
+ */
716
+ function ofElement(element) {
717
+ /** @type {?} */
718
+ const rect = element.getBoundingClientRect();
719
+ return new Bounds(rect.top, rect.left, rect.width, rect.height);
720
+ }
721
+ Bounds.ofElement = ofElement;
722
+ })(Bounds || (Bounds = {}));
723
+
724
+ /**
725
+ * @fileoverview added by tsickle
726
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
727
+ */
728
+ class ResizeAwareComponent extends DisposableComponent {
729
+ /**
730
+ * @param {?} elementRef
731
+ * @param {?} ngZone
732
+ */
733
+ constructor(elementRef, ngZone) {
734
+ super();
735
+ this.elementRef = elementRef;
736
+ this.ngZone = ngZone;
737
+ this._boundsModel = new ValueHolder(new Bounds(0, 0, 0, 0));
738
+ }
739
+ /**
740
+ * @return {?}
741
+ */
742
+ ngAfterViewInit() {
743
+ this.updateBounds();
744
+ /** @type {?} */
745
+ const element = this.elementRef.nativeElement;
746
+ /** @type {?} */
747
+ const ro = new ResizeObserver((/**
748
+ * @param {?} entries
749
+ * @param {?} observer
750
+ * @return {?}
751
+ */
752
+ (entries, observer) => {
753
+ this.ngZone.run((/**
754
+ * @return {?}
755
+ */
756
+ () => this.updateBounds()));
757
+ }));
758
+ ro.observe(element);
759
+ this.onDispose((/**
760
+ * @return {?}
761
+ */
762
+ () => ro.disconnect()));
763
+ }
764
+ /**
765
+ * @return {?}
766
+ */
767
+ get boundsModel() {
768
+ return this._boundsModel.readonly;
769
+ }
770
+ /**
771
+ * @return {?}
772
+ */
773
+ get nativeElement() {
774
+ return this.elementRef.nativeElement;
775
+ }
776
+ // TODO: Make this handle body scroll
777
+ /**
778
+ * @param {?} point
779
+ * @return {?}
780
+ */
781
+ relativePositionOf(point) {
782
+ return this.bounds.relativePositionOf(point);
783
+ }
784
+ /**
785
+ * @return {?}
786
+ */
787
+ get bounds() {
788
+ return this._boundsModel.value;
789
+ }
790
+ /**
791
+ * @private
792
+ * @return {?}
793
+ */
794
+ updateBounds() {
795
+ this._boundsModel.value = Bounds.ofElement(this.nativeElement);
796
+ }
797
+ }
798
+ if (false) {
799
+ /**
800
+ * @type {?}
801
+ * @private
802
+ */
803
+ ResizeAwareComponent.prototype._boundsModel;
804
+ /**
805
+ * @type {?}
806
+ * @protected
807
+ */
808
+ ResizeAwareComponent.prototype.elementRef;
809
+ /**
810
+ * @type {?}
811
+ * @protected
812
+ */
813
+ ResizeAwareComponent.prototype.ngZone;
814
+ }
815
+
816
+ /**
817
+ * @fileoverview added by tsickle
818
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
819
+ */
820
+
821
+ /**
822
+ * @fileoverview added by tsickle
823
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
824
+ */
825
+
826
+ /**
827
+ * @fileoverview added by tsickle
828
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
829
+ */
830
+ /**
831
+ * @template D, R, E
832
+ */
833
+ class AbstractActivity extends DisposableComponent {
834
+ constructor() {
835
+ super(...arguments);
836
+ this._doneListeners = new EventListenerList();
837
+ this._cancelListeners = new EventListenerList();
838
+ this._finishListeners = new EventListenerList();
839
+ this._busyModel = new DelegatingValueModel().withDefault(false);
840
+ }
841
+ /**
842
+ * @param {?} callback
843
+ * @return {?}
844
+ */
845
+ onDone(callback) {
846
+ this._doneListeners.add(callback);
847
+ }
848
+ /**
849
+ * @param {?} callback
850
+ * @return {?}
851
+ */
852
+ onCancel(callback) {
853
+ this._cancelListeners.add(callback);
854
+ }
855
+ /**
856
+ * @param {?=} result
857
+ * @return {?}
858
+ */
859
+ done(result) {
860
+ return this._doneListeners
861
+ .fireAndWait((/**
862
+ * @param {?} l
863
+ * @return {?}
864
+ */
865
+ l => l(result)))
866
+ .finally((/**
867
+ * @return {?}
868
+ */
869
+ () => this.finalizeAndDispose()));
870
+ }
871
+ /**
872
+ * @param {?=} error
873
+ * @return {?}
874
+ */
875
+ cancel(error) {
876
+ return this._cancelListeners
877
+ .fireAndWait((/**
878
+ * @param {?} l
879
+ * @return {?}
880
+ */
881
+ l => l(error)))
882
+ .finally((/**
883
+ * @return {?}
884
+ */
885
+ () => this.finalizeAndDispose()));
886
+ }
887
+ /**
888
+ * @private
889
+ * @return {?}
890
+ */
891
+ finalizeAndDispose() {
892
+ // this._activeModel.value = false;
893
+ this._finishListeners.fire((/**
894
+ * @param {?} l
895
+ * @return {?}
896
+ */
897
+ l => l()));
898
+ // this._interactionContext = null;
899
+ // this._initialized = false;
900
+ [
901
+ this._finishListeners,
902
+ this._doneListeners,
903
+ this._cancelListeners
904
+ ].forEach((/**
905
+ * @param {?} l
906
+ * @return {?}
907
+ */
908
+ l => l.dispose()));
909
+ }
910
+ /**
911
+ * @return {?}
912
+ */
913
+ get busy() {
914
+ return this._busyModel.readonly;
915
+ }
916
+ /**
917
+ * @param {?} busyModel
918
+ * @return {?}
919
+ */
920
+ busyWhile(busyModel) {
921
+ this._busyModel.setDelegate(busyModel);
922
+ }
923
+ /**
924
+ * @return {?}
925
+ */
926
+ isBusy() {
927
+ return this._busyModel.value;
928
+ }
929
+ }
930
+ if (false) {
931
+ /**
932
+ * @type {?}
933
+ * @private
934
+ */
935
+ AbstractActivity.prototype._doneListeners;
936
+ /**
937
+ * @type {?}
938
+ * @private
939
+ */
940
+ AbstractActivity.prototype._cancelListeners;
941
+ /**
942
+ * @type {?}
943
+ * @private
944
+ */
945
+ AbstractActivity.prototype._finishListeners;
946
+ /**
947
+ * @type {?}
948
+ * @private
949
+ */
950
+ AbstractActivity.prototype._busyModel;
951
+ }
952
+
953
+ /**
954
+ * @fileoverview added by tsickle
955
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
956
+ */
957
+ /** @type {?} */
958
+ const ACTIVITY_DATA = new InjectionToken('InteractionActivityData');
959
+ /**
960
+ * @record
961
+ * @template D, R, E
962
+ */
963
+ function Activity() { }
964
+ if (false) {
965
+ /** @type {?} */
966
+ Activity.prototype.busy;
967
+ /**
968
+ * @param {?} callback
969
+ * @return {?}
970
+ */
971
+ Activity.prototype.onDone = function (callback) { };
972
+ /**
973
+ * @param {?} callback
974
+ * @return {?}
975
+ */
976
+ Activity.prototype.onCancel = function (callback) { };
977
+ }
978
+
979
+ /**
980
+ * @fileoverview added by tsickle
981
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
982
+ */
983
+ /**
984
+ * @record
985
+ */
986
+ function Alert() { }
987
+ if (false) {
988
+ /**
989
+ * @return {?}
990
+ */
991
+ Alert.prototype.title = function () { };
992
+ /**
993
+ * @return {?}
994
+ */
995
+ Alert.prototype.content = function () { };
996
+ /**
997
+ * @return {?}
998
+ */
999
+ Alert.prototype.ok = function () { };
1000
+ }
1001
+
1002
+ /**
1003
+ * @fileoverview added by tsickle
1004
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1005
+ */
1006
+ /**
1007
+ * @record
1008
+ */
1009
+ function Confirm() { }
1010
+ if (false) {
1011
+ /** @type {?|undefined} */
1012
+ Confirm.prototype.destructive;
1013
+ /**
1014
+ * @return {?}
1015
+ */
1016
+ Confirm.prototype.cancel = function () { };
1017
+ }
1018
+
1019
+ /**
1020
+ * @fileoverview added by tsickle
1021
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1022
+ */
1023
+ /** @type {?} */
1024
+ const INTERACTION_CONTEXT = new InjectionToken('InteractionContext');
1025
+ /**
1026
+ * @abstract
1027
+ */
1028
+ class InteractionContext {
1029
+ }
1030
+ if (false) {
1031
+ /**
1032
+ * @abstract
1033
+ * @template D, R, E
1034
+ * @param {?} activityType
1035
+ * @param {?=} data
1036
+ * @return {?}
1037
+ */
1038
+ InteractionContext.prototype.startActivity = function (activityType, data) { };
1039
+ /**
1040
+ * @abstract
1041
+ * @param {?} confirm
1042
+ * @return {?}
1043
+ */
1044
+ InteractionContext.prototype.confirm = function (confirm) { };
1045
+ /**
1046
+ * @abstract
1047
+ * @param {?} alert
1048
+ * @return {?}
1049
+ */
1050
+ InteractionContext.prototype.alert = function (alert) { };
1051
+ }
1052
+
1053
+ /**
1054
+ * @fileoverview added by tsickle
1055
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1056
+ */
1057
+ class AlertDialogComponent extends AbstractActivity {
1058
+ /**
1059
+ * @param {?} alert
1060
+ */
1061
+ constructor(alert) {
1062
+ super();
1063
+ this.alert = alert;
1064
+ }
1065
+ /**
1066
+ * @return {?}
1067
+ */
1068
+ ngOnInit() {
1069
+ }
1070
+ }
1071
+ AlertDialogComponent.decorators = [
1072
+ { type: Component, args: [{
1073
+ selector: 'angular-ui-powerups-alert-dialog',
1074
+ 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()\">{{alert.ok()}}</button>\n</p>\n",
1075
+ styles: [":host{display:block;padding:var(--default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1076
+ }] }
1077
+ ];
1078
+ /** @nocollapse */
1079
+ AlertDialogComponent.ctorParameters = () => [
1080
+ { type: undefined, decorators: [{ type: Inject, args: [ACTIVITY_DATA,] }] }
1081
+ ];
1082
+ if (false) {
1083
+ /** @type {?} */
1084
+ AlertDialogComponent.prototype.alert;
1085
+ }
1086
+
1087
+ /**
1088
+ * @fileoverview added by tsickle
1089
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1090
+ */
1091
+ class ConfirmationDialogComponent extends AbstractActivity {
1092
+ /**
1093
+ * @param {?} confirm
1094
+ */
1095
+ constructor(confirm) {
1096
+ super();
1097
+ this.confirm = confirm;
1098
+ assert.notNil(confirm);
1099
+ console.log(confirm);
1100
+ }
1101
+ /**
1102
+ * @return {?}
1103
+ */
1104
+ ngOnInit() {
1105
+ }
1106
+ /**
1107
+ * @return {?}
1108
+ */
1109
+ isDestructive() {
1110
+ return this.confirm.destructive && this.confirm.destructive();
1111
+ }
1112
+ }
1113
+ ConfirmationDialogComponent.decorators = [
1114
+ { type: Component, args: [{
1115
+ selector: 'angular-ui-powerups-confirmation-dialog',
1116
+ 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()\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\" (click)=\"done(true)\">{{confirm.ok()}}</button>\n</p>\n\n",
1117
+ styles: [":host{display:block;padding:var(--default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1118
+ }] }
1119
+ ];
1120
+ /** @nocollapse */
1121
+ ConfirmationDialogComponent.ctorParameters = () => [
1122
+ { type: undefined, decorators: [{ type: Inject, args: [ACTIVITY_DATA,] }] }
1123
+ ];
1124
+ if (false) {
1125
+ /** @type {?} */
1126
+ ConfirmationDialogComponent.prototype.confirm;
1127
+ }
1128
+
1129
+ /**
1130
+ * @fileoverview added by tsickle
1131
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1132
+ */
1133
+ class ActivityContainerComponent extends DisposableComponent {
1134
+ constructor() {
1135
+ super();
1136
+ this.activityTabs = new MutableListModel();
1137
+ this.obsoleteTabs = [];
1138
+ }
1139
+ /**
1140
+ * @return {?}
1141
+ */
1142
+ ngOnInit() {
1143
+ }
1144
+ /**
1145
+ * @return {?}
1146
+ */
1147
+ ngAfterViewInit() {
1148
+ const { observe } = Dsl.disposeWith(this);
1149
+ observe.valuesFrom(this.tabs.animationDone).subscribe((/**
1150
+ * @return {?}
1151
+ */
1152
+ () => this.cleanUpTabs()));
1153
+ }
1154
+ /**
1155
+ * @template D, R, E
1156
+ * @param {?} options
1157
+ * @return {?}
1158
+ */
1159
+ initialise(options) {
1160
+ this.initialActivity = Object.assign({}, options, { interactionContext: this });
1161
+ }
1162
+ /**
1163
+ * @template D, R, E
1164
+ * @param {?} activityType
1165
+ * @param {?=} data
1166
+ * @return {?}
1167
+ */
1168
+ startActivity(activityType, data) {
1169
+ /** @type {?} */
1170
+ const deferred = Deferred.defer();
1171
+ /** @type {?} */
1172
+ const context = {
1173
+ interactionContext: this,
1174
+ activityClass: activityType,
1175
+ activityData: data,
1176
+ onDone: deferred.resolve,
1177
+ onCancel: deferred.reject
1178
+ };
1179
+ this.activityTabs.push(context);
1180
+ this.tabs.selectedIndex = this.activityTabs.length;
1181
+ return deferred.promise.finally((/**
1182
+ * @return {?}
1183
+ */
1184
+ () => {
1185
+ this.obsoleteTabs.push(context);
1186
+ this.tabs.selectedIndex = this.activityTabs.length - 1;
1187
+ }));
1188
+ }
1189
+ /**
1190
+ * @param {?} alert
1191
+ * @return {?}
1192
+ */
1193
+ alert(alert) {
1194
+ return this.startActivity(AlertDialogComponent, alert);
1195
+ }
1196
+ /**
1197
+ * @param {?} confirm
1198
+ * @return {?}
1199
+ */
1200
+ confirm(confirm) {
1201
+ return this.startActivity(ConfirmationDialogComponent, confirm);
1202
+ }
1203
+ /**
1204
+ * @private
1205
+ * @return {?}
1206
+ */
1207
+ cleanUpTabs() {
1208
+ this.activityTabs.value = this.activityTabs.value.filter((/**
1209
+ * @param {?} tab
1210
+ * @return {?}
1211
+ */
1212
+ tab => {
1213
+ return !this.obsoleteTabs.includes(tab);
1214
+ }));
1215
+ }
1216
+ }
1217
+ ActivityContainerComponent.decorators = [
1218
+ { type: Component, args: [{
1219
+ selector: 'angular-ui-powerups-activity-container',
1220
+ template: "<mat-tab-group #tabs no-tab-header [dynamicHeight]=\"true\">\n <mat-tab>\n <angular-ui-powerups-activity-outlet [interactionContext]=\"this\" [activityContext]=\"initialActivity\"></angular-ui-powerups-activity-outlet>\n </mat-tab>\n <mat-tab *ngFor=\"let tab of activityTabs.value\">\n <angular-ui-powerups-activity-outlet [interactionContext]=\"this\" [activityContext]=\"tab\"></angular-ui-powerups-activity-outlet>\n </mat-tab>\n</mat-tab-group>\n",
1221
+ styles: [":host{display:block}"]
1222
+ }] }
1223
+ ];
1224
+ /** @nocollapse */
1225
+ ActivityContainerComponent.ctorParameters = () => [];
1226
+ ActivityContainerComponent.propDecorators = {
1227
+ parentInteractionContext: [{ type: Input }],
1228
+ initialActivity: [{ type: Input }],
1229
+ tabs: [{ type: ViewChild, args: ['tabs', { static: true },] }]
1230
+ };
1231
+ if (false) {
1232
+ /** @type {?} */
1233
+ ActivityContainerComponent.prototype.parentInteractionContext;
1234
+ /** @type {?} */
1235
+ ActivityContainerComponent.prototype.initialActivity;
1236
+ /** @type {?} */
1237
+ ActivityContainerComponent.prototype.tabs;
1238
+ /** @type {?} */
1239
+ ActivityContainerComponent.prototype.activityTabs;
1240
+ /**
1241
+ * @type {?}
1242
+ * @private
1243
+ */
1244
+ ActivityContainerComponent.prototype.obsoleteTabs;
1245
+ }
1246
+ (function (ActivityContainerComponent) {
1247
+ /**
1248
+ * @record
1249
+ * @template D, R, E
1250
+ */
1251
+ function ActivityContext() { }
1252
+ ActivityContainerComponent.ActivityContext = ActivityContext;
1253
+ if (false) {
1254
+ /** @type {?} */
1255
+ ActivityContext.prototype.activityClass;
1256
+ /** @type {?} */
1257
+ ActivityContext.prototype.activityData;
1258
+ /** @type {?} */
1259
+ ActivityContext.prototype.onDone;
1260
+ /** @type {?} */
1261
+ ActivityContext.prototype.onCancel;
1262
+ }
1263
+ })(ActivityContainerComponent || (ActivityContainerComponent = {}));
1264
+
1265
+ /**
1266
+ * @fileoverview added by tsickle
1267
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1268
+ */
1269
+ /**
1270
+ * @template D, R, E
1271
+ */
1272
+ class ActivityOutletComponent {
1273
+ /**
1274
+ * @param {?} componentFactoryResolver
1275
+ * @param {?} viewContainerRef
1276
+ * @param {?} injector
1277
+ */
1278
+ constructor(componentFactoryResolver, viewContainerRef, injector) {
1279
+ this.componentFactoryResolver = componentFactoryResolver;
1280
+ this.viewContainerRef = viewContainerRef;
1281
+ this.injector = injector;
1282
+ }
1283
+ /**
1284
+ * @param {?} activityContext
1285
+ * @return {?}
1286
+ */
1287
+ set activityContext(activityContext) {
1288
+ this.loadActivity(activityContext);
1289
+ }
1290
+ ;
1291
+ /**
1292
+ * @return {?}
1293
+ */
1294
+ ngOnInit() {
1295
+ }
1296
+ /**
1297
+ * @param {?} activityContext
1298
+ * @return {?}
1299
+ */
1300
+ loadActivity(activityContext) {
1301
+ /** @type {?} */
1302
+ const injector = Injector.create({
1303
+ providers: [
1304
+ {
1305
+ provide: InteractionContext,
1306
+ useValue: this
1307
+ },
1308
+ { provide: ACTIVITY_DATA, useValue: activityContext.activityData }
1309
+ ],
1310
+ parent: this.injector
1311
+ });
1312
+ /** @type {?} */
1313
+ const componentFactory = this.componentFactoryResolver.resolveComponentFactory(activityContext.activityClass);
1314
+ this.viewContainerRef.clear();
1315
+ this.activityComponent = this.viewContainerRef.createComponent(componentFactory, 0, injector);
1316
+ this.activityComponent.instance.onDone(activityContext.onDone);
1317
+ this.activityComponent.instance.onCancel(activityContext.onCancel);
1318
+ }
1319
+ /**
1320
+ * @param {?} alert
1321
+ * @return {?}
1322
+ */
1323
+ alert(alert) {
1324
+ return this.interactionContext.alert(alert);
1325
+ }
1326
+ /**
1327
+ * @param {?} confirm
1328
+ * @return {?}
1329
+ */
1330
+ confirm(confirm) {
1331
+ return this.interactionContext.confirm(confirm);
1332
+ }
1333
+ /**
1334
+ * @template D1, R1, E1
1335
+ * @param {?} activityType
1336
+ * @param {?=} data
1337
+ * @return {?}
1338
+ */
1339
+ startActivity(activityType, data) {
1340
+ return this.interactionContext.startActivity(activityType, data);
1341
+ }
1342
+ }
1343
+ ActivityOutletComponent.decorators = [
1344
+ { type: Component, args: [{
1345
+ selector: 'angular-ui-powerups-activity-outlet',
1346
+ template: '',
1347
+ styles: [":host{display:block}"]
1348
+ }] }
1349
+ ];
1350
+ /** @nocollapse */
1351
+ ActivityOutletComponent.ctorParameters = () => [
1352
+ { type: ComponentFactoryResolver },
1353
+ { type: ViewContainerRef },
1354
+ { type: Injector }
1355
+ ];
1356
+ ActivityOutletComponent.propDecorators = {
1357
+ interactionContext: [{ type: Input }],
1358
+ activityContext: [{ type: Input }]
1359
+ };
1360
+ if (false) {
1361
+ /** @type {?} */
1362
+ ActivityOutletComponent.prototype.interactionContext;
1363
+ /**
1364
+ * @type {?}
1365
+ * @private
1366
+ */
1367
+ ActivityOutletComponent.prototype.activityComponent;
1368
+ /**
1369
+ * @type {?}
1370
+ * @private
1371
+ */
1372
+ ActivityOutletComponent.prototype.componentFactoryResolver;
1373
+ /**
1374
+ * @type {?}
1375
+ * @private
1376
+ */
1377
+ ActivityOutletComponent.prototype.viewContainerRef;
1378
+ /**
1379
+ * @type {?}
1380
+ * @private
1381
+ */
1382
+ ActivityOutletComponent.prototype.injector;
1383
+ /* Skipping unhandled member: ;*/
1384
+ }
1385
+ (function (ActivityOutletComponent) {
1386
+ /**
1387
+ * @template D, R, E
1388
+ */
1389
+ class OutletInteractionContext {
1390
+ /**
1391
+ * @param {?} context
1392
+ */
1393
+ constructor(context) {
1394
+ this.context = context;
1395
+ }
1396
+ /**
1397
+ * @param {?} alert
1398
+ * @return {?}
1399
+ */
1400
+ alert(alert) {
1401
+ return lang.notImplemented();
1402
+ }
1403
+ /**
1404
+ * @param {?} confirm
1405
+ * @return {?}
1406
+ */
1407
+ confirm(confirm) {
1408
+ return lang.notImplemented();
1409
+ }
1410
+ /**
1411
+ * @template D1, R1, E1
1412
+ * @param {?} activityType
1413
+ * @param {?=} data
1414
+ * @return {?}
1415
+ */
1416
+ startActivity(activityType, data) {
1417
+ return lang.notImplemented();
1418
+ }
1419
+ }
1420
+ ActivityOutletComponent.OutletInteractionContext = OutletInteractionContext;
1421
+ if (false) {
1422
+ /**
1423
+ * @type {?}
1424
+ * @private
1425
+ */
1426
+ OutletInteractionContext.prototype.context;
1427
+ }
1428
+ })(ActivityOutletComponent || (ActivityOutletComponent = {}));
1429
+
1430
+ /**
1431
+ * @fileoverview added by tsickle
1432
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1433
+ */
1434
+ class DialogInteractionService extends InteractionContext {
1435
+ /**
1436
+ * @param {?} dialogService
1437
+ */
1438
+ constructor(dialogService) {
1439
+ super();
1440
+ this.dialogService = dialogService;
1441
+ }
1442
+ /**
1443
+ * @template D, R, E
1444
+ * @param {?} activityType
1445
+ * @param {?=} data
1446
+ * @return {?}
1447
+ */
1448
+ startActivity(activityType, data) {
1449
+ return this._startActivity(activityType, data);
1450
+ }
1451
+ /**
1452
+ * @private
1453
+ * @template D, R, E
1454
+ * @param {?} activityType
1455
+ * @param {?} data
1456
+ * @param {?=} disableClose
1457
+ * @return {?}
1458
+ */
1459
+ _startActivity(activityType, data, disableClose = true) {
1460
+ /** @type {?} */
1461
+ const config = {
1462
+ data,
1463
+ disableClose,
1464
+ panelClass: 'dialog-interaction-service',
1465
+ autoFocus: false
1466
+ };
1467
+ /** @type {?} */
1468
+ const matDialogRef = (/** @type {?} */ (this.dialogService.open(ActivityContainerComponent, config)));
1469
+ return new Promise((/**
1470
+ * @param {?} resolve
1471
+ * @param {?} reject
1472
+ * @return {?}
1473
+ */
1474
+ (resolve, reject) => {
1475
+ /** @type {?} */
1476
+ const activityContainer = matDialogRef.componentInstance;
1477
+ activityContainer.parentInteractionContext = this;
1478
+ activityContainer.initialise({
1479
+ activityClass: activityType,
1480
+ activityData: data,
1481
+ /**
1482
+ * @param {?} result
1483
+ * @return {?}
1484
+ */
1485
+ onDone(result) {
1486
+ resolve(result);
1487
+ matDialogRef.close(result);
1488
+ },
1489
+ /**
1490
+ * @param {?} error
1491
+ * @return {?}
1492
+ */
1493
+ onCancel(error) {
1494
+ reject(error);
1495
+ matDialogRef.close(error);
1496
+ }
1497
+ });
1498
+ matDialogRef.updateSize();
1499
+ }));
1500
+ }
1501
+ /**
1502
+ * @param {?} alert
1503
+ * @return {?}
1504
+ */
1505
+ alert(alert) {
1506
+ return this._startActivity(AlertDialogComponent, alert, false);
1507
+ }
1508
+ /**
1509
+ * @param {?} confirm
1510
+ * @return {?}
1511
+ */
1512
+ confirm(confirm) {
1513
+ return this._startActivity(ConfirmationDialogComponent, confirm, true);
1514
+ }
1515
+ }
1516
+ DialogInteractionService.decorators = [
1517
+ { type: Injectable, args: [{
1518
+ providedIn: 'root'
1519
+ },] }
1520
+ ];
1521
+ /** @nocollapse */
1522
+ DialogInteractionService.ctorParameters = () => [
1523
+ { type: MatDialog }
1524
+ ];
1525
+ /** @nocollapse */ DialogInteractionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(ɵɵinject(MatDialog$1)); }, token: DialogInteractionService, providedIn: "root" });
1526
+ if (false) {
1527
+ /**
1528
+ * @type {?}
1529
+ * @private
1530
+ */
1531
+ DialogInteractionService.prototype.dialogService;
1532
+ }
1533
+
1534
+ /**
1535
+ * @fileoverview added by tsickle
1536
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1537
+ */
1538
+ class InteractionModule {
1539
+ }
1540
+ InteractionModule.decorators = [
1541
+ { type: NgModule, args: [{
1542
+ imports: [
1543
+ CommonModule,
1544
+ MatButtonModule,
1545
+ MatDialogModule,
1546
+ MatTabsModule,
1547
+ PortalModule
1548
+ ],
1549
+ declarations: [
1550
+ ActivityContainerComponent,
1551
+ ConfirmationDialogComponent,
1552
+ AlertDialogComponent,
1553
+ ActivityOutletComponent
1554
+ ],
1555
+ entryComponents: [
1556
+ ActivityContainerComponent,
1557
+ ConfirmationDialogComponent,
1558
+ AlertDialogComponent
1559
+ ],
1560
+ providers: [
1561
+ DialogInteractionService
1562
+ ]
1563
+ },] }
1564
+ ];
1565
+
1566
+ /**
1567
+ * @fileoverview added by tsickle
1568
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1569
+ */
1570
+ /**
1571
+ * @record
1572
+ * @template R, E
1573
+ */
1574
+ function Result() { }
1575
+ (function (Result) {
1576
+ /**
1577
+ * @record
1578
+ * @template R, E
1579
+ */
1580
+ function Callback() { }
1581
+ Result.Callback = Callback;
1582
+ if (false) {
1583
+ /** @type {?} */
1584
+ Callback.prototype.then;
1585
+ /** @type {?} */
1586
+ Callback.prototype.catch;
1587
+ }
1588
+ })(Result || (Result = {}));
1589
+
1590
+ /**
1591
+ * @fileoverview added by tsickle
1592
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1593
+ */
1594
+ /**
1595
+ * @record
1596
+ * @template D, R, E
1597
+ */
1598
+ function ActivityOutletContext() { }
1599
+ if (false) {
1600
+ /** @type {?} */
1601
+ ActivityOutletContext.prototype.interactionContext;
1602
+ /** @type {?} */
1603
+ ActivityOutletContext.prototype.activityClass;
1604
+ /** @type {?} */
1605
+ ActivityOutletContext.prototype.activityData;
1606
+ /** @type {?} */
1607
+ ActivityOutletContext.prototype.onDone;
1608
+ /** @type {?} */
1609
+ ActivityOutletContext.prototype.onCancel;
1610
+ }
1611
+
1612
+ /**
1613
+ * @fileoverview added by tsickle
1614
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1615
+ */
1616
+
1617
+ /**
1618
+ * @fileoverview added by tsickle
1619
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1620
+ */
1621
+ /**
1622
+ * @param {?} options
1623
+ * @return {?}
1624
+ */
1625
+ function Place(options) {
1626
+ return (/**
1627
+ * @param {?} target
1628
+ * @return {?}
1629
+ */
1630
+ (target) => {
1631
+ Reflect.defineMetadata('place.options', options, target);
1632
+ });
1633
+ }
1634
+ (function (Place) {
1635
+ /**
1636
+ * @record
1637
+ */
1638
+ function Options() { }
1639
+ Place.Options = Options;
1640
+ if (false) {
1641
+ /** @type {?} */
1642
+ Options.prototype.path;
1643
+ /** @type {?} */
1644
+ Options.prototype.title;
1645
+ /** @type {?|undefined} */
1646
+ Options.prototype.authenticate;
1647
+ }
1648
+ class Descriptor {
1649
+ /**
1650
+ * @param {?} placeClass
1651
+ * @param {?} options
1652
+ */
1653
+ constructor(placeClass, options) {
1654
+ assert.notNil(options);
1655
+ this.path = options.path;
1656
+ this.title = options.title;
1657
+ this.authenticate = isNil(options.authenticate) || options.authenticate;
1658
+ }
1659
+ }
1660
+ Place.Descriptor = Descriptor;
1661
+ if (false) {
1662
+ /** @type {?} */
1663
+ Descriptor.prototype.path;
1664
+ /** @type {?} */
1665
+ Descriptor.prototype.authenticate;
1666
+ /** @type {?} */
1667
+ Descriptor.prototype.title;
1668
+ }
1669
+ /**
1670
+ * @param {?} klass
1671
+ * @return {?}
1672
+ */
1673
+ function getDescriptor(klass) {
1674
+ /** @type {?} */
1675
+ const placeOptions = Reflect.getMetadata('place.options', klass);
1676
+ return new Descriptor(klass, placeOptions);
1677
+ }
1678
+ Place.getDescriptor = getDescriptor;
1679
+ })(Place || (Place = {}));
1680
+
1681
+ /**
1682
+ * @fileoverview added by tsickle
1683
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1684
+ */
1685
+ /**
1686
+ * @record
1687
+ * @template T
1688
+ */
1689
+ function ResolvedParameter() { }
1690
+ if (false) {
1691
+ /** @type {?} */
1692
+ ResolvedParameter.prototype.parameter;
1693
+ /** @type {?} */
1694
+ ResolvedParameter.prototype.resolvedValue;
1695
+ }
1696
+ class ResolvedParameters {
1697
+ /**
1698
+ * @param {?} parameters
1699
+ */
1700
+ constructor(parameters) {
1701
+ this.parameters = parameters;
1702
+ }
1703
+ /**
1704
+ * @template T
1705
+ * @param {?} parameter
1706
+ * @return {?}
1707
+ */
1708
+ get(parameter) {
1709
+ /** @type {?} */
1710
+ const resolved = this.parameters.find((/**
1711
+ * @param {?} p
1712
+ * @return {?}
1713
+ */
1714
+ p => p.parameter === parameter));
1715
+ return resolved ? resolved.resolvedValue : null;
1716
+ }
1717
+ /**
1718
+ * @template T
1719
+ * @param {?} parameter
1720
+ * @param {?} value
1721
+ * @return {?}
1722
+ */
1723
+ replace(parameter, value) {
1724
+ return new ResolvedParameters(this.parameters.filter((/**
1725
+ * @param {?} p
1726
+ * @return {?}
1727
+ */
1728
+ p => p.parameter !== parameter)).concat({
1729
+ parameter,
1730
+ resolvedValue: value
1731
+ }));
1732
+ }
1733
+ /**
1734
+ * @protected
1735
+ * @return {?}
1736
+ */
1737
+ getFormattedRouteId() {
1738
+ /** @type {?} */
1739
+ const routeIdParam = this.getRouteIdParam();
1740
+ return routeIdParam ? routeIdParam.parameter.type.format(routeIdParam.resolvedValue) : null;
1741
+ }
1742
+ /**
1743
+ * @private
1744
+ * @return {?}
1745
+ */
1746
+ getRouteIdParam() {
1747
+ return this.parameters.find((/**
1748
+ * @param {?} p
1749
+ * @return {?}
1750
+ */
1751
+ p => p.parameter.isRouteId));
1752
+ }
1753
+ /**
1754
+ * @protected
1755
+ * @return {?}
1756
+ */
1757
+ getFormattedParameters() {
1758
+ /** @type {?} */
1759
+ const params = {};
1760
+ /** @type {?} */
1761
+ const routeIdParam = this.parameters.filter((/**
1762
+ * @param {?} p
1763
+ * @return {?}
1764
+ */
1765
+ p => !p.parameter.isRouteId)).forEach((/**
1766
+ * @param {?} p
1767
+ * @return {?}
1768
+ */
1769
+ p => {
1770
+ params[p.parameter.name] = p.parameter.type.format(p.resolvedValue);
1771
+ }));
1772
+ return params;
1773
+ }
1774
+ /**
1775
+ * @return {?}
1776
+ */
1777
+ hasRouteId() {
1778
+ return !!this.getRouteIdParam();
1779
+ }
1780
+ /**
1781
+ * @param {?} previous
1782
+ * @param {?} router
1783
+ * @param {?} activatedRoute
1784
+ * @return {?}
1785
+ */
1786
+ redirect(previous, router, activatedRoute) {
1787
+ /** @type {?} */
1788
+ const routeId = this.getFormattedRouteId();
1789
+ /** @type {?} */
1790
+ const relativePath = !!previous.hasRouteId() ? '..' : '.';
1791
+ /** @type {?} */
1792
+ const path = routeId ? [relativePath, routeId, this.getFormattedParameters()] : [relativePath, this.getFormattedParameters()];
1793
+ router.navigate(path, {
1794
+ relativeTo: activatedRoute,
1795
+ });
1796
+ }
1797
+ }
1798
+ __decorate([
1799
+ Trace(),
1800
+ __metadata("design:type", Function),
1801
+ __metadata("design:paramtypes", []),
1802
+ __metadata("design:returntype", void 0)
1803
+ ], ResolvedParameters.prototype, "getFormattedRouteId", null);
1804
+ __decorate([
1805
+ Trace(),
1806
+ __metadata("design:type", Function),
1807
+ __metadata("design:paramtypes", []),
1808
+ __metadata("design:returntype", void 0)
1809
+ ], ResolvedParameters.prototype, "getFormattedParameters", null);
1810
+ __decorate([
1811
+ Trace(),
1812
+ __metadata("design:type", Function),
1813
+ __metadata("design:paramtypes", [ResolvedParameters, Router, ActivatedRoute]),
1814
+ __metadata("design:returntype", void 0)
1815
+ ], ResolvedParameters.prototype, "redirect", null);
1816
+ if (false) {
1817
+ /** @type {?} */
1818
+ ResolvedParameters.prototype.parameters;
1819
+ }
1820
+ class RouteParameterBindings extends GarbageCollector {
1821
+ /**
1822
+ * @param {?} component
1823
+ * @param {?} router
1824
+ * @param {?} activatedRoute
1825
+ */
1826
+ constructor(component, router, activatedRoute) {
1827
+ super();
1828
+ this.component = component;
1829
+ this.router = router;
1830
+ this.activatedRoute = activatedRoute;
1831
+ this._incomingRouteChange = new MutableValueModel(false);
1832
+ this.resolvedParameters = new MutableValueModel();
1833
+ const { chain, valueOf, before, when, after, observe } = Dsl.disposeWith(this);
1834
+ this.txo = new TransactionObserver(); //.onEvent(e => console.log(e.toString()));
1835
+ //.onEvent(e => console.log(e.toString()));
1836
+ /** @type {?} */
1837
+ const routeParameterDefs = Klass.get(component).getMetadataList(RouteParameterBindings.ROUTE_PARAMETER_LIST_KEY);
1838
+ routeParameterDefs.forEach((/**
1839
+ * @param {?} parameter
1840
+ * @return {?}
1841
+ */
1842
+ parameter => this.installBinding(parameter)));
1843
+ /** @type {?} */
1844
+ const incomingResolvedRouteParameters = observe.valuesFrom(activatedRoute.paramMap)
1845
+ .last()
1846
+ .map((/**
1847
+ * @param {?} params
1848
+ * @return {?}
1849
+ */
1850
+ params => {
1851
+ /** @type {?} */
1852
+ const result = [];
1853
+ routeParameterDefs.forEach((/**
1854
+ * @param {?} parameter
1855
+ * @return {?}
1856
+ */
1857
+ parameter => {
1858
+ result.push({ parameter, resolvedValue: parameter.type.parse(params.get(parameter.name)) });
1859
+ }));
1860
+ return new ResolvedParameters(result);
1861
+ }));
1862
+ incomingResolvedRouteParameters.subscribe((/**
1863
+ * @param {?} resolvedParameters
1864
+ * @return {?}
1865
+ */
1866
+ resolvedParameters => {
1867
+ this._incomingRouteChange.value = true;
1868
+ this.resolvedParameters.value = resolvedParameters;
1869
+ this._incomingRouteChange.value = false;
1870
+ }));
1871
+ when.valueOf(this.resolvedParameters).changes((/**
1872
+ * @param {?} params
1873
+ * @param {?} previous
1874
+ * @return {?}
1875
+ */
1876
+ (params, previous) => {
1877
+ params.redirect(previous, router, activatedRoute);
1878
+ }), { unless: this.incomingRouteChange });
1879
+ this.txo.observe('incomingResolvedRouteParameters', incomingResolvedRouteParameters);
1880
+ this.txo.observe('this.routeIsChanging', this.incomingRouteChange);
1881
+ }
1882
+ /**
1883
+ * @return {?}
1884
+ */
1885
+ get incomingRouteChange() {
1886
+ return this._incomingRouteChange.readonly;
1887
+ }
1888
+ /**
1889
+ * @protected
1890
+ * @template T
1891
+ * @param {?} parameter
1892
+ * @return {?}
1893
+ */
1894
+ installBinding(parameter) {
1895
+ /** @type {?} */
1896
+ const model = this.getModelFor(parameter);
1897
+ this.txo.observe(parameter.propertyName, model);
1898
+ this.registerDisposable(new Binding(this.resolvedParameters, model, {
1899
+ /**
1900
+ * @param {?} parameters
1901
+ * @return {?}
1902
+ */
1903
+ toRight(parameters) {
1904
+ return parameters.get(parameter);
1905
+ },
1906
+ /**
1907
+ * @param {?} value
1908
+ * @param {?=} currentParameters
1909
+ * @return {?}
1910
+ */
1911
+ toLeft(value, currentParameters) {
1912
+ return currentParameters.replace(parameter, value);
1913
+ }
1914
+ }));
1915
+ }
1916
+ /**
1917
+ * @private
1918
+ * @template T
1919
+ * @param {?} parameter
1920
+ * @return {?}
1921
+ */
1922
+ getModelFor(parameter) {
1923
+ return this.component[parameter.propertyName];
1924
+ }
1925
+ }
1926
+ if (false) {
1927
+ /** @type {?} */
1928
+ RouteParameterBindings.prototype._incomingRouteChange;
1929
+ /**
1930
+ * @type {?}
1931
+ * @private
1932
+ */
1933
+ RouteParameterBindings.prototype.txo;
1934
+ /**
1935
+ * @type {?}
1936
+ * @private
1937
+ */
1938
+ RouteParameterBindings.prototype.resolvedParameters;
1939
+ /**
1940
+ * @type {?}
1941
+ * @private
1942
+ */
1943
+ RouteParameterBindings.prototype.component;
1944
+ /**
1945
+ * @type {?}
1946
+ * @private
1947
+ */
1948
+ RouteParameterBindings.prototype.router;
1949
+ /**
1950
+ * @type {?}
1951
+ * @private
1952
+ */
1953
+ RouteParameterBindings.prototype.activatedRoute;
1954
+ }
1955
+ (function (RouteParameterBindings) {
1956
+ RouteParameterBindings.ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');
1957
+ })(RouteParameterBindings || (RouteParameterBindings = {}));
1958
+
1959
+ /**
1960
+ * @fileoverview added by tsickle
1961
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1962
+ */
1963
+ class AbstractPlaceComponent extends DisposableComponent {
1964
+ /**
1965
+ * @param {?} activatedRoute
1966
+ * @param {?} router
1967
+ */
1968
+ constructor(activatedRoute, router) {
1969
+ super();
1970
+ this.activatedRoute = activatedRoute;
1971
+ this.routeBindingMediator = this.registerDisposable(new RouteParameterBindings(this, router, activatedRoute));
1972
+ // See https://coolon.atlassian.net/browse/PEC-59
1973
+ ((/** @type {?} */ ((/** @type {?} */ (this.titleModel))))).setDefault(this.placeConfig.title);
1974
+ }
1975
+ /**
1976
+ * @return {?}
1977
+ */
1978
+ get placeConfig() {
1979
+ return Place.getDescriptor((/** @type {?} */ ((/** @type {?} */ (this.constructor)))));
1980
+ }
1981
+ /**
1982
+ * @return {?}
1983
+ */
1984
+ canDeactivate() {
1985
+ return true;
1986
+ }
1987
+ }
1988
+ __decorate([
1989
+ UseDelegate(),
1990
+ __metadata("design:type", MutableValueModel)
1991
+ ], AbstractPlaceComponent.prototype, "titleModel", void 0);
1992
+ __decorate([
1993
+ Memoize(),
1994
+ __metadata("design:type", Place.Descriptor),
1995
+ __metadata("design:paramtypes", [])
1996
+ ], AbstractPlaceComponent.prototype, "placeConfig", null);
1997
+ if (false) {
1998
+ /** @type {?} */
1999
+ AbstractPlaceComponent.prototype.titleModel;
2000
+ /**
2001
+ * @type {?}
2002
+ * @private
2003
+ */
2004
+ AbstractPlaceComponent.prototype.routeBindingMediator;
2005
+ /**
2006
+ * @type {?}
2007
+ * @protected
2008
+ */
2009
+ AbstractPlaceComponent.prototype.activatedRoute;
2010
+ }
2011
+
2012
+ /**
2013
+ * @fileoverview added by tsickle
2014
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2015
+ */
2016
+ /**
2017
+ * @record
2018
+ */
2019
+ function PlaceComponent() { }
2020
+ if (false) {
2021
+ /** @type {?} */
2022
+ PlaceComponent.prototype.titleModel;
2023
+ /**
2024
+ * @return {?}
2025
+ */
2026
+ PlaceComponent.prototype.canDeactivate = function () { };
2027
+ }
2028
+
2029
+ /**
2030
+ * @fileoverview added by tsickle
2031
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2032
+ */
2033
+ class BusyOverlayComponent {
2034
+ constructor() {
2035
+ }
2036
+ /**
2037
+ * @return {?}
2038
+ */
2039
+ ngOnInit() {
2040
+ }
2041
+ }
2042
+ BusyOverlayComponent.decorators = [
2043
+ { type: Component, args: [{
2044
+ selector: 'aup-busy-overlay',
2045
+ 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",
2046
+ 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}"]
2047
+ }] }
2048
+ ];
2049
+ /** @nocollapse */
2050
+ BusyOverlayComponent.ctorParameters = () => [];
2051
+ BusyOverlayComponent.propDecorators = {
2052
+ busyModel: [{ type: Input }],
2053
+ busy: [{ type: Input }]
2054
+ };
2055
+ __decorate([
2056
+ UseDelegatingValueModel(),
2057
+ __metadata("design:type", ValueModel)
2058
+ ], BusyOverlayComponent.prototype, "busyModel", void 0);
2059
+ __decorate([
2060
+ StoreInValueModel('busyModel'),
2061
+ __metadata("design:type", Boolean)
2062
+ ], BusyOverlayComponent.prototype, "busy", void 0);
2063
+ if (false) {
2064
+ /** @type {?} */
2065
+ BusyOverlayComponent.prototype.busyModel;
2066
+ /** @type {?} */
2067
+ BusyOverlayComponent.prototype.busy;
2068
+ }
2069
+
2070
+ /**
2071
+ * @fileoverview added by tsickle
2072
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2073
+ */
2074
+ class EmptyStateComponent {
2075
+ constructor() {
2076
+ }
2077
+ /**
2078
+ * @return {?}
2079
+ */
2080
+ ngOnInit() {
2081
+ }
2082
+ }
2083
+ EmptyStateComponent.decorators = [
2084
+ { type: Component, args: [{
2085
+ selector: 'angular-ui-powerups-empty-state',
2086
+ template: `
2087
+ <div class="container">
2088
+ <ng-content></ng-content>
2089
+ </div>
2090
+ `,
2091
+ styles: [":host{display:flex;flex-direction:column;justify-content:center;align-items:center}.container{padding:var(--default-padding);border:2px dashed rgba(0,0,0,.2);border-radius:5px;font-size:14px;font-weight:300}"]
2092
+ }] }
2093
+ ];
2094
+ /** @nocollapse */
2095
+ EmptyStateComponent.ctorParameters = () => [];
2096
+
2097
+ /**
2098
+ * @fileoverview added by tsickle
2099
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2100
+ */
2101
+ class PlaceService {
2102
+ constructor() {
2103
+ this._activePlaces = new MutableListModel();
2104
+ }
2105
+ /**
2106
+ * @return {?}
2107
+ */
2108
+ get activePlaces() {
2109
+ return this._activePlaces.readonly;
2110
+ }
2111
+ /**
2112
+ * @param {?} place
2113
+ * @return {?}
2114
+ */
2115
+ onActivate(place) {
2116
+ this._activePlaces.push(place);
2117
+ }
2118
+ /**
2119
+ * @param {?} place
2120
+ * @return {?}
2121
+ */
2122
+ onDeactivate(place) {
2123
+ this._activePlaces.remove(place);
2124
+ }
2125
+ }
2126
+ PlaceService.decorators = [
2127
+ { type: Injectable, args: [{
2128
+ providedIn: 'root'
2129
+ },] }
2130
+ ];
2131
+ /** @nocollapse */
2132
+ PlaceService.ctorParameters = () => [];
2133
+ /** @nocollapse */ PlaceService.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceService_Factory() { return new PlaceService(); }, token: PlaceService, providedIn: "root" });
2134
+ __decorate([
2135
+ Trace(),
2136
+ __metadata("design:type", Function),
2137
+ __metadata("design:paramtypes", [Object]),
2138
+ __metadata("design:returntype", void 0)
2139
+ ], PlaceService.prototype, "onActivate", null);
2140
+ __decorate([
2141
+ Trace(),
2142
+ __metadata("design:type", Function),
2143
+ __metadata("design:paramtypes", [Object]),
2144
+ __metadata("design:returntype", void 0)
2145
+ ], PlaceService.prototype, "onDeactivate", null);
2146
+ if (false) {
2147
+ /**
2148
+ * @type {?}
2149
+ * @private
2150
+ */
2151
+ PlaceService.prototype._activePlaces;
2152
+ }
2153
+
2154
+ /**
2155
+ * @fileoverview added by tsickle
2156
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2157
+ */
2158
+ class PlaceOutletComponent {
2159
+ /**
2160
+ * @param {?} placeService
2161
+ */
2162
+ constructor(placeService) {
2163
+ this.placeService = placeService;
2164
+ }
2165
+ /**
2166
+ * @return {?}
2167
+ */
2168
+ ngOnInit() {
2169
+ }
2170
+ /**
2171
+ * @param {?} $event
2172
+ * @return {?}
2173
+ */
2174
+ onActivate($event) {
2175
+ this.placeService.onActivate($event);
2176
+ }
2177
+ /**
2178
+ * @param {?} $event
2179
+ * @return {?}
2180
+ */
2181
+ onDeactivate($event) {
2182
+ this.placeService.onDeactivate($event);
2183
+ }
2184
+ }
2185
+ PlaceOutletComponent.decorators = [
2186
+ { type: Component, args: [{
2187
+ selector: 'angular-ui-powerups-place-outlet',
2188
+ template: "<router-outlet (activate)=\"onActivate($event)\" (deactivate)=\"onDeactivate($event)\"></router-outlet>\n",
2189
+ styles: [":host{grid-area:main;display:-ms-grid;display:grid;-ms-grid-rows:0 1fr;grid-template-rows:0 1fr;min-height:0}"]
2190
+ }] }
2191
+ ];
2192
+ /** @nocollapse */
2193
+ PlaceOutletComponent.ctorParameters = () => [
2194
+ { type: PlaceService }
2195
+ ];
2196
+ if (false) {
2197
+ /**
2198
+ * @type {?}
2199
+ * @private
2200
+ */
2201
+ PlaceOutletComponent.prototype.placeService;
2202
+ }
2203
+
2204
+ /**
2205
+ * @fileoverview added by tsickle
2206
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2207
+ */
2208
+ class PlaceModule {
2209
+ }
2210
+ PlaceModule.decorators = [
2211
+ { type: NgModule, args: [{
2212
+ imports: [
2213
+ CommonModule,
2214
+ MatProgressSpinnerModule,
2215
+ RouterModule
2216
+ ],
2217
+ declarations: [
2218
+ EmptyStateComponent,
2219
+ BusyOverlayComponent,
2220
+ PlaceOutletComponent
2221
+ ],
2222
+ entryComponents: [BusyOverlayComponent],
2223
+ exports: [
2224
+ BusyOverlayComponent,
2225
+ PlaceOutletComponent,
2226
+ EmptyStateComponent
2227
+ ],
2228
+ providers: [
2229
+ PlaceService
2230
+ ]
2231
+ },] }
2232
+ ];
2233
+
2234
+ /**
2235
+ * @fileoverview added by tsickle
2236
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2237
+ */
2238
+ class LeavePlaceGuard {
2239
+ /**
2240
+ * @param {?} router
2241
+ * @param {?} injector
2242
+ */
2243
+ constructor(router, injector) {
2244
+ this.router = router;
2245
+ this.injector = injector;
2246
+ }
2247
+ /**
2248
+ * @param {?} component
2249
+ * @param {?} currentRoute
2250
+ * @param {?} currentState
2251
+ * @param {?=} nextState
2252
+ * @return {?}
2253
+ */
2254
+ canDeactivate(component, currentRoute, currentState, nextState) {
2255
+ return component.canDeactivate();
2256
+ }
2257
+ }
2258
+ LeavePlaceGuard.decorators = [
2259
+ { type: Injectable, args: [{
2260
+ providedIn: 'root'
2261
+ },] }
2262
+ ];
2263
+ /** @nocollapse */
2264
+ LeavePlaceGuard.ctorParameters = () => [
2265
+ { type: Router },
2266
+ { type: Injector }
2267
+ ];
2268
+ /** @nocollapse */ LeavePlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(ɵɵinject(Router), ɵɵinject(INJECTOR)); }, token: LeavePlaceGuard, providedIn: "root" });
2269
+ if (false) {
2270
+ /**
2271
+ * @type {?}
2272
+ * @private
2273
+ */
2274
+ LeavePlaceGuard.prototype.router;
2275
+ /**
2276
+ * @type {?}
2277
+ * @private
2278
+ */
2279
+ LeavePlaceGuard.prototype.injector;
2280
+ }
2281
+
2282
+ /**
2283
+ * @fileoverview added by tsickle
2284
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2285
+ */
2286
+ class RouteParameterSanitiser {
2287
+ /**
2288
+ * @param {?} parameterDefs
2289
+ * @param {?} injector
2290
+ */
2291
+ constructor(parameterDefs, injector) {
2292
+ this.parameterDefs = parameterDefs;
2293
+ this.injector = injector;
2294
+ this.sanitisedParameters = [];
2295
+ this.routeParameter = parameterDefs.find((/**
2296
+ * @param {?} p
2297
+ * @return {?}
2298
+ */
2299
+ p => p.isRouteId));
2300
+ this.queryParameters = parameterDefs.filter((/**
2301
+ * @param {?} p
2302
+ * @return {?}
2303
+ */
2304
+ p => !p.isRouteId));
2305
+ }
2306
+ /**
2307
+ * @param {?} snapshot
2308
+ * @return {?}
2309
+ */
2310
+ sanitise(snapshot) {
2311
+ return __awaiter(this, void 0, void 0, function* () {
2312
+ if (this.routeParameter) {
2313
+ /** @type {?} */
2314
+ const routeOk = yield this.sanitiseParameter(this.routeParameter, snapshot.paramMap.get(this.routeParameter.name));
2315
+ if (!routeOk) {
2316
+ // if the route id isn't ok we redirect immediately as the query params may need to be sanitised in the
2317
+ // context of the route id.
2318
+ return false;
2319
+ }
2320
+ }
2321
+ for (const param of this.queryParameters) {
2322
+ yield this.sanitiseParameter(param, snapshot.queryParamMap.get(param.name));
2323
+ }
2324
+ return this.sanitisedParameters.length === 0;
2325
+ });
2326
+ }
2327
+ /**
2328
+ * @template T
2329
+ * @param {?} def
2330
+ * @param {?} formattedInitialValue
2331
+ * @return {?}
2332
+ */
2333
+ sanitiseParameter(def, formattedInitialValue) {
2334
+ return __awaiter(this, void 0, void 0, function* () {
2335
+ if (def) {
2336
+ /** @type {?} */
2337
+ const sanitiser = this.getSanitiser(def);
2338
+ if (sanitiser) {
2339
+ /** @type {?} */
2340
+ const initialValue = def.type.parse(formattedInitialValue);
2341
+ /** @type {?} */
2342
+ const sanitisedValue = yield sanitiser.sanitise(initialValue);
2343
+ if (initialValue !== sanitisedValue) {
2344
+ this.sanitisedParameters.push({ def, value: def.type.format(sanitisedValue) });
2345
+ return false;
2346
+ }
2347
+ }
2348
+ }
2349
+ return true;
2350
+ });
2351
+ }
2352
+ /**
2353
+ * @param {?} router
2354
+ * @return {?}
2355
+ */
2356
+ redirect(router) {
2357
+ assert.isTruthy(this.sanitisedParameters.length !== 0);
2358
+ /** @type {?} */
2359
+ const sanitisedRouteId = this.sanitisedParameters.find((/**
2360
+ * @param {?} s
2361
+ * @return {?}
2362
+ */
2363
+ s => s.def === this.routeParameter));
2364
+ if (sanitisedRouteId) {
2365
+ return router.navigate(['..', sanitisedRouteId.value]);
2366
+ }
2367
+ else {
2368
+ /** @type {?} */
2369
+ const queryParams = this.sanitisedParameters.filter((/**
2370
+ * @param {?} s
2371
+ * @return {?}
2372
+ */
2373
+ s => s.def !== this.routeParameter))
2374
+ .reduce((/**
2375
+ * @param {?} params
2376
+ * @param {?} item
2377
+ * @return {?}
2378
+ */
2379
+ (params, item) => (Object.assign({}, params, { [item.def.name]: item.value }))), {});
2380
+ return router.navigate(['.', queryParams]);
2381
+ }
2382
+ }
2383
+ /**
2384
+ * @private
2385
+ * @template T
2386
+ * @param {?} def
2387
+ * @return {?}
2388
+ */
2389
+ getSanitiser(def) {
2390
+ return def.sanitiser ? this.injector.get(def.sanitiser, new def.sanitiser()) : null;
2391
+ }
2392
+ }
2393
+ __decorate([
2394
+ Trace(),
2395
+ __metadata("design:type", Function),
2396
+ __metadata("design:paramtypes", [Object, String]),
2397
+ __metadata("design:returntype", Promise)
2398
+ ], RouteParameterSanitiser.prototype, "sanitiseParameter", null);
2399
+ __decorate([
2400
+ Memoize$1(),
2401
+ __metadata("design:type", Function),
2402
+ __metadata("design:paramtypes", [Object]),
2403
+ __metadata("design:returntype", Object)
2404
+ ], RouteParameterSanitiser.prototype, "getSanitiser", null);
2405
+ if (false) {
2406
+ /**
2407
+ * @type {?}
2408
+ * @private
2409
+ */
2410
+ RouteParameterSanitiser.prototype.routeParameter;
2411
+ /**
2412
+ * @type {?}
2413
+ * @private
2414
+ */
2415
+ RouteParameterSanitiser.prototype.queryParameters;
2416
+ /**
2417
+ * @type {?}
2418
+ * @private
2419
+ */
2420
+ RouteParameterSanitiser.prototype.sanitisedParameters;
2421
+ /** @type {?} */
2422
+ RouteParameterSanitiser.prototype.parameterDefs;
2423
+ /** @type {?} */
2424
+ RouteParameterSanitiser.prototype.injector;
2425
+ }
2426
+
2427
+ /**
2428
+ * @fileoverview added by tsickle
2429
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2430
+ */
2431
+ class PlaceRouteGuard {
2432
+ /**
2433
+ * @param {?} router
2434
+ * @param {?} injector
2435
+ */
2436
+ constructor(router, injector) {
2437
+ this.router = router;
2438
+ this.injector = injector;
2439
+ }
2440
+ /**
2441
+ * @param {?} route
2442
+ * @param {?} state
2443
+ * @return {?}
2444
+ */
2445
+ canActivate(route, state) {
2446
+ /** @type {?} */
2447
+ const routeParameters = Klass.get(route.component).getMetadataList(RouteParameterBindings.ROUTE_PARAMETER_LIST_KEY);
2448
+ /** @type {?} */
2449
+ const sanitiser = new RouteParameterSanitiser(routeParameters, this.injector);
2450
+ return sanitiser.sanitise(route).then((/**
2451
+ * @param {?} proceed
2452
+ * @return {?}
2453
+ */
2454
+ proceed => {
2455
+ if (!proceed) {
2456
+ sanitiser.redirect(this.router);
2457
+ }
2458
+ return proceed;
2459
+ }));
2460
+ }
2461
+ }
2462
+ PlaceRouteGuard.decorators = [
2463
+ { type: Injectable, args: [{
2464
+ providedIn: 'root'
2465
+ },] }
2466
+ ];
2467
+ /** @nocollapse */
2468
+ PlaceRouteGuard.ctorParameters = () => [
2469
+ { type: Router },
2470
+ { type: Injector }
2471
+ ];
2472
+ /** @nocollapse */ PlaceRouteGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouteGuard_Factory() { return new PlaceRouteGuard(ɵɵinject(Router), ɵɵinject(INJECTOR)); }, token: PlaceRouteGuard, providedIn: "root" });
2473
+ __decorate([
2474
+ Trace(),
2475
+ __metadata("design:type", Function),
2476
+ __metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot]),
2477
+ __metadata("design:returntype", Object)
2478
+ ], PlaceRouteGuard.prototype, "canActivate", null);
2479
+ if (false) {
2480
+ /**
2481
+ * @type {?}
2482
+ * @private
2483
+ */
2484
+ PlaceRouteGuard.prototype.router;
2485
+ /**
2486
+ * @type {?}
2487
+ * @private
2488
+ */
2489
+ PlaceRouteGuard.prototype.injector;
2490
+ }
2491
+
2492
+ /**
2493
+ * @fileoverview added by tsickle
2494
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2495
+ */
2496
+ /**
2497
+ * @record
2498
+ */
2499
+ function JsonArray() { }
2500
+ /**
2501
+ * @record
2502
+ */
2503
+ function JsonMap() { }
2504
+
2505
+ /**
2506
+ * @fileoverview added by tsickle
2507
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2508
+ */
2509
+ /**
2510
+ * @record
2511
+ * @template T
2512
+ */
2513
+ function ParameterOptions() { }
2514
+ if (false) {
2515
+ /** @type {?|undefined} */
2516
+ ParameterOptions.prototype.as;
2517
+ /** @type {?|undefined} */
2518
+ ParameterOptions.prototype.sanitiser;
2519
+ }
2520
+ /**
2521
+ * @template T
2522
+ * @param {?} type
2523
+ * @param {?=} options
2524
+ * @return {?}
2525
+ */
2526
+ function RouteId(type, options) {
2527
+ // assert.isTruthy(type.isValid());
2528
+ return (/**
2529
+ * @param {?} prototype
2530
+ * @param {?} propertyKey
2531
+ * @return {?}
2532
+ */
2533
+ (prototype, propertyKey) => {
2534
+ /** @type {?} */
2535
+ const param = createDefinition(propertyKey, type, options, true);
2536
+ Klass.get(prototype).addToOwnMetadataList(RouteParameterBindings.ROUTE_PARAMETER_LIST_KEY, param);
2537
+ UseDelegate()(prototype, propertyKey);
2538
+ });
2539
+ }
2540
+ /**
2541
+ * @template T
2542
+ * @param {?} type
2543
+ * @param {?=} options
2544
+ * @return {?}
2545
+ */
2546
+ function QueryParameter(type, options) {
2547
+ // assert.isTruthy(type.isValid());
2548
+ return (/**
2549
+ * @param {?} prototype
2550
+ * @param {?} propertyKey
2551
+ * @return {?}
2552
+ */
2553
+ (prototype, propertyKey) => {
2554
+ /** @type {?} */
2555
+ const param = createDefinition(propertyKey, type, options, false);
2556
+ Klass.get(prototype).addToOwnMetadataList(RouteParameterBindings.ROUTE_PARAMETER_LIST_KEY, param);
2557
+ UseDelegate()(prototype, propertyKey);
2558
+ });
2559
+ }
2560
+ /**
2561
+ * @template T
2562
+ * @param {?} propertyName
2563
+ * @param {?} type
2564
+ * @param {?} options
2565
+ * @param {?} routeId
2566
+ * @return {?}
2567
+ */
2568
+ function createDefinition(propertyName, type, options, routeId) {
2569
+ /** @type {?} */
2570
+ const opts = Opts.get(options);
2571
+ /** @type {?} */
2572
+ const propertyNameAsString = assert.notNil(propertyName).toString();
2573
+ /** @type {?} */
2574
+ const def = {
2575
+ name: opts.getOptional('as', propertyNameAsString),
2576
+ propertyName: propertyNameAsString,
2577
+ type: assert.notNil(type),
2578
+ sanitiser: opts.getOptional('sanitiser', null),
2579
+ isRouteId: routeId
2580
+ };
2581
+ return def;
2582
+ }
2583
+
2584
+ /**
2585
+ * @fileoverview added by tsickle
2586
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2587
+ */
2588
+ /**
2589
+ * @record
2590
+ * @template T
2591
+ */
2592
+ function ParameterDefinition() { }
2593
+ if (false) {
2594
+ /** @type {?} */
2595
+ ParameterDefinition.prototype.name;
2596
+ /** @type {?} */
2597
+ ParameterDefinition.prototype.propertyName;
2598
+ /** @type {?} */
2599
+ ParameterDefinition.prototype.type;
2600
+ /** @type {?} */
2601
+ ParameterDefinition.prototype.sanitiser;
2602
+ /** @type {?} */
2603
+ ParameterDefinition.prototype.isRouteId;
2604
+ }
2605
+
2606
+ /**
2607
+ * @fileoverview added by tsickle
2608
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2609
+ */
2610
+ /**
2611
+ * @record
2612
+ * @template T
2613
+ */
2614
+ function ParameterSanitiser() { }
2615
+ if (false) {
2616
+ /**
2617
+ * @param {?} value
2618
+ * @return {?}
2619
+ */
2620
+ ParameterSanitiser.prototype.sanitise = function (value) { };
2621
+ }
2622
+
2623
+ /**
2624
+ * @fileoverview added by tsickle
2625
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2626
+ */
2627
+ // WARNING: interface has both a type and a value, skipping emit
2628
+ var ParameterType;
2629
+ (function (ParameterType) {
2630
+ class StringType {
2631
+ /**
2632
+ * @param {?} value
2633
+ * @return {?}
2634
+ */
2635
+ format(value) {
2636
+ return value;
2637
+ }
2638
+ /**
2639
+ * @param {?} value
2640
+ * @return {?}
2641
+ */
2642
+ parse(value) {
2643
+ return value;
2644
+ }
2645
+ }
2646
+ class NumberType {
2647
+ /**
2648
+ * @param {?} value
2649
+ * @return {?}
2650
+ */
2651
+ format(value) {
2652
+ return `${value}`;
2653
+ }
2654
+ /**
2655
+ * @param {?} value
2656
+ * @return {?}
2657
+ */
2658
+ parse(value) {
2659
+ return +value;
2660
+ }
2661
+ }
2662
+ ParameterType.STRING = new StringType();
2663
+ ParameterType.NUMBER = new NumberType();
2664
+ })(ParameterType || (ParameterType = {}));
2665
+
2666
+ /**
2667
+ * @fileoverview added by tsickle
2668
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2669
+ */
2670
+
2671
+ /**
2672
+ * @fileoverview added by tsickle
2673
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2674
+ */
2675
+
2676
+ /**
2677
+ * @fileoverview added by tsickle
2678
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2679
+ */
2680
+
2681
+ /**
2682
+ * @fileoverview added by tsickle
2683
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2684
+ */
2685
+
2686
+ export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceComponent, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ConfirmationDialogComponent, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective, INTERACTION_CONTEXT, InteractionContext, InteractionModule, LeavePlaceGuard, NumberInputComponent, ParameterType, PasswordInputComponent, Place, PlaceModule, PlaceOutletComponent, PlaceRouteGuard, PlaceService, Point, QueryParameter, ResizeAwareComponent, RouteId, RouteParameterBindings, RouteParameterSanitiser, SelectInputComponent, StringInputComponent, CommandDirective as ɵa, FocusBindingDirective as ɵb, DisposableComponent as ɵc, NumberInputComponent as ɵd, AbstractInputComponent as ɵe, StringInputComponent as ɵf, PasswordInputComponent as ɵg, SelectInputComponent as ɵh };
2687
+ //# sourceMappingURL=coolon-angular-ui-powerups.js.map