@coolon/angular-ui-powerups 0.0.9 → 0.0.11

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.
@@ -5,9 +5,10 @@ import { MatDialog, MatButtonModule, MatDialogModule, MatTabsModule, MatProgress
5
5
  import { BrowserModule } from '@angular/platform-browser';
6
6
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
7
  import { __decorate, __metadata, __awaiter } from 'tslib';
8
- import { GarbageCollector, MutableListModel, Constant, UseDelegate, MutableValueModel, assert, UnaryCommand, lang, Dsl, Logger, ListModel, StoreInListModel, EventListenerList, DelegatingValueModel, UseDelegatingValueModel, ValueModel, StoreInValueModel, Trace, OptionsHelper, ValueHolder, TransactionObserver, Binding } from '@coolon/pectin';
8
+ import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, assert, UnaryCommand, lang, Dsl, Logger, ListModel, StoreInListModel, EventListenerList, DelegatingValueModel, MutableListModel, StoreInValueModel, Trace, OptionsHelper, ValueHolder, MutableValueModel, TransactionObserver, Binding } from '@coolon/pectin';
9
9
  import { PortalModule } from '@angular/cdk/portal';
10
10
  import { Deferred } from '@coolon/pectin/lib/promise/deferred.class';
11
+ import { assert as assert$1, Klass, Opts } from '@coolon/typescript-utilities';
11
12
  import { MatDialog as MatDialog$1 } from '@angular/material/dialog';
12
13
  import { MatListModule } from '@angular/material/list';
13
14
  import { MatTabsModule as MatTabsModule$1 } from '@angular/material/tabs';
@@ -18,7 +19,6 @@ import ResizeObserver from 'resize-observer-polyfill';
18
19
  import { Memoize } from '@typescript-plus/fast-memoize-decorator';
19
20
  import { isNil } from 'lodash';
20
21
  import 'reflect-metadata';
21
- import { Klass, Opts } from '@coolon/typescript-utilities';
22
22
  import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator/dist/src';
23
23
 
24
24
  /**
@@ -38,8 +38,6 @@ class DisposableComponent extends GarbageCollector {
38
38
  * @fileoverview added by tsickle
39
39
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
40
40
  */
41
- /** @type {?} */
42
- const EMPTY_ERRORS = new MutableListModel().readonly;
43
41
  /**
44
42
  * @abstract
45
43
  * @template T
@@ -47,6 +45,7 @@ const EMPTY_ERRORS = new MutableListModel().readonly;
47
45
  class AbstractInputComponent extends DisposableComponent {
48
46
  constructor() {
49
47
  super();
48
+ this.valueModel = new DelegatingFormValueModel();
50
49
  // TODO: fix this.
51
50
  // tslint:disable-next-line:no-output-native
52
51
  this.focus = new EventEmitter();
@@ -69,6 +68,13 @@ class AbstractInputComponent extends DisposableComponent {
69
68
  }
70
69
  };
71
70
  }
71
+ /**
72
+ * @param {?} model
73
+ * @return {?}
74
+ */
75
+ set userValueModel(model) {
76
+ this.valueModel.setDelegate(model);
77
+ }
72
78
  /**
73
79
  * @return {?}
74
80
  */
@@ -117,7 +123,6 @@ class AbstractInputComponent extends DisposableComponent {
117
123
  * @return {?}
118
124
  */
119
125
  ngOnInit() {
120
- // this._focused = this.valueModel['focused'] || new ValueHolder();
121
126
  }
122
127
  /**
123
128
  * @return {?}
@@ -129,8 +134,7 @@ class AbstractInputComponent extends DisposableComponent {
129
134
  * @return {?}
130
135
  */
131
136
  get enabled() {
132
- // @ts-ignore
133
- return ((/** @type {?} */ (this.valueModel))).enabled || Constant.TRUE;
137
+ return this.valueModel.enabled;
134
138
  }
135
139
  /**
136
140
  * @return {?}
@@ -142,7 +146,7 @@ class AbstractInputComponent extends DisposableComponent {
142
146
  * @return {?}
143
147
  */
144
148
  get errorList() {
145
- return ((/** @type {?} */ (this.valueModel))).errorList || EMPTY_ERRORS;
149
+ return this.valueModel.errorList;
146
150
  }
147
151
  /**
148
152
  * @return {?}
@@ -152,7 +156,7 @@ class AbstractInputComponent extends DisposableComponent {
152
156
  }
153
157
  }
154
158
  AbstractInputComponent.propDecorators = {
155
- valueModel: [{ type: Input }],
159
+ userValueModel: [{ type: Input, args: ['valueModel',] }],
156
160
  label: [{ type: Input }],
157
161
  floatLabel: [{ type: Input }],
158
162
  hint: [{ type: Input }],
@@ -172,8 +176,9 @@ AbstractInputComponent.propDecorators = {
172
176
  };
173
177
  __decorate([
174
178
  UseDelegate(),
175
- __metadata("design:type", MutableValueModel)
176
- ], AbstractInputComponent.prototype, "valueModel", void 0);
179
+ __metadata("design:type", ValueModel),
180
+ __metadata("design:paramtypes", [ValueModel])
181
+ ], AbstractInputComponent.prototype, "userValueModel", null);
177
182
  if (false) {
178
183
  /** @type {?} */
179
184
  AbstractInputComponent.prototype.valueModel;
@@ -386,7 +391,7 @@ class FocusBindingDirective extends DisposableComponent {
386
391
  */
387
392
  onFocusIn() {
388
393
  if (this.hasBinding()) {
389
- this.pectinFocusBinding.focusCallbacks.notifyFocusIn();
394
+ this.pectinFocusBinding.focusContext.notifyFocusIn();
390
395
  }
391
396
  }
392
397
  /**
@@ -394,7 +399,7 @@ class FocusBindingDirective extends DisposableComponent {
394
399
  */
395
400
  onFocusOut() {
396
401
  if (this.hasBinding()) {
397
- this.pectinFocusBinding.focusCallbacks.notifyFocusOut();
402
+ this.pectinFocusBinding.focusContext.notifyFocusOut();
398
403
  }
399
404
  }
400
405
  /**
@@ -409,7 +414,7 @@ class FocusBindingDirective extends DisposableComponent {
409
414
  // TODO: Make this also track the current enabled/disabled state.
410
415
  if (this.hasBinding()) {
411
416
  const { chain } = Dsl.disposeWith(this);
412
- chain.value(this.pectinFocusBinding.focused).subscribe((/**
417
+ chain.value(this.pectinFocusBinding.focusContext.focused).subscribe((/**
413
418
  * @param {?} focused
414
419
  * @return {?}
415
420
  */
@@ -428,7 +433,7 @@ class FocusBindingDirective extends DisposableComponent {
428
433
  * @return {?}
429
434
  */
430
435
  hasBinding() {
431
- return this.pectinFocusBinding && this.pectinFocusBinding.focused;
436
+ return !!this.pectinFocusBinding && !!this.pectinFocusBinding.focusContext;
432
437
  }
433
438
  // Hook method for debugging via tracing.
434
439
  /**
@@ -484,7 +489,7 @@ class FocusBindingDirective extends DisposableComponent {
484
489
  * @return {?}
485
490
  */
486
491
  modelShouldStillHaveFocus() {
487
- return this.hasBinding() && this.pectinFocusBinding.focused.value;
492
+ return this.hasBinding() && this.pectinFocusBinding.focusContext.focused.value;
488
493
  }
489
494
  // Hook method for debugging via tracing.
490
495
  /**
@@ -1218,6 +1223,7 @@ class DialogInteractionService extends InteractionContext {
1218
1223
  constructor(dialogService) {
1219
1224
  super();
1220
1225
  this.dialogService = dialogService;
1226
+ assert$1.notNil(dialogService);
1221
1227
  }
1222
1228
  /**
1223
1229
  * @template D, R, E
@@ -1358,7 +1364,7 @@ class BusyOverlayComponent {
1358
1364
  }
1359
1365
  BusyOverlayComponent.decorators = [
1360
1366
  { type: Component, args: [{
1361
- selector: 'aup-busy-overlay',
1367
+ selector: 'angular-ui-powerups-busy-overlay',
1362
1368
  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",
1363
1369
  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}"]
1364
1370
  }] }
@@ -1370,7 +1376,7 @@ BusyOverlayComponent.propDecorators = {
1370
1376
  busy: [{ type: Input }]
1371
1377
  };
1372
1378
  __decorate([
1373
- UseDelegatingValueModel(),
1379
+ UseDelegate(),
1374
1380
  __metadata("design:type", ValueModel)
1375
1381
  ], BusyOverlayComponent.prototype, "busyModel", void 0);
1376
1382
  __decorate([
@@ -1641,6 +1647,7 @@ const defaultHiddenStyleDef = style({
1641
1647
  * @return {?}
1642
1648
  */
1643
1649
  function slideDownAndUpAnimation(triggerName, options) {
1650
+ // SEE to fix this: https://github.com/angular/angular/issues/15587#issuecomment-351510501
1644
1651
  /** @type {?} */
1645
1652
  const duration = OptionsHelper.get(options).getOptional('duration', '100ms');
1646
1653
  /** @type {?} */
@@ -2840,7 +2847,17 @@ function RouteId(type, options) {
2840
2847
  * @return {?}
2841
2848
  */
2842
2849
  function QueryParameter(type, options) {
2843
- return RouteParameter(type, options);
2850
+ return (/**
2851
+ * @param {?} prototype
2852
+ * @param {?} propertyKey
2853
+ * @return {?}
2854
+ */
2855
+ (prototype, propertyKey) => {
2856
+ /** @type {?} */
2857
+ const param = createDefinition(propertyKey, type, options, false);
2858
+ Klass.get(prototype).addToOwnMetadataList(RouteParameterBindings.ROUTE_PARAMETER_LIST_KEY, param);
2859
+ UseDelegate()(prototype, propertyKey);
2860
+ });
2844
2861
  }
2845
2862
  /**
2846
2863
  * @template T
@@ -2870,7 +2887,18 @@ function RouteParameter(type, options) {
2870
2887
  * @return {?}
2871
2888
  */
2872
2889
  function QueryParameterList(elementType, options) {
2873
- return RouteParameterList(elementType, options);
2890
+ // assert.isTruthy(type.isValid());
2891
+ return (/**
2892
+ * @param {?} prototype
2893
+ * @param {?} propertyKey
2894
+ * @return {?}
2895
+ */
2896
+ (prototype, propertyKey) => {
2897
+ /** @type {?} */
2898
+ const param = createArrayDefinition(propertyKey, elementType, options);
2899
+ Klass.get(prototype).addToOwnMetadataList(RouteParameterBindings.ROUTE_PARAMETER_LIST_KEY, param);
2900
+ UseDelegate()(prototype, propertyKey);
2901
+ });
2874
2902
  }
2875
2903
  /**
2876
2904
  * @template E