@coolon/angular-ui-powerups 3.3.1 → 3.3.3
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.
- package/CHANGELOG.md +15 -0
- package/bundles/coolon-angular-ui-powerups.umd.js +42 -24
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
- package/esm2015/lib/components/switch-case/switch-case.component.js +1 -1
- package/esm2015/lib/components/switch-case/switch-case.component.js.map +1 -1
- package/esm2015/lib/components/table/table-model.js +1 -1
- package/esm2015/lib/components/table/table-model.js.map +1 -1
- package/esm2015/lib/components/table/table-row-menu/table-row-menu.component.js +2 -2
- package/esm2015/lib/components/table/table-row-menu/table-row-menu.component.js.map +1 -1
- package/esm2015/lib/components/table/table-row-menu/table-row-menu.component.metadata.json +1 -1
- package/esm2015/lib/directives/command.directive.js +36 -17
- package/esm2015/lib/directives/command.directive.js.map +1 -1
- package/esm2015/lib/directives/command.directive.metadata.json +1 -1
- package/esm2015/lib/directives/focus-binding.js +1 -1
- package/esm2015/lib/directives/focus-binding.js.map +1 -1
- package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js +1 -1
- package/esm2015/lib/interaction/components/popup-interaction-context/popup-interaction-context.component.js.map +1 -1
- package/esm2015/lib/place/components/abstract-place-navigation.component.js +1 -1
- package/esm2015/lib/place/components/abstract-place-navigation.component.js.map +1 -1
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +1 -1
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
- package/esm2015/lib/place/place-component.js +1 -1
- package/esm2015/lib/place/place-component.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +45 -28
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/directives/command.directive.d.ts +5 -1
- package/package.json +1 -1
- package/schematics/bootstrap-app/index.js +4 -0
- package/schematics/bootstrap-app/index.js.map +1 -1
- package/schematics/ng-add/index.js +3 -2
- package/schematics/ng-add/index.js.map +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DOCUMENT, CommonModule, Location } from '@angular/common';
|
|
2
|
-
import { Directive, ElementRef, Inject, Input, HostListener, NgZone, ɵɵdefineInjectable, ɵɵinject, Injectable, NgModule, Component, ContentChild, EventEmitter,
|
|
2
|
+
import { Directive, ElementRef, Inject, Host, Optional, Input, HostListener, NgZone, ɵɵdefineInjectable, ɵɵinject, Injectable, NgModule, Component, ContentChild, EventEmitter, SkipSelf, ViewChild, Output, ViewChildren, HostBinding, ViewEncapsulation, Self, TemplateRef, ChangeDetectorRef, ContentChildren, ViewContainerRef, InjectionToken, Injector, ComponentFactoryResolver } from '@angular/core';
|
|
3
3
|
import { FormsModule } from '@angular/forms';
|
|
4
4
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
5
5
|
import { MatInputModule } from '@angular/material/input';
|
|
@@ -9,11 +9,11 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
|
9
9
|
import { ComponentPortal, TemplatePortal, PortalModule } from '@angular/cdk/portal';
|
|
10
10
|
import { CdkScrollableModule } from '@angular/cdk/scrolling';
|
|
11
11
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
12
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
12
|
+
import { MatButton, MatButtonModule } from '@angular/material/button';
|
|
13
13
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
14
14
|
import { MatDividerModule } from '@angular/material/divider';
|
|
15
15
|
import { MatIconModule } from '@angular/material/icon';
|
|
16
|
-
import { MatMenuTrigger, MatMenuModule } from '@angular/material/menu';
|
|
16
|
+
import { MatMenuItem, MatMenuTrigger, MatMenuModule } from '@angular/material/menu';
|
|
17
17
|
import { MatTableModule } from '@angular/material/table';
|
|
18
18
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
19
19
|
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
|
|
@@ -38,11 +38,14 @@ import { style, query, group, animate, trigger, transition } from '@angular/anim
|
|
|
38
38
|
import { Observable } from 'rxjs';
|
|
39
39
|
|
|
40
40
|
class CommandDirective extends GarbageCollector {
|
|
41
|
-
constructor(elementRef) {
|
|
41
|
+
constructor(elementRef, matButton, matMenuItem) {
|
|
42
42
|
super();
|
|
43
43
|
this.elementRef = elementRef;
|
|
44
44
|
this._commandEnabled = new DelegatingValueModel().withDefault(false);
|
|
45
45
|
this._commandParameterProvided = false;
|
|
46
|
+
// Material buttons and menu items don't respond to the disabled binding so we
|
|
47
|
+
// need to inject them from our host element and handle them manually.
|
|
48
|
+
this.matControl = matButton || matMenuItem;
|
|
46
49
|
}
|
|
47
50
|
set pectinCommand(command) {
|
|
48
51
|
this._command = command;
|
|
@@ -72,23 +75,35 @@ class CommandDirective extends GarbageCollector {
|
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
ngAfterViewInit() {
|
|
75
|
-
// for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now
|
|
76
|
-
// we need to do this.
|
|
77
78
|
const { when } = Dsl.disposeWith(this);
|
|
78
|
-
when
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
when(this._commandEnabled).changes(enabled => this.updateEnabledState(enabled), {
|
|
80
|
+
initialValue: 'triggerChange'
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
updateEnabledState(enabled) {
|
|
84
|
+
// for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now
|
|
85
|
+
// we need to do this. The set timeout is required to prevent the button getting a expression changed
|
|
86
|
+
// when it's clicked.
|
|
87
|
+
if (this.matControl) {
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
this.matControl.disabled = !enabled;
|
|
90
|
+
}, 0);
|
|
91
|
+
}
|
|
92
|
+
if (!enabled) {
|
|
93
|
+
// Note:
|
|
94
|
+
// We can't use a host binding here for disabled as the directive can be used on arbitrary
|
|
95
|
+
// components (e.g. divs) and the compiler will barf if we use the host binding.
|
|
96
|
+
this.elementRef.nativeElement.setAttribute('disabled', 'disabled');
|
|
97
|
+
if (this.elementRef.nativeElement.tagName === 'A') {
|
|
98
|
+
this.elementRef.nativeElement.removeAttribute('href');
|
|
84
99
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
this.elementRef.nativeElement.removeAttribute('disabled');
|
|
103
|
+
if (this.elementRef.nativeElement.tagName === 'A') {
|
|
104
|
+
this.elementRef.nativeElement.setAttribute('href', 'javascript:void');
|
|
90
105
|
}
|
|
91
|
-
}
|
|
106
|
+
}
|
|
92
107
|
}
|
|
93
108
|
ngOnDestroy() {
|
|
94
109
|
this.dispose();
|
|
@@ -116,7 +131,9 @@ CommandDirective.decorators = [
|
|
|
116
131
|
},] }
|
|
117
132
|
];
|
|
118
133
|
CommandDirective.ctorParameters = () => [
|
|
119
|
-
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
|
|
134
|
+
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
|
|
135
|
+
{ type: MatButton, decorators: [{ type: Host }, { type: Optional }] },
|
|
136
|
+
{ type: MatMenuItem, decorators: [{ type: Host }, { type: Optional }] }
|
|
120
137
|
];
|
|
121
138
|
CommandDirective.propDecorators = {
|
|
122
139
|
pectinCommand: [{ type: Input }],
|
|
@@ -144,7 +161,7 @@ class FocusBinding extends GarbageCollector {
|
|
|
144
161
|
this.document = document;
|
|
145
162
|
// TODO: Make this also track the current enabled/disabled state.
|
|
146
163
|
const { when } = Dsl.disposeWith(this);
|
|
147
|
-
when
|
|
164
|
+
when(this.focusContext.focused).changes((focused) => {
|
|
148
165
|
if (focused && !this.alreadyHasFocus()) {
|
|
149
166
|
this.tryAndFocus();
|
|
150
167
|
}
|
|
@@ -1834,7 +1851,7 @@ class SwitchCaseComponent extends DisposableComponent {
|
|
|
1834
1851
|
const subscription = this.switchCaseOptions.changes.subscribe(change => this.updateSelection());
|
|
1835
1852
|
this.onDispose(() => subscription.unsubscribe());
|
|
1836
1853
|
const { chain, when } = Dsl.disposeWith(this);
|
|
1837
|
-
when
|
|
1854
|
+
when(this.switchModel).changes(() => this.updateSelection(), { initialValue: 'triggerChange' });
|
|
1838
1855
|
this.cdr.detectChanges();
|
|
1839
1856
|
}
|
|
1840
1857
|
updateSelection() {
|
|
@@ -2608,7 +2625,7 @@ let TableModel = TableModel_1 = class TableModel {
|
|
|
2608
2625
|
else {
|
|
2609
2626
|
const editSession = new EditSession(rowId, row, this._createForm(row), this.saveCommand);
|
|
2610
2627
|
const { when } = Dsl.disposeWith(editSession);
|
|
2611
|
-
when
|
|
2628
|
+
when(editSession.liveRowValue).changes((editedValue) => {
|
|
2612
2629
|
this._rowsBeingEdited.replaceOrPush(editedValue);
|
|
2613
2630
|
}, { initialValue: 'triggerChangeUnlessNil' });
|
|
2614
2631
|
this._editorSessions.push(editSession);
|
|
@@ -2891,12 +2908,12 @@ TableRowMenuComponent.decorators = [
|
|
|
2891
2908
|
template: `
|
|
2892
2909
|
<aup-tool-bar>
|
|
2893
2910
|
<aup-command *ngFor="let action of actions" [command]="action.factory.create(value)"
|
|
2894
|
-
[face]="action.
|
|
2911
|
+
[face]="action.face"></aup-command>
|
|
2895
2912
|
</aup-tool-bar>
|
|
2896
2913
|
<ng-container *ngIf="moreActions.length > 0">
|
|
2897
2914
|
<aup-more-menu>
|
|
2898
2915
|
<aup-command *ngFor="let action of moreActions" [command]="action.factory.create(value)"
|
|
2899
|
-
[face]="action.
|
|
2916
|
+
[face]="action.face"></aup-command>
|
|
2900
2917
|
</aup-more-menu>
|
|
2901
2918
|
</ng-container>
|
|
2902
2919
|
`,
|
|
@@ -3924,7 +3941,7 @@ class PopupInteractionContextComponent extends DisposableComponent {
|
|
|
3924
3941
|
const componentRef = overlayRef.attach(this.outputPortal);
|
|
3925
3942
|
this.interactionContext = componentRef.instance;
|
|
3926
3943
|
return new Promise((resolve, reject) => {
|
|
3927
|
-
// HACK: afterViewInit won't have been called yet. Need to add when
|
|
3944
|
+
// HACK: afterViewInit won't have been called yet. Need to add when(interactionContext.ready).becomesTruthy(...)
|
|
3928
3945
|
setTimeout(() => {
|
|
3929
3946
|
this.interactionContext.startActivity(activityType, data)
|
|
3930
3947
|
.then(resolve)
|
|
@@ -4520,7 +4537,7 @@ class PlaceComponent extends DisposableComponent {
|
|
|
4520
4537
|
this.visitModel.value = visit;
|
|
4521
4538
|
DebugContext.getOrCreate(this.visitModel).tag(`${this.placeDefinition.component.name}.visitModel`);
|
|
4522
4539
|
this.placeDefinition.getVisitParameterDefs().forEach(parameterDef => this.installBinding(parameterDef));
|
|
4523
|
-
when
|
|
4540
|
+
when(this.visitModel).changes((current, previous) => {
|
|
4524
4541
|
notifyVisitChanged(current, previous);
|
|
4525
4542
|
}, { unless: this._inVisitUpdate });
|
|
4526
4543
|
}
|
|
@@ -6162,7 +6179,7 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
6162
6179
|
this.onAnimationFinishedJob = finishPlaceLoad;
|
|
6163
6180
|
}
|
|
6164
6181
|
const { when, chain, valueOf } = Dsl.disposeWith(activePlace);
|
|
6165
|
-
when
|
|
6182
|
+
when(this.routerVisitModel)
|
|
6166
6183
|
.changes(visit => {
|
|
6167
6184
|
activePlace.updateVisit(visit);
|
|
6168
6185
|
}, {
|
|
@@ -6247,7 +6264,7 @@ class AbstractPlaceNavigationComponent extends DisposableComponent {
|
|
|
6247
6264
|
this.commandFactory = Command.createFactory((placeDefinition) => {
|
|
6248
6265
|
this.placeOutlet.navigate(new Visit(placeDefinition));
|
|
6249
6266
|
});
|
|
6250
|
-
when
|
|
6267
|
+
when(this.placeOutletModel).changes(outlet => {
|
|
6251
6268
|
// NOTE: this updates during a change cycle and causes our isActiveMethod to return 2 different
|
|
6252
6269
|
// values in the one change detection cycle. So instead we delay the update to a different
|
|
6253
6270
|
// tick.
|