@coolon/angular-ui-powerups 1.0.1-alpha.1 → 1.0.2
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 +4 -0
- package/bundles/coolon-angular-ui-powerups.umd.js +435 -158
- 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.d.ts +26 -25
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +24 -23
- package/esm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/esm2015/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/angular-ui-powerups.module.ngfactory.js.map +1 -1
- package/esm2015/lib/components/components.module.js +9 -2
- package/esm2015/lib/components/components.module.js.map +1 -1
- package/esm2015/lib/components/components.module.metadata.json +1 -1
- package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
- package/esm2015/lib/components/forms/abstract-input.component.js +12 -1
- package/esm2015/lib/components/forms/abstract-input.component.js.map +1 -1
- package/esm2015/lib/components/forms/abstract-input.component.metadata.json +1 -1
- package/esm2015/lib/components/index.js +1 -0
- package/esm2015/lib/components/index.js.map +1 -1
- package/esm2015/lib/components/index.metadata.json +1 -1
- package/esm2015/lib/components/switch-case/switch-case.component.js +124 -0
- package/esm2015/lib/components/switch-case/switch-case.component.js.map +1 -0
- package/esm2015/lib/components/switch-case/switch-case.component.metadata.json +1 -0
- package/esm2015/lib/components/switch-case/switch-case.component.ngfactory.js.map +1 -0
- package/esm2015/lib/components/switch-case/switch-case.component.scss.shim.ngstyle.js.map +1 -0
- package/esm2015/lib/directives/command.directive.js +4 -4
- package/esm2015/lib/directives/command.directive.js.map +1 -1
- package/esm2015/lib/directives/focus-binding.directive.js +3 -3
- package/esm2015/lib/directives/focus-binding.directive.js.map +1 -1
- package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.js +1 -1
- package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.metadata.json +1 -1
- package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +1 -1
- package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.metadata.json +1 -1
- package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +1 -1
- package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.metadata.json +1 -1
- package/esm2015/lib/place/guards/place.guard.js +4 -3
- package/esm2015/lib/place/guards/place.guard.js.map +1 -1
- package/esm2015/lib/place/place-component.js +2 -2
- package/esm2015/lib/place/place-component.js.map +1 -1
- package/esm2015/lib/place/place-history.js +116 -13
- package/esm2015/lib/place/place-history.js.map +1 -1
- package/esm2015/lib/place/place-history.metadata.json +1 -1
- package/esm2015/lib/place/place-router.js +13 -6
- package/esm2015/lib/place/place-router.js.map +1 -1
- package/esm2015/lib/place/place-router.metadata.json +1 -1
- package/esm2015/lib/place/route/parameter-definition.class.js +10 -9
- package/esm2015/lib/place/route/parameter-definition.class.js.map +1 -1
- package/esm2015/lib/place/route/visit-sanitiser.js +14 -6
- package/esm2015/lib/place/route/visit-sanitiser.js.map +1 -1
- package/esm2015/lib/place/route/visit-sanitiser.metadata.json +1 -1
- package/esm5/coolon-angular-ui-powerups.js +24 -23
- package/esm5/coolon-angular-ui-powerups.js.map +1 -1
- package/esm5/lib/angular-ui-powerups.module.ngfactory.js.map +1 -1
- package/esm5/lib/components/components.module.js +9 -2
- package/esm5/lib/components/components.module.js.map +1 -1
- package/esm5/lib/components/components.module.ngfactory.js.map +1 -1
- package/esm5/lib/components/forms/abstract-input.component.js +12 -1
- package/esm5/lib/components/forms/abstract-input.component.js.map +1 -1
- package/esm5/lib/components/index.js +1 -0
- package/esm5/lib/components/index.js.map +1 -1
- package/esm5/lib/components/switch-case/switch-case.component.js +144 -0
- package/esm5/lib/components/switch-case/switch-case.component.js.map +1 -0
- package/esm5/lib/components/switch-case/switch-case.component.ngfactory.js.map +1 -0
- package/esm5/lib/components/switch-case/switch-case.component.scss.shim.ngstyle.js.map +1 -0
- package/esm5/lib/directives/command.directive.js +4 -4
- package/esm5/lib/directives/command.directive.js.map +1 -1
- package/esm5/lib/directives/focus-binding.directive.js +3 -3
- package/esm5/lib/directives/focus-binding.directive.js.map +1 -1
- package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js +1 -1
- package/esm5/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +1 -1
- package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +1 -1
- package/esm5/lib/place/guards/place.guard.js +5 -4
- package/esm5/lib/place/guards/place.guard.js.map +1 -1
- package/esm5/lib/place/place-component.js +2 -2
- package/esm5/lib/place/place-component.js.map +1 -1
- package/esm5/lib/place/place-history.js +117 -11
- package/esm5/lib/place/place-history.js.map +1 -1
- package/esm5/lib/place/place-router.js +13 -7
- package/esm5/lib/place/place-router.js.map +1 -1
- package/esm5/lib/place/route/parameter-definition.class.js +11 -11
- package/esm5/lib/place/route/parameter-definition.class.js.map +1 -1
- package/esm5/lib/place/route/visit-sanitiser.js +14 -6
- package/esm5/lib/place/route/visit-sanitiser.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +365 -115
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +393 -123
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/forms/abstract-input.component.d.ts +11 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/switch-case/switch-case.component.d.ts +32 -0
- package/lib/place/place-history.d.ts +17 -3
- package/lib/place/route/parameter-definition.class.d.ts +1 -1
- package/lib/place/route/visit-sanitiser.d.ts +3 -1
- package/package.json +2 -2
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
var SwitchCaseWhenDirective_1, SwitchCaseDefaultDirective_1;
|
|
2
|
+
import { __decorate, __metadata } from "tslib";
|
|
3
|
+
import { AfterContentInit, ChangeDetectorRef, Component, ContentChildren, Directive, Input, OnInit, QueryList, TemplateRef } from '@angular/core';
|
|
4
|
+
import { Dsl, StoreInValueModel, UseDelegate, ValueModel } from '@coolon/pectin';
|
|
5
|
+
import { DisposableComponent } from '../disposable-component';
|
|
6
|
+
export class SwitchCaseOption {
|
|
7
|
+
constructor(templateRef) {
|
|
8
|
+
this.templateRef = templateRef;
|
|
9
|
+
}
|
|
10
|
+
get name() {
|
|
11
|
+
return this.constructor.name;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
let SwitchCaseWhenDirective = SwitchCaseWhenDirective_1 = class SwitchCaseWhenDirective extends SwitchCaseOption {
|
|
15
|
+
constructor(templateRef) {
|
|
16
|
+
super(templateRef);
|
|
17
|
+
this.isDefault = false;
|
|
18
|
+
}
|
|
19
|
+
matches(value) {
|
|
20
|
+
return this.aupSwitchCaseWhen === value;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
SwitchCaseWhenDirective.ctorParameters = () => [
|
|
24
|
+
{ type: TemplateRef }
|
|
25
|
+
];
|
|
26
|
+
__decorate([
|
|
27
|
+
Input(),
|
|
28
|
+
__metadata("design:type", Object)
|
|
29
|
+
], SwitchCaseWhenDirective.prototype, "aupSwitchCaseWhen", void 0);
|
|
30
|
+
SwitchCaseWhenDirective = SwitchCaseWhenDirective_1 = __decorate([
|
|
31
|
+
Directive({
|
|
32
|
+
selector: '[aupSwitchCaseWhen]',
|
|
33
|
+
providers: [{ provide: SwitchCaseOption, useExisting: SwitchCaseWhenDirective_1 }]
|
|
34
|
+
}),
|
|
35
|
+
__metadata("design:paramtypes", [TemplateRef])
|
|
36
|
+
], SwitchCaseWhenDirective);
|
|
37
|
+
export { SwitchCaseWhenDirective };
|
|
38
|
+
let SwitchCaseDefaultDirective = SwitchCaseDefaultDirective_1 = class SwitchCaseDefaultDirective extends SwitchCaseOption {
|
|
39
|
+
constructor(templateRef) {
|
|
40
|
+
super(templateRef);
|
|
41
|
+
this.isDefault = true;
|
|
42
|
+
}
|
|
43
|
+
matches(value) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
SwitchCaseDefaultDirective.ctorParameters = () => [
|
|
48
|
+
{ type: TemplateRef }
|
|
49
|
+
];
|
|
50
|
+
SwitchCaseDefaultDirective = SwitchCaseDefaultDirective_1 = __decorate([
|
|
51
|
+
Directive({
|
|
52
|
+
selector: '[aupSwitchCaseDefault]',
|
|
53
|
+
providers: [{ provide: SwitchCaseOption, useExisting: SwitchCaseDefaultDirective_1 }]
|
|
54
|
+
}),
|
|
55
|
+
__metadata("design:paramtypes", [TemplateRef])
|
|
56
|
+
], SwitchCaseDefaultDirective);
|
|
57
|
+
export { SwitchCaseDefaultDirective };
|
|
58
|
+
let SwitchCaseComponent = class SwitchCaseComponent extends DisposableComponent {
|
|
59
|
+
constructor(cdr) {
|
|
60
|
+
super();
|
|
61
|
+
this.cdr = cdr;
|
|
62
|
+
this.selectedIndex = 0;
|
|
63
|
+
}
|
|
64
|
+
ngOnInit() {
|
|
65
|
+
}
|
|
66
|
+
ngAfterContentInit() {
|
|
67
|
+
const subscription = this.switchCaseOptions.changes.subscribe(change => this.updateSelection());
|
|
68
|
+
this.onDispose(() => subscription.unsubscribe());
|
|
69
|
+
const { chain, when } = Dsl.disposeWith(this);
|
|
70
|
+
when.valueOf(this.switchModel).changes(() => this.updateSelection(), { initialValue: 'triggerChange' });
|
|
71
|
+
this.cdr.detectChanges();
|
|
72
|
+
}
|
|
73
|
+
updateSelection() {
|
|
74
|
+
const matchingIndicies = [];
|
|
75
|
+
this.switchCaseOptions.forEach((option, index) => {
|
|
76
|
+
if (option.matches(this.switchModel.value)) {
|
|
77
|
+
matchingIndicies.push(index);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
if (matchingIndicies.length > 1) {
|
|
81
|
+
console.warn(`found ${matchingIndicies.length} matching case values, displaying the first.`);
|
|
82
|
+
}
|
|
83
|
+
if (matchingIndicies.length === 0) {
|
|
84
|
+
this.switchCaseOptions.forEach((option, index) => {
|
|
85
|
+
matchingIndicies.push(index);
|
|
86
|
+
});
|
|
87
|
+
if (matchingIndicies.length > 1) {
|
|
88
|
+
console.warn(`found ${matchingIndicies.length} default case values, displaying the first.`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (matchingIndicies.length > 0) {
|
|
92
|
+
this.selectedIndex = matchingIndicies[0];
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
console.warn(`found no matching or default case values.`);
|
|
96
|
+
this.selectedIndex = -1;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
SwitchCaseComponent.ctorParameters = () => [
|
|
101
|
+
{ type: ChangeDetectorRef }
|
|
102
|
+
];
|
|
103
|
+
__decorate([
|
|
104
|
+
Input(), UseDelegate(),
|
|
105
|
+
__metadata("design:type", ValueModel)
|
|
106
|
+
], SwitchCaseComponent.prototype, "switchModel", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
Input(), StoreInValueModel('switchModel'),
|
|
109
|
+
__metadata("design:type", Object)
|
|
110
|
+
], SwitchCaseComponent.prototype, "switch", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
ContentChildren(SwitchCaseOption),
|
|
113
|
+
__metadata("design:type", QueryList)
|
|
114
|
+
], SwitchCaseComponent.prototype, "switchCaseOptions", void 0);
|
|
115
|
+
SwitchCaseComponent = __decorate([
|
|
116
|
+
Component({
|
|
117
|
+
selector: 'aup-switch-case',
|
|
118
|
+
template: "<mat-tab-group class=\"content-wrapper\" no-tab-header full-height-tabs [selectedIndex]=\"selectedIndex\">\n <mat-tab *ngFor=\"let option of switchCaseOptions\">\n <ng-template [ngTemplateOutlet]=\"option.templateRef\"></ng-template>\n </mat-tab>\n</mat-tab-group>\n\n\n",
|
|
119
|
+
styles: [":host{display:flex;flex-direction:column;align-items:stretch}mat-tab-group{flex:1}"]
|
|
120
|
+
}),
|
|
121
|
+
__metadata("design:paramtypes", [ChangeDetectorRef])
|
|
122
|
+
], SwitchCaseComponent);
|
|
123
|
+
export { SwitchCaseComponent };
|
|
124
|
+
//# sourceMappingURL=switch-case.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch-case.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/switch-case/switch-case.component.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,SAAS,EACT,KAAK,EACL,MAAM,EACN,SAAS,EACT,WAAW,EACZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,MAAM,OAAgB,gBAAgB;IAIpC,YAAqB,WAAgC;QAAhC,gBAAW,GAAX,WAAW,CAAqB;IACrD,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAC/B,CAAC;CAGF;AAMD,IAAa,uBAAuB,+BAApC,MAAa,uBAA2B,SAAQ,gBAAmB;IAIjE,YAAY,WAAgC;QAC1C,KAAK,CAAC,WAAW,CAAC,CAAC;QAHZ,cAAS,GAAG,KAAK,CAAC;IAI3B,CAAC;IAED,OAAO,CAAC,KAAQ;QACd,OAAO,IAAI,CAAC,iBAAiB,KAAK,KAAK,CAAC;IAC1C,CAAC;CACF,CAAA;;YAP0B,WAAW;;AAH3B;IAAR,KAAK,EAAE;;kEAAsB;AADnB,uBAAuB;IAJnC,SAAS,CAAC;QACT,QAAQ,EAAE,qBAAqB;QAC/B,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,yBAAuB,EAAE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GV;IADC,eAAe,CAAC,gBAAgB,CAAC;8BACf,SAAS;8DAAsB;AATvC,mBAAmB;IAL/B,SAAS,CAAC;QACT,QAAQ,EAAE,iBAAiB;QAC3B,+RAA2C;;KAE5C,CAAC;qCAcyB,iBAAiB;GAb/B,mBAAmB,CAqD/B;SArDY,mBAAmB","sourcesContent":["import {\n AfterContentInit,\n ChangeDetectorRef,\n Component,\n ContentChildren,\n Directive,\n Input,\n OnInit,\n QueryList,\n TemplateRef\n} from '@angular/core';\n\nimport { Dsl, StoreInValueModel, UseDelegate, ValueModel } from '@coolon/pectin';\nimport { DisposableComponent } from '../disposable-component';\n\n\nexport abstract class SwitchCaseOption<T> {\n\n abstract readonly isDefault: boolean;\n\n constructor(readonly templateRef: TemplateRef<Object>) {\n }\n\n get name() {\n return this.constructor.name;\n }\n\n abstract matches(value: T): boolean;\n}\n\n@Directive({\n selector: '[aupSwitchCaseWhen]',\n providers: [{ provide: SwitchCaseOption, useExisting: SwitchCaseWhenDirective }]\n})\nexport class SwitchCaseWhenDirective<T> extends SwitchCaseOption<T> {\n @Input() aupSwitchCaseWhen: T;\n readonly isDefault = false;\n\n constructor(templateRef: TemplateRef<Object>) {\n super(templateRef);\n }\n\n matches(value: T): boolean {\n return this.aupSwitchCaseWhen === value;\n }\n}\n\n@Directive({\n selector: '[aupSwitchCaseDefault]',\n providers: [{ provide: SwitchCaseOption, useExisting: SwitchCaseDefaultDirective }]\n})\nexport class SwitchCaseDefaultDirective<T> extends SwitchCaseOption<T> {\n readonly isDefault = true;\n\n constructor(templateRef: TemplateRef<Object>) {\n super(templateRef);\n }\n\n matches(value: T): boolean {\n return false;\n }\n}\n\n\n@Component({\n selector: 'aup-switch-case',\n templateUrl: './switch-case.component.html',\n styleUrls: ['./switch-case.component.scss']\n})\nexport class SwitchCaseComponent<T> extends DisposableComponent implements OnInit, AfterContentInit {\n\n @Input() @UseDelegate()\n switchModel: ValueModel<T>;\n\n @Input() @StoreInValueModel('switchModel')\n switch: T;\n\n @ContentChildren(SwitchCaseOption)\n switchCaseOptions: QueryList<SwitchCaseOption<T>>;\n\n selectedIndex = 0;\n\n constructor(private cdr: ChangeDetectorRef) {\n super();\n }\n\n ngOnInit(): void {\n }\n\n ngAfterContentInit(): void {\n const subscription = this.switchCaseOptions.changes.subscribe(change => this.updateSelection());\n this.onDispose(() => subscription.unsubscribe());\n const { chain, when } = Dsl.disposeWith(this);\n when.valueOf(this.switchModel).changes(() => this.updateSelection(), { initialValue: 'triggerChange' });\n this.cdr.detectChanges();\n }\n\n private updateSelection() {\n const matchingIndicies = [];\n this.switchCaseOptions.forEach((option, index) => {\n if (option.matches(this.switchModel.value)) {\n matchingIndicies.push(index);\n }\n });\n if (matchingIndicies.length > 1) {\n console.warn(`found ${matchingIndicies.length} matching case values, displaying the first.`);\n }\n if (matchingIndicies.length === 0) {\n this.switchCaseOptions.forEach((option, index) => {\n matchingIndicies.push(index);\n });\n if (matchingIndicies.length > 1) {\n console.warn(`found ${matchingIndicies.length} default case values, displaying the first.`);\n }\n }\n if (matchingIndicies.length > 0) {\n this.selectedIndex = matchingIndicies[0];\n } else {\n console.warn(`found no matching or default case values.`);\n this.selectedIndex = -1;\n }\n }\n}\n\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"SwitchCaseOption":{"__symbolic":"class","arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"TemplateRef","line":20,"character":36,"arguments":[{"__symbolic":"reference","name":"Object"}]}]}],"matches":[{"__symbolic":"method"}]}},"SwitchCaseWhenDirective":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"SwitchCaseOption"},"arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":30,"character":1},"arguments":[{"selector":"[aupSwitchCaseWhen]","providers":[{"provide":{"__symbolic":"reference","name":"SwitchCaseOption"},"useExisting":{"__symbolic":"reference","name":"SwitchCaseWhenDirective"}}]}]}],"members":{"aupSwitchCaseWhen":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"TemplateRef","line":20,"character":36,"arguments":[{"__symbolic":"reference","name":"Object"}]}]}],"matches":[{"__symbolic":"method"}]}},"SwitchCaseDefaultDirective":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"SwitchCaseOption"},"arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":47,"character":1},"arguments":[{"selector":"[aupSwitchCaseDefault]","providers":[{"provide":{"__symbolic":"reference","name":"SwitchCaseOption"},"useExisting":{"__symbolic":"reference","name":"SwitchCaseDefaultDirective"}}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"TemplateRef","line":20,"character":36,"arguments":[{"__symbolic":"reference","name":"Object"}]}]}],"matches":[{"__symbolic":"method"}]}},"SwitchCaseComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../disposable-component","name":"DisposableComponent","line":69,"character":44},"arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":64,"character":1},"arguments":[{"selector":"aup-switch-case","template":"<mat-tab-group class=\"content-wrapper\" no-tab-header full-height-tabs [selectedIndex]=\"selectedIndex\">\n <mat-tab *ngFor=\"let option of switchCaseOptions\">\n <ng-template [ngTemplateOutlet]=\"option.templateRef\"></ng-template>\n </mat-tab>\n</mat-tab-group>\n\n\n","styles":[":host{display:flex;flex-direction:column;align-items:stretch}mat-tab-group{flex:1}"]}]}],"members":{"switchModel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":71,"character":3}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"UseDelegate","line":71,"character":12}}]}],"switch":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":74,"character":3}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"StoreInValueModel","line":74,"character":12},"arguments":["switchModel"]}]}],"switchCaseOptions":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChildren","line":77,"character":3},"arguments":[{"__symbolic":"reference","name":"SwitchCaseOption"}]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":82,"character":27}]}],"ngOnInit":[{"__symbolic":"method"}],"ngAfterContentInit":[{"__symbolic":"method"}],"updateSelection":[{"__symbolic":"method"}]}}}}]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch-case.component.ngfactory.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/switch-case/switch-case.component.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch-case.component.scss.shim.ngstyle.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/switch-case/switch-case.component.scss.shim.ngstyle.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
|
|
@@ -26,7 +26,7 @@ let CommandDirective = class CommandDirective extends GarbageCollector {
|
|
|
26
26
|
assert.notNil(this.pectinCommand);
|
|
27
27
|
if (this.pectinCommand instanceof UnaryCommand) {
|
|
28
28
|
if (!this._commandParameterProvided) {
|
|
29
|
-
lang.illegalState('UnaryCommands
|
|
29
|
+
lang.illegalState('UnaryCommands require the command parameter to be specified.');
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
@@ -38,8 +38,8 @@ let CommandDirective = class CommandDirective extends GarbageCollector {
|
|
|
38
38
|
ngAfterViewInit() {
|
|
39
39
|
// for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now
|
|
40
40
|
// we need to do this.
|
|
41
|
-
const {
|
|
42
|
-
|
|
41
|
+
const { when } = Dsl.disposeWith(this);
|
|
42
|
+
when.valueOf(this._commandEnabled).changes(enabled => {
|
|
43
43
|
if (enabled) {
|
|
44
44
|
this.elementRef.nativeElement.removeAttribute('disabled');
|
|
45
45
|
if (this.elementRef.nativeElement.tagName === 'A') {
|
|
@@ -52,7 +52,7 @@ let CommandDirective = class CommandDirective extends GarbageCollector {
|
|
|
52
52
|
this.elementRef.nativeElement.removeAttribute('href');
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
});
|
|
55
|
+
}, { initialValue: 'triggerChange' });
|
|
56
56
|
}
|
|
57
57
|
ngOnDestroy() {
|
|
58
58
|
this.dispose();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.directive.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/directives/command.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrH,OAAO,EAAE,MAAM,EAAW,oBAAoB,EAAE,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAMlH,IAAa,gBAAgB,GAA7B,MAAa,gBAA0B,SAAQ,gBAAgB;IA2B7D,YAAwC,UAAsB;QAC5D,KAAK,EAAE,CAAC;QAD8B,eAAU,GAAV,UAAU,CAAY;QAxBtD,oBAAe,GAAG,IAAI,oBAAoB,EAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAYzE,8BAAyB,GAAG,KAAK,CAAC;IAc1C,CAAC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AK;;mDAYxB;AAjFU,gBAAgB;IAJ5B,SAAS,CAAC;QACT,8CAA8C;QAC9C,QAAQ,EAAE,iBAAiB;KAC5B,CAAC;IA4Ba,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;qCAAqB,UAAU;GA3BnD,gBAAgB,CAkF5B;SAlFY,gBAAgB","sourcesContent":["import { AfterViewInit, Directive, ElementRef, HostListener, Inject, Input, OnDestroy, OnInit } from '@angular/core';\nimport { assert, Command, DelegatingValueModel, Dsl, GarbageCollector, lang, UnaryCommand } from '@coolon/pectin';\n\n@Directive({\n // tslint:disable-next-line:directive-selector\n selector: '[pectinCommand]'\n})\nexport class CommandDirective<P = any> extends GarbageCollector implements OnInit, OnDestroy, AfterViewInit {\n\n private _command: Command<any> | UnaryCommand<P>;\n private _commandEnabled = new DelegatingValueModel<boolean>().withDefault(false);\n\n @Input()\n set pectinCommand(command: Command<any> | UnaryCommand<P>) {\n this._command = command;\n this._commandEnabled.setDelegate(command ? command.enabled : null);\n }\n get pectinCommand():Command<any> | UnaryCommand<P> {\n return this._command;\n }\n\n private _commandParameter: P;\n private _commandParameterProvided = false;\n\n @Input()\n set commandParameter(value: P) {\n this._commandParameterProvided = true;\n this._commandParameter = value;\n }\n\n get commandParameter(): P {\n return this._commandParameter;\n }\n\n constructor(@Inject(ElementRef) private elementRef: ElementRef) {\n super();\n }\n\n ngOnInit(): void {\n assert.notNil(this.pectinCommand);\n if (this.pectinCommand instanceof UnaryCommand) {\n if (!this._commandParameterProvided) {\n lang.illegalState('UnaryCommands require the command parameter to be specified.');\n }\n } else {\n if (this._commandParameterProvided) {\n lang.illegalState('command parameters are only supported by UnaryCommands');\n }\n }\n }\n\n ngAfterViewInit(): void {\n // for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now\n // we need to do this.\n const { when } = Dsl.disposeWith(this);\n when.valueOf(this._commandEnabled).changes(enabled => {\n if (enabled) {\n this.elementRef.nativeElement.removeAttribute('disabled');\n if (this.elementRef.nativeElement.tagName === 'A') {\n this.elementRef.nativeElement.setAttribute('href', 'javascript:void');\n }\n } else {\n this.elementRef.nativeElement.setAttribute('disabled', 'disabled');\n if (this.elementRef.nativeElement.tagName === 'A') {\n this.elementRef.nativeElement.removeAttribute('href');\n }\n }\n }, {initialValue: 'triggerChange'});\n }\n\n ngOnDestroy(): void {\n this.dispose();\n }\n\n\n @HostListener('click', ['$event'])\n notifyClick($event: Event) {\n $event.preventDefault();\n $event.stopPropagation();\n if (this.pectinCommand.enabled.value) {\n if (this.pectinCommand instanceof UnaryCommand) {\n this.pectinCommand.withContext({ event: $event }).execute(this.commandParameter);\n } else {\n this.pectinCommand.withContext({ event: $event }).execute();\n }\n } else {\n console.warn('disabled command clicked, ignoring.');\n }\n }\n}\n"]}
|
|
@@ -26,12 +26,12 @@ let FocusBindingDirective = class FocusBindingDirective extends DisposableCompon
|
|
|
26
26
|
ngAfterViewInit() {
|
|
27
27
|
// TODO: Make this also track the current enabled/disabled state.
|
|
28
28
|
if (this.hasBinding()) {
|
|
29
|
-
const {
|
|
30
|
-
|
|
29
|
+
const { when } = Dsl.disposeWith(this);
|
|
30
|
+
when.valueOf(this.pectinFocusBinding.focusContext.focused).changes((focused) => {
|
|
31
31
|
if (focused && !this.alreadyHasFocus()) {
|
|
32
32
|
this.tryAndFocus();
|
|
33
33
|
}
|
|
34
|
-
});
|
|
34
|
+
}, { initialValue: 'triggerChange' });
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
37
|
Logger.get(this).warn('pectinFocusBinding was nil');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focus-binding.directive.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/directives/focus-binding.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAClH,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAOzE,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,mBAAmB;IAqB5D,YAAiD,EAAc,EAClB,MAAc,EAC7B,QAAa;QACzC,KAAK,EAAE,CAAC;QAHuC,OAAE,GAAF,EAAE,CAAY;QAClB,WAAM,GAAN,MAAM,CAAQ;QAGzD,kHAAkH;QAClH,IAAI,CAAC,QAAQ,GAAG,QAAoB,CAAC;IACvC,CAAC;IAnBD,SAAS;QACP,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE;YACrB,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC;SACtD;IACH,CAAC;IAGD,UAAU;QACR,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE;YACrB,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC;SACvD;IACH,CAAC;IAUD,QAAQ;IACR,CAAC;IAED,eAAe;QACb,iEAAiE;QACjE,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE;YACrB,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"focus-binding.directive.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/directives/focus-binding.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAClH,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAOzE,I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M,OAAO,GAAG,SAAS,CAAC,MAAM,IAAI,CAAC,IAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAAC;QAC/D,6CAA6C;QAC7C,OAAO,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAClD,CAAC;CACF,CAAA;;YA5EsD,UAAU,uBAAlD,MAAM,SAAC,UAAU;YACuB,MAAM,uBAA9C,MAAM,SAAC,MAAM;4CACb,MAAM,SAAC,QAAQ;;AAnBnB;IAAR,KAAK,EAAE;;iEAAsC;AACrC;IAAR,KAAK,EAAE;8BAAqB,WAAW;iEAAC;AAGzC;IADC,YAAY,CAAC,SAAS,CAAC;;;;sDAKvB;AAGD;IADC,YAAY,CAAC,UAAU,CAAC;;;;uDAKxB;AAnBU,qBAAqB;IAJjC,SAAS,CAAC;QACT,8CAA8C;QAC9C,QAAQ,EAAE,sBAAsB;KACjC,CAAC;IAsBa,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;IAClB,WAAA,MAAM,CAAC,MAAM,CAAC,CAAA;IACd,WAAA,MAAM,CAAC,QAAQ,CAAC,CAAA;qCAFwB,UAAU;QACV,MAAM;GAtBhD,qBAAqB,CAiGjC;SAjGY,qBAAqB","sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { AfterViewInit, Directive, ElementRef, HostListener, Inject, Input, NgZone, OnInit } from '@angular/core';\nimport { Dsl, HasFocusTracking, Logger } from '@coolon/pectin';\nimport { DisposableComponent } from '../components/disposable-component';\n\n\n@Directive({\n // tslint:disable-next-line:directive-selector\n selector: '[pectinFocusBinding]'\n})\nexport class FocusBindingDirective extends DisposableComponent implements OnInit, AfterViewInit {\n\n private readonly document: Document;\n\n @Input() pectinFocusBinding: HasFocusTracking;\n @Input() focusBindingTarget: HTMLElement;\n\n @HostListener('focusin')\n onFocusIn() {\n if (this.hasBinding()) {\n this.pectinFocusBinding.focusContext.notifyFocusIn();\n }\n }\n\n @HostListener('focusout')\n onFocusOut() {\n if (this.hasBinding()) {\n this.pectinFocusBinding.focusContext.notifyFocusOut();\n }\n }\n\n constructor(@Inject(ElementRef) private readonly el: ElementRef,\n @Inject(NgZone) private readonly ngZone: NgZone,\n @Inject(DOCUMENT) document: any) {\n super();\n // @see https://stackoverflow.com/questions/49513359/could-not-resolve-type-document-in-angular5/53715642#53715642\n this.document = document as Document;\n }\n\n ngOnInit(): void {\n }\n\n ngAfterViewInit(): void {\n // TODO: Make this also track the current enabled/disabled state.\n if (this.hasBinding()) {\n const { when } = Dsl.disposeWith(this);\n when.valueOf(this.pectinFocusBinding.focusContext.focused).changes((focused) => {\n if (focused && !this.alreadyHasFocus()) {\n this.tryAndFocus();\n }\n }, {initialValue: 'triggerChange'});\n } else {\n Logger.get(this).warn('pectinFocusBinding was nil');\n }\n }\n\n private hasBinding() {\n return !!this.pectinFocusBinding && !!this.pectinFocusBinding.focusContext;\n }\n\n// Hook method for debugging via tracing.\n alreadyHasFocus() {\n return this.isFocused(this.focusTarget);\n }\n\n // Hook method for debugging via tracing.\n isFocused(element: Element): boolean {\n return this.document.activeElement === element;\n }\n\n tryAndFocus(retries: number = 5) {\n if (this.modelShouldStillHaveFocus() && this.canFocus()) {\n if (!this.alreadyHasFocus()) {\n this.focusTarget.focus();\n }\n // if we didn't get the focus we try again later.\n if (!this.alreadyHasFocus()) {\n Logger.get(this).log(`focus failed, trying ${retries} more times`);\n if (retries > 0) {\n // try again on the next paint\n // TODO: is there an angular way of doing this without calling a window function.\n requestAnimationFrame(() => {\n this.tryAndFocus(retries - 1);\n });\n } else {\n Logger.get(this).warn(`Tried to focus but gave up as the component wasn't enabled or visible.`);\n }\n }\n }\n }\n\n get focusTarget(): HTMLElement {\n return this.focusBindingTarget || this.el.nativeElement;\n }\n\n // Hook method for debugging via tracing.\n modelShouldStillHaveFocus() {\n return this.hasBinding() && this.pectinFocusBinding.focusContext.focused.value;\n }\n\n // Hook method for debugging via tracing.\n canFocus(): boolean {\n const dimension = this.focusTarget.getBoundingClientRect();\n const hasSize = dimension.height >= 0 && dimension.height >= 0;\n // tslint:disable-next-line:no-string-literal\n return hasSize && !this.focusTarget['disabled'];\n }\n}\n"]}
|
|
@@ -16,7 +16,7 @@ AlertDialogComponent = __decorate([
|
|
|
16
16
|
Component({
|
|
17
17
|
selector: 'aup-alert-dialog',
|
|
18
18
|
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<div matDialogActions>\n <button mat-raised-button color=\"primary\" (click)=\"done()\" data-cy=\"close-button\">{{alert.ok()}}</button>\n</div>\n",
|
|
19
|
-
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]
|
|
19
|
+
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{margin-bottom:0!important;padding:0;align-items:flex-end;justify-content:flex-end}"]
|
|
20
20
|
}),
|
|
21
21
|
__param(0, Inject(ACTIVITY_DATA)),
|
|
22
22
|
__metadata("design:paramtypes", [Object])
|
package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.metadata.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"AlertDialogComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../../activity","name":"Activity","line":9,"character":42},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":4,"character":1},"arguments":[{"selector":"aup-alert-dialog","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<div matDialogActions>\n <button mat-raised-button color=\"primary\" (click)=\"done()\" data-cy=\"close-button\">{{alert.ok()}}</button>\n</div>\n","styles":[":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":11,"character":15},"arguments":[{"__symbolic":"reference","module":"../../activity","name":"ACTIVITY_DATA","line":11,"character":22}]}]],"parameters":[{"__symbolic":"reference","module":"../../alert","name":"Alert","line":11,"character":53}]}],"ngOnInit":[{"__symbolic":"method"}]}}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"AlertDialogComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../../activity","name":"Activity","line":9,"character":42},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":4,"character":1},"arguments":[{"selector":"aup-alert-dialog","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<div matDialogActions>\n <button mat-raised-button color=\"primary\" (click)=\"done()\" data-cy=\"close-button\">{{alert.ok()}}</button>\n</div>\n","styles":[":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{margin-bottom:0!important;padding:0;align-items:flex-end;justify-content:flex-end}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":11,"character":15},"arguments":[{"__symbolic":"reference","module":"../../activity","name":"ACTIVITY_DATA","line":11,"character":22}]}]],"parameters":[{"__symbolic":"reference","module":"../../alert","name":"Alert","line":11,"character":53}]}],"ngOnInit":[{"__symbolic":"method"}]}}}}]
|
package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js
CHANGED
|
@@ -29,7 +29,7 @@ ConfirmThenDialogComponent = __decorate([
|
|
|
29
29
|
Component({
|
|
30
30
|
selector: 'aup-confirmation-dialog',
|
|
31
31
|
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<div matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"onConfirm()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</div>\n\n",
|
|
32
|
-
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]
|
|
32
|
+
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{margin-bottom:0!important;padding:0;align-items:flex-end;justify-content:flex-end}"]
|
|
33
33
|
}),
|
|
34
34
|
__param(0, Inject(ACTIVITY_DATA)),
|
|
35
35
|
__metadata("design:paramtypes", [Object])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"ConfirmThenDialogComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../../activity","name":"Activity","line":11,"character":57},"arity":3,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":6,"character":1},"arguments":[{"selector":"aup-confirmation-dialog","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<div matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"onConfirm()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</div>\n\n","styles":[":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":13,"character":15},"arguments":[{"__symbolic":"reference","module":"../../activity","name":"ACTIVITY_DATA","line":13,"character":22}]}]],"parameters":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ConfirmThenDialogComponent"},"member":"Data","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":13,"character":86,"context":{"typeName":"D"}},{"__symbolic":"error","message":"Could not resolve type","line":13,"character":89,"context":{"typeName":"R"}},{"__symbolic":"error","message":"Could not resolve type","line":13,"character":92,"context":{"typeName":"E"}}]}]}],"ngOnInit":[{"__symbolic":"method"}],"isDestructive":[{"__symbolic":"method"}],"onConfirm":[{"__symbolic":"method"}]}}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"ConfirmThenDialogComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../../activity","name":"Activity","line":11,"character":57},"arity":3,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":6,"character":1},"arguments":[{"selector":"aup-confirmation-dialog","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<div matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"onConfirm()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</div>\n\n","styles":[":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{margin-bottom:0!important;padding:0;align-items:flex-end;justify-content:flex-end}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":13,"character":15},"arguments":[{"__symbolic":"reference","module":"../../activity","name":"ACTIVITY_DATA","line":13,"character":22}]}]],"parameters":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ConfirmThenDialogComponent"},"member":"Data","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":13,"character":86,"context":{"typeName":"D"}},{"__symbolic":"error","message":"Could not resolve type","line":13,"character":89,"context":{"typeName":"R"}},{"__symbolic":"error","message":"Could not resolve type","line":13,"character":92,"context":{"typeName":"E"}}]}]}],"ngOnInit":[{"__symbolic":"method"}],"isDestructive":[{"__symbolic":"method"}],"onConfirm":[{"__symbolic":"method"}]}}}}]
|
package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js
CHANGED
|
@@ -21,7 +21,7 @@ ConfirmationDialogComponent = __decorate([
|
|
|
21
21
|
Component({
|
|
22
22
|
selector: 'aup-confirmation-dialog',
|
|
23
23
|
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<div matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"done()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</div>\n\n",
|
|
24
|
-
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]
|
|
24
|
+
styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{margin-bottom:0!important;padding:0;align-items:flex-end;justify-content:flex-end}"]
|
|
25
25
|
}),
|
|
26
26
|
__param(0, Inject(ACTIVITY_DATA)),
|
|
27
27
|
__metadata("design:paramtypes", [Object])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"ConfirmationDialogComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../../activity","name":"Activity","line":10,"character":49},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":5,"character":1},"arguments":[{"selector":"aup-confirmation-dialog","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<div matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"done()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</div>\n\n","styles":[":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":12,"character":15},"arguments":[{"__symbolic":"reference","module":"../../activity","name":"ACTIVITY_DATA","line":12,"character":22}]}]],"parameters":[{"__symbolic":"reference","module":"../../confirm","name":"Confirm","line":12,"character":55}]}],"ngOnInit":[{"__symbolic":"method"}],"isDestructive":[{"__symbolic":"method"}]}}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"ConfirmationDialogComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../../activity","name":"Activity","line":10,"character":49},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":5,"character":1},"arguments":[{"selector":"aup-confirmation-dialog","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<div matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"done()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</div>\n\n","styles":[":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{margin-bottom:0!important;padding:0;align-items:flex-end;justify-content:flex-end}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":12,"character":15},"arguments":[{"__symbolic":"reference","module":"../../activity","name":"ACTIVITY_DATA","line":12,"character":22}]}]],"parameters":[{"__symbolic":"reference","module":"../../confirm","name":"Confirm","line":12,"character":55}]}],"ngOnInit":[{"__symbolic":"method"}],"isDestructive":[{"__symbolic":"method"}]}}}}]
|
|
@@ -25,11 +25,12 @@ export class PlaceGuard {
|
|
|
25
25
|
// Parse our route params.
|
|
26
26
|
const params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
|
|
27
27
|
const parsedParams = placeDefinition.parseRouteParams(params);
|
|
28
|
-
const
|
|
29
|
-
const
|
|
28
|
+
const navigationSession = this.placeRouter.navigationSession;
|
|
29
|
+
const initialVisit = navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
|
|
30
|
+
const sanitiser = new VisitSanitiser(navigationSession, activatedRoute, this.router, this.placeHistory, this.injector);
|
|
30
31
|
const sanitisedVisit = yield sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));
|
|
31
32
|
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
32
|
-
|
|
33
|
+
navigationSession.storeVisit(sanitisedVisit);
|
|
33
34
|
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
34
35
|
// Regenerate the url
|
|
35
36
|
const urlSnapshot = this.urlService.parseUrl(state.url).updateVisitSegments(sanitisedVisit);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place.guard.js","sourceRoot":"ng://@coolon/angular-ui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AAC,UAAU,CAAC;QAClF,CAAC;KAAA;IAID,WAAW;IACL,qBAAqB,CAAC,KAA6B,EAAE,KAA0B,EAAE,IAA0C;;YAC/H,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAChD,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,IAAI,GAAG,CAAC,eAAe,EAAE,EAAE;gBAChE,iGAAiG;gBACjG,mDAAmD;gBACnD,OAAO,GAAG,CAAC,oBAAoB,EAAE,CAAC;aACnC;iBAAM;gBACL,OAAO,IAAI,EAAE,CAAC;aACf;QACH,CAAC;KAAA;CAEF","sourcesContent":["import { Injector } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n CanActivate,\n CanDeactivate,\n Router,\n RouterStateSnapshot,\n UrlSerializer,\n UrlTree\n} from '@angular/router';\nimport { lang, Trace } from '@coolon/pectin';\nimport { Observable } from 'rxjs';\nimport { InteractionService } from '../../interaction/services/interaction.service';\nimport { PlaceComponent } from '../place-component';\nimport { PlaceDefinition } from '../place-definition';\nimport { PlaceHistory } from '../place-history';\nimport { PlaceRouter } from '../place-router';\nimport { VisitSanitiser } from '../route/visit-sanitiser';\nimport { UrlService } from '../url-service';\nimport { UrlSnapshot } from '../url-snapshot';\nimport { Visit } from '../visit';\nimport { ConsolidatedParameterMap } from './consolidated-param-map';\n\n\nexport abstract class PlaceGuard implements CanActivate, CanDeactivate<PlaceComponent> {\n\n\n constructor(private readonly router: Router,\n private urlService: UrlService,\n private readonly placeRouter: PlaceRouter,\n private readonly placeHistory: PlaceHistory,\n private readonly interactionService: InteractionService,\n private readonly injector: Injector) {\n }\n\n // @Trace()\n async canActivate(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n\n // TODO: this is ugly now that I'm return UrlSnapshots and not UrlTrees. It'd be better if the functions\n // weren't nested or if I implemented a handler chain.\n return this.authorisePlaceThen(activatedRoute, state, async (placeDefinition) => {\n\n const result = await this.cleanInteractionState(activatedRoute, state, async () => {\n // Parse our route params.\n const params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);\n const parsedParams = placeDefinition.parseRouteParams(params);\n\n const navigationSession = this.placeRouter.navigationSession;\n const initialVisit = navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);\n const sanitiser = new VisitSanitiser(navigationSession, activatedRoute, this.router, this.placeHistory, this.injector);\n const sanitisedVisit = await sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));\n\n // Save the visit with any updated parameters. We need to save it so we remember any non route parameters\n navigationSession.storeVisit(sanitisedVisit);\n if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {\n // Regenerate the url\n const urlSnapshot = this.urlService.parseUrl(state.url).updateVisitSegments(sanitisedVisit);\n // console.log('##### Place Guard Redirect', urlSnapshot);\n return urlSnapshot;\n } else {\n return true;\n }\n });\n return this.handleGuardResult(result);\n\n });\n }\n\n // @Trace()\n async canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Promise<boolean | UrlTree> {\n const currentUrl = this.urlService.parseUrl(currentState.url);\n const nextUrl = this.urlService.parseUrl(nextState.url);\n const result = await this.placeRouter.navigationSession.canDeactivatePlace(component, currentUrl, nextUrl);\n return this.handleGuardResult(result);\n }\n\n // @Trace()\n private handleGuardResult(result) {\n if (result instanceof UrlSnapshot) {\n return result.urlTree;\n } else {\n return result;\n }\n }\n\n // @Trace()\n protected async authorisePlaceThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, runPlaceGuards: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>) {\n if (PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) {\n const placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);\n const authoriseResult = placeDefinition.authenticate ? await this.isAuthorised(activatedRoute, state) : true;\n if (authoriseResult === true) {\n // we're authorised, now run the place guards.\n return runPlaceGuards(placeDefinition);\n } else {\n console.log('not authorised result', authoriseResult);\n return authoriseResult;\n }\n } else {\n return lang.illegalState(`expected component to be an instance of PlaceComponent, got ${activatedRoute.component}`);\n }\n }\n\n // @Trace()\n async isAuthorised(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n const authorised = this.getAuthGuard(this.injector).canActivate(activatedRoute, state);\n return (authorised instanceof Observable) ? authorised.toPromise() : authorised;\n }\n\n abstract getAuthGuard(injector: Injector): CanActivate;\n\n // @Trace()\n async cleanInteractionState(route: ActivatedRouteSnapshot, state: RouterStateSnapshot, then: () => Promise<boolean | UrlSnapshot>): Promise<boolean | UrlSnapshot> {\n const url = this.urlService.parseUrl(state.url);\n if (!this.interactionService.isActive() && url.hasInteractions()) {\n // This happens if we reload the page or the url was pasted as the route should only be activated\n // after the interaction context has become active.\n return url.removeInteractionIds();\n } else {\n return then();\n }\n }\n\n}\n"]}
|
|
@@ -45,11 +45,11 @@ let PlaceComponent = PlaceComponent_1 = class PlaceComponent extends DisposableC
|
|
|
45
45
|
const binding = this.registerDisposable(new Binding(this.visitModel, model, {
|
|
46
46
|
toRight(visit) {
|
|
47
47
|
const value = visit.getParameter(parameterDef.name);
|
|
48
|
-
console.log('push to component', { name: parameterDef.name, value, visit });
|
|
48
|
+
// console.log('push to component', { name: parameterDef.name, value, visit });
|
|
49
49
|
return value;
|
|
50
50
|
},
|
|
51
51
|
toLeft(value, currentVisit) {
|
|
52
|
-
console.log('push to route', { name: parameterDef.name, value, currentVisit });
|
|
52
|
+
// console.log('push to route', { name: parameterDef.name, value, currentVisit });
|
|
53
53
|
return currentVisit.replace(parameterDef, value);
|
|
54
54
|
}
|
|
55
55
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place-component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/place-component.ts"],"names":[],"mappings":";;AAA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\n Constructable,\n DebugContext,\n Dsl,\n Guard,\n IMutableHasValue,\n lang,\n MutableValueModel\n} from '@coolon/pectin';\nimport { Klass } from '@coolon/typescript-utilities';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator';\nimport 'reflect-metadata';\nimport { DisposableComponent } from '../components/disposable-component';\nimport { InteractionContext } from '../interaction/interaction-context';\nimport { PlaceDefinition } from './place-definition';\nimport { ParameterDefinition } from './route/parameter-definition.class';\nimport { Visit } from './visit';\n\n// RAKE: making this Symbol(...) broke things.\nexport const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';\n// this one seems ok.\nexport const ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');\n\n@Directive()\nexport class PlaceComponent extends DisposableComponent {\n\n private visitModel = new MutableValueModel<Visit>();\n private _inVisitUpdate = new Guard();\n\n interactionContext?: InteractionContext;\n\n canDeactivate?(interactionContext: InteractionContext): boolean | Promise<boolean>;\n\n constructor() {\n super();\n }\n\n // @Trace()\n public initialiseVisit(visit: Visit, notifyVisitChanged: (current: Visit, previous:Visit) => void) {\n assert.isNil(this.visitModel.value);\n\n const { when } = Dsl.disposeWith(this);\n\n this.visitModel.value = visit;\n DebugContext.get(this.visitModel).tag(`${this.placeDefinition.component.name}.visitModel`);\n this.placeDefinition.getVisitParameterDefs().forEach(parameterDef => this.installBinding(parameterDef));\n when.valueOf(this.visitModel).changes((current,previous) => {\n notifyVisitChanged(current, previous);\n }, {unless: this._inVisitUpdate});\n }\n\n public updateVisit(visit: Visit) {\n assert.isTruthy(this.isInitialised());\n assert.notNil(visit);\n this._inVisitUpdate.whileTrue(() => {\n this.visitModel.value = visit;\n });\n }\n\n isInitialised() {\n return !!this.visitModel.value;\n }\n\n // @Trace()\n private installBinding<T, S>(parameterDef: ParameterDefinition<T, S>) {\n const model = this[parameterDef.propertyName] as IMutableHasValue<S>;\n DebugContext.tag(model, `${this.placeDefinition.component.name}.${parameterDef.propertyName}`);\n const binding = this.registerDisposable(new Binding(this.visitModel, model, {\n toRight(visit: Visit): S {\n const value = visit.getParameter(parameterDef.name);\n // console.log('push to component', { name: parameterDef.name, value, visit });\n return value;\n },\n toLeft(value: S, currentVisit?: Visit): Visit {\n // console.log('push to route', { name: parameterDef.name, value, currentVisit });\n return currentVisit.replace(parameterDef, value);\n }\n }));\n\n binding.writeRight();\n }\n\n @Memoize()\n get placeDefinition(): PlaceDefinition {\n return PlaceComponent.getDefinition(this.constructor as any as Constructable<PlaceComponent>);\n }\n\n get childPlaces(): Constructable<PlaceComponent>[] {\n return this.placeDefinition.children.map(d => d.component);\n }\n\n onPlaceReady() {\n }\n\n}\n\nexport namespace PlaceComponent {\n\n export function isPlaceComponentConstructor(target: any): target is Constructable<PlaceComponent> {\n return lang.constructorChain(target as Constructable<any>).includes(PlaceComponent);\n }\n\n export function getRouteParameters(klass: Constructable<PlaceComponent>): ParameterDefinition<any>[] {\n return Klass.get(klass).getMetadataList(ROUTE_PARAMETER_LIST_KEY) as ParameterDefinition<any>[];\n }\n\n export function getDefinition(klass: Constructable<PlaceComponent>): PlaceDefinition {\n return Reflect.getMetadata(DEFINITION_META_DATA_KEY, klass);\n }\n\n export function injectDefinition(klass: Constructable<PlaceComponent>, definition: PlaceDefinition) {\n Reflect.defineMetadata(DEFINITION_META_DATA_KEY, definition, klass);\n }\n\n}\n"]}
|