@coolon/angular-ui-powerups 14.0.2 → 14.1.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.
@@ -39,7 +39,7 @@ import { MatTableModule } from '@angular/material/table';
39
39
  import * as i4 from '@angular/material/tooltip';
40
40
  import { MatTooltipModule } from '@angular/material/tooltip';
41
41
  import * as i1$3 from '@coolon/pectin';
42
- import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, TrackExternal, ValueModel, StoreInValueModel, Command, MutableListModel, StoreInListModel, Disposable, DelegatingListModel, MutableValueModel, FocusManager, EventListenerList, Form, Guard, Binding, DebugContext, ListModel, Functions, MultipleSelectionModel, AbstractComputedListModel, DelegatingSelectionModel, DelegateProxyHandler, DirtyTrackingForm, PagedListModel, PageController, ComputedListModel, Deferred } from '@coolon/pectin';
42
+ import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, TrackExternal, ValueModel, StoreInValueModel, Command, MutableListModel, StoreInListModel, Disposable, DelegatingListModel, MutableValueModel, FocusManager, EventListenerList, Form, Guard, Binding, DebugContext, ListModel, Functions, MultipleSelectionModel, AbstractComputedListModel, DelegatingSelectionModel, DelegateProxyHandler, DirtyTrackingForm, PagedListModel, PageController, ComputedListModel, Deferred, Trace } from '@coolon/pectin';
43
43
  import { __decorate, __param, __metadata } from 'tslib';
44
44
  import * as i1 from '@angular/platform-browser';
45
45
  import escapeStringRegexp from 'escape-string-regexp';
@@ -1893,14 +1893,21 @@ class AutocompleteInputComponent extends AbstractValueInputComponent {
1893
1893
  return this.optionLabelFormat(option);
1894
1894
  }
1895
1895
  updateFilter($event) {
1896
+ this.rawTextContent$.value = $event;
1896
1897
  this.filterValue.value = $event;
1897
1898
  }
1898
1899
  onSelect($event) {
1899
- this.valueModel.value = $event.option.value;
1900
+ this.rawTextContent$.value = undefined;
1901
+ // @ts-ignore
1902
+ this.valueModel["value"] = $event.option.value;
1900
1903
  }
1901
1904
  }
1902
1905
  AutocompleteInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: AutocompleteInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1903
- AutocompleteInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: AutocompleteInputComponent, selector: "aup-autocomplete-input", inputs: { optionsModel: "optionsModel", options: "options", optionLabel: "optionLabel", allowNil: "allowNil", optionLabelFormat: "optionLabelFormat" }, queries: [{ propertyName: "nilOptionTemplateRef", first: true, predicate: ["nilOptionTemplate"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input type=\"string\"\n matInput\n [matAutocomplete]=\"autocomplete\"\n placeholder=\"{{placeholder}}\"\n [ngModel]=\"componentValueModel.value\"\n (ngModelChange)=\"updateFilter($event)\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-autocomplete #autocomplete [displayWith]=\"optionLabelFormat\" [autoActiveFirstOption]=\"true\" (optionSelected)=\"onSelect($event)\">\n <mat-option *ngFor=\"let option of filteredOptions.value; let i = index\"\n [value]=\"option\"\n >{{formatOption(option)}}</mat-option>\n <mat-option *ngIf=\"allowNil\">{{placeholder}}</mat-option>\n </mat-autocomplete>\n\n <mat-hint *ngIf=\"showHint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n<div class=\"width-strut\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <div>{{placeholder}}</div>\n <div class=\"item\" *ngFor=\"let item of options\">{{optionLabelFormat(item)}}</div>\n</div>\n", styles: [":host{display:inline-block}mat-form-field{width:100%}.width-strut{display:block;height:0;max-height:0;width:auto;visibility:hidden;overflow:hidden;padding-right:35px}.width-strut mat-label{font-size:75%}.width-strut>.item{font-size:16px;padding-left:0}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i3$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: FocusBindingDirective, selector: "[pectinFocusBinding]", inputs: ["pectinFocusBinding", "focusBindingTarget"] }, { kind: "component", type: i7.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i7.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }] });
1906
+ AutocompleteInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: AutocompleteInputComponent, selector: "aup-autocomplete-input", inputs: { rawTextContent$: "rawTextContent$", optionsModel: "optionsModel", options: "options", optionLabel: "optionLabel", allowNil: "allowNil", optionLabelFormat: "optionLabelFormat" }, queries: [{ propertyName: "nilOptionTemplateRef", first: true, predicate: ["nilOptionTemplate"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input type=\"string\"\n matInput\n [matAutocomplete]=\"autocomplete\"\n placeholder=\"{{placeholder}}\"\n [ngModel]=\"componentValueModel.value\"\n (ngModelChange)=\"updateFilter($event)\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-autocomplete #autocomplete [displayWith]=\"optionLabelFormat\" [autoActiveFirstOption]=\"true\" (optionSelected)=\"onSelect($event)\">\n <mat-option *ngFor=\"let option of filteredOptions.value; let i = index\"\n [value]=\"option\"\n >{{formatOption(option)}}</mat-option>\n <mat-option *ngIf=\"allowNil\">{{placeholder}}</mat-option>\n </mat-autocomplete>\n\n <mat-hint *ngIf=\"showHint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n<div class=\"width-strut\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <div>{{placeholder}}</div>\n <div class=\"item\" *ngFor=\"let item of options\">{{optionLabelFormat(item)}}</div>\n</div>\n", styles: [":host{display:inline-block}mat-form-field{width:100%}.width-strut{display:block;height:0;max-height:0;width:auto;visibility:hidden;overflow:hidden;padding-right:35px}.width-strut mat-label{font-size:75%}.width-strut>.item{font-size:16px;padding-left:0}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i3$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: FocusBindingDirective, selector: "[pectinFocusBinding]", inputs: ["pectinFocusBinding", "focusBindingTarget"] }, { kind: "component", type: i7.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i7.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }] });
1907
+ __decorate([
1908
+ TrackExternal(),
1909
+ __metadata("design:type", MutableValueModel)
1910
+ ], AutocompleteInputComponent.prototype, "rawTextContent$", void 0);
1904
1911
  __decorate([
1905
1912
  TrackExternal(),
1906
1913
  __metadata("design:type", ListModel)
@@ -1912,7 +1919,9 @@ __decorate([
1912
1919
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: AutocompleteInputComponent, decorators: [{
1913
1920
  type: Component,
1914
1921
  args: [{ selector: 'aup-autocomplete-input', template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input type=\"string\"\n matInput\n [matAutocomplete]=\"autocomplete\"\n placeholder=\"{{placeholder}}\"\n [ngModel]=\"componentValueModel.value\"\n (ngModelChange)=\"updateFilter($event)\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-autocomplete #autocomplete [displayWith]=\"optionLabelFormat\" [autoActiveFirstOption]=\"true\" (optionSelected)=\"onSelect($event)\">\n <mat-option *ngFor=\"let option of filteredOptions.value; let i = index\"\n [value]=\"option\"\n >{{formatOption(option)}}</mat-option>\n <mat-option *ngIf=\"allowNil\">{{placeholder}}</mat-option>\n </mat-autocomplete>\n\n <mat-hint *ngIf=\"showHint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n<div class=\"width-strut\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <div>{{placeholder}}</div>\n <div class=\"item\" *ngFor=\"let item of options\">{{optionLabelFormat(item)}}</div>\n</div>\n", styles: [":host{display:inline-block}mat-form-field{width:100%}.width-strut{display:block;height:0;max-height:0;width:auto;visibility:hidden;overflow:hidden;padding-right:35px}.width-strut mat-label{font-size:75%}.width-strut>.item{font-size:16px;padding-left:0}\n"] }]
1915
- }], ctorParameters: function () { return []; }, propDecorators: { optionsModel: [{
1922
+ }], ctorParameters: function () { return []; }, propDecorators: { rawTextContent$: [{
1923
+ type: Input
1924
+ }], optionsModel: [{
1916
1925
  type: Input
1917
1926
  }], options: [{
1918
1927
  type: Input
@@ -7383,14 +7392,6 @@ class ActivityContainerComponent extends AbstractInteractionContext {
7383
7392
  this.busy = this.registerDisposable(new DelegatingValueModel().withDefault(false));
7384
7393
  this.registerDisposable(this.busy);
7385
7394
  }
7386
- ngOnInit() {
7387
- }
7388
- ngAfterViewInit() {
7389
- const { chain, observe } = Dsl.disposeWith(this);
7390
- // using the component directly rather than (animationDone)=.. allows us
7391
- // to keep our callback private.
7392
- observe.valuesFrom(this.tabs.animationDone).subscribe(() => this.onAnimationFinished());
7393
- }
7394
7395
  initialise(identifier, api) {
7395
7396
  assert.isFalsey(this.isInitialised());
7396
7397
  assert.notNil(identifier);
@@ -7486,7 +7487,6 @@ class ActivityContainerComponent extends AbstractInteractionContext {
7486
7487
  this._deferredCleanUp :
7487
7488
  true;
7488
7489
  }
7489
- // @Trace()
7490
7490
  finishAndStartCleanup() {
7491
7491
  if (!this._deferredCleanUp) {
7492
7492
  // Important:
@@ -7494,7 +7494,9 @@ class ActivityContainerComponent extends AbstractInteractionContext {
7494
7494
  // Without this our animation done wasn't called when a single
7495
7495
  // new activity followed a single tab activity (since we're tracking
7496
7496
  // by activity index)
7497
- this.activityRefs = [];
7497
+ setTimeout(() => {
7498
+ this.activityRefs = []; // we have to do it after the animation timeout or the activity disappears before the animatin finsihes
7499
+ }, this.getTabAnimationDuration());
7498
7500
  const promise = this.interactionServiceApi.notifyFinished(this);
7499
7501
  this._deferredCleanUp = promise
7500
7502
  .finally(() => {
@@ -7512,13 +7514,6 @@ class ActivityContainerComponent extends AbstractInteractionContext {
7512
7514
  return index;
7513
7515
  }
7514
7516
  ;
7515
- // @Trace()
7516
- onAnimationFinished() {
7517
- if (this.onAnimationFinishedJob) {
7518
- this.onAnimationFinishedJob();
7519
- this.onAnimationFinishedJob = undefined;
7520
- }
7521
- }
7522
7517
  /**
7523
7518
  * Synchronises the selected tab index.
7524
7519
  */
@@ -7532,18 +7527,30 @@ class ActivityContainerComponent extends AbstractInteractionContext {
7532
7527
  this.activityRefs[newIndex].setFocused(false);
7533
7528
  this.busy.setDelegate(this.activityRefs[newIndex].activityBusy);
7534
7529
  this.tabs.selectedIndex = newIndex;
7535
- this.onAnimationFinishedJob = () => {
7530
+ // Note: We're not using the animation done event as it's firing almost immeadiately.
7531
+ setTimeout(() => {
7536
7532
  this.activityRefs = this.activityRefs.filter(tab => !tab.isComplete());
7537
7533
  this.inAnimation.value = false;
7538
7534
  this.activityRefs.forEach((ref, index) => {
7539
7535
  ref.setFocused(index === newIndex);
7540
7536
  });
7541
- };
7537
+ }, this.getTabAnimationDuration());
7542
7538
  }
7543
7539
  }
7544
7540
  getSelectedOutlet() {
7545
7541
  return this.activityOutlets.toArray()[this.tabs.selectedIndex];
7546
7542
  }
7543
+ getTabAnimationDuration() {
7544
+ const match = this.tabs.animationDuration.match(/(\d+)(.*)/);
7545
+ const numericValue = parseFloat(match[1]);
7546
+ switch (match[2].trim()) {
7547
+ case "ms":
7548
+ return numericValue;
7549
+ case "s":
7550
+ return 1000 * numericValue;
7551
+ }
7552
+ return lang$1.illegalState(`unsupported duration string: ${this.tabs.animationDuration}`);
7553
+ }
7547
7554
  // @Trace()
7548
7555
  getSelectedTabIndex() {
7549
7556
  return this.tabs.selectedIndex;
@@ -7563,6 +7570,12 @@ class ActivityContainerComponent extends AbstractInteractionContext {
7563
7570
  }
7564
7571
  ActivityContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ActivityContainerComponent, deps: [{ token: PlaceRouter }], target: i0.ɵɵFactoryTarget.Component });
7565
7572
  ActivityContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: ActivityContainerComponent, selector: "aup-activity-container", inputs: { dynamicHeight: "dynamicHeight" }, viewQueries: [{ propertyName: "tabs", first: true, predicate: ["tabs"], descendants: true, static: true }, { propertyName: "activityOutlets", predicate: ActivityOutletComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<mat-tab-group #tabs no-tab-header\n [dynamicHeight]=\"dynamicHeight\"\n [class.full-height-tabs]=\"!dynamicHeight\">\n <mat-tab *ngFor=\"let activityRef of activityRefs; let i = index; trackBy: activityIndex\">\n <aup-busy-overlay [busyModel]=\"busy\" cdkTrapFocus cdkTrapFocusAutoCapture>\n <!--\n We have issues where angular is triggering a leave animation when an\n new activity is started, but is not running the enter animation\n when it is scrolled back into view. So we track the tab changes and\n disable all animations inside the tab while we're animating.\n -->\n <div class=\"activity-outlet-wrapper\" [@.disabled]=\"!activityRef.focused\">\n <aup-activity-outlet [nestedInteractionContext]=\"this\" [activityRef]=\"activityRef\"></aup-activity-outlet>\n </div>\n </aup-busy-overlay>\n </mat-tab>\n</mat-tab-group>\n", styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}aup-busy-overlay{flex:1}.activity-outlet-wrapper{flex:1}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i2$6.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple"], exportAs: ["matTabGroup"] }, { kind: "component", type: i2$6.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { kind: "component", type: BusyOverlayComponent, selector: "aup-busy-overlay", inputs: ["busyModel", "busy"] }, { kind: "directive", type: i5$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: ActivityOutletComponent, selector: "aup-activity-outlet", inputs: ["nestedInteractionContext", "activityRef"] }] });
7573
+ __decorate([
7574
+ Trace(),
7575
+ __metadata("design:type", Function),
7576
+ __metadata("design:paramtypes", []),
7577
+ __metadata("design:returntype", void 0)
7578
+ ], ActivityContainerComponent.prototype, "finishAndStartCleanup", null);
7566
7579
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ActivityContainerComponent, decorators: [{
7567
7580
  type: Component,
7568
7581
  args: [{ selector: "aup-activity-container", template: "<mat-tab-group #tabs no-tab-header\n [dynamicHeight]=\"dynamicHeight\"\n [class.full-height-tabs]=\"!dynamicHeight\">\n <mat-tab *ngFor=\"let activityRef of activityRefs; let i = index; trackBy: activityIndex\">\n <aup-busy-overlay [busyModel]=\"busy\" cdkTrapFocus cdkTrapFocusAutoCapture>\n <!--\n We have issues where angular is triggering a leave animation when an\n new activity is started, but is not running the enter animation\n when it is scrolled back into view. So we track the tab changes and\n disable all animations inside the tab while we're animating.\n -->\n <div class=\"activity-outlet-wrapper\" [@.disabled]=\"!activityRef.focused\">\n <aup-activity-outlet [nestedInteractionContext]=\"this\" [activityRef]=\"activityRef\"></aup-activity-outlet>\n </div>\n </aup-busy-overlay>\n </mat-tab>\n</mat-tab-group>\n", styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}aup-busy-overlay{flex:1}.activity-outlet-wrapper{flex:1}\n"] }]
@@ -7574,7 +7587,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
7574
7587
  }], activityOutlets: [{
7575
7588
  type: ViewChildren,
7576
7589
  args: [ActivityOutletComponent]
7577
- }] } });
7590
+ }], finishAndStartCleanup: [] } });
7578
7591
 
7579
7592
  class AbstractActivityTriggerComponent extends DisposableComponent {
7580
7593
  constructor() {