@coolon/angular-ui-powerups 1.3.3 → 1.3.5
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 +14 -0
- package/bundles/coolon-angular-ui-powerups.umd.js +39 -35
- 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 +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +1 -1
- package/esm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/esm2015/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/components/components.module.js +2 -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/focus-container/focus-container.component.js +4 -2
- package/esm2015/lib/components/focus-container/focus-container.component.js.map +1 -1
- package/esm2015/lib/components/focus-container/focus-container.component.metadata.json +1 -1
- package/esm2015/lib/components/focusable.component.js +4 -4
- package/esm2015/lib/components/focusable.component.js.map +1 -1
- package/esm2015/lib/components/focusable.component.metadata.json +1 -1
- package/esm2015/lib/directives/focus-binding-factory.js +30 -0
- package/esm2015/lib/directives/focus-binding-factory.js.map +1 -0
- package/esm2015/lib/directives/focus-binding-factory.metadata.json +1 -0
- package/esm2015/lib/directives/focus-binding-factory.ngfactory.js.map +1 -0
- package/esm2015/lib/directives/focus-binding.js +1 -25
- package/esm2015/lib/directives/focus-binding.js.map +1 -1
- package/esm2015/lib/directives/index.js +1 -0
- package/esm2015/lib/directives/index.js.map +1 -1
- package/esm2015/lib/directives/index.metadata.json +1 -1
- package/esm5/coolon-angular-ui-powerups.js +1 -1
- package/esm5/coolon-angular-ui-powerups.js.map +1 -1
- package/esm5/lib/components/components.module.js +2 -2
- package/esm5/lib/components/components.module.js.map +1 -1
- package/esm5/lib/components/focus-container/focus-container.component.js +10 -6
- package/esm5/lib/components/focus-container/focus-container.component.js.map +1 -1
- package/esm5/lib/components/focusable.component.js +4 -4
- package/esm5/lib/components/focusable.component.js.map +1 -1
- package/esm5/lib/directives/focus-binding-factory.js +31 -0
- package/esm5/lib/directives/focus-binding-factory.js.map +1 -0
- package/esm5/lib/directives/focus-binding-factory.ngfactory.js.map +1 -0
- package/esm5/lib/directives/focus-binding.js +1 -26
- package/esm5/lib/directives/focus-binding.js.map +1 -1
- package/esm5/lib/directives/index.js +1 -0
- package/esm5/lib/directives/index.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +31 -31
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +37 -35
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/focus-container/focus-container.component.d.ts +2 -1
- package/lib/components/focusable.component.d.ts +2 -2
- package/lib/directives/focus-binding-factory.d.ts +9 -0
- package/lib/directives/focus-binding.d.ts +1 -9
- package/lib/directives/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __extends, __metadata } from "tslib";
|
|
2
2
|
import { Component, ElementRef, HostBinding, HostListener } from '@angular/core';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Dsl, FocusManager } from '@coolon/pectin';
|
|
4
|
+
import { FocusBindingFactory } from '../directives/focus-binding-factory';
|
|
5
5
|
import { DisposableComponent } from './disposable-component';
|
|
6
6
|
var FocusableComponent = /** @class */ (function (_super) {
|
|
7
7
|
__extends(FocusableComponent, _super);
|
|
@@ -41,7 +41,7 @@ var FocusableComponent = /** @class */ (function (_super) {
|
|
|
41
41
|
FocusableComponent.ctorParameters = function () { return [
|
|
42
42
|
{ type: ElementRef },
|
|
43
43
|
{ type: FocusManager },
|
|
44
|
-
{ type:
|
|
44
|
+
{ type: FocusBindingFactory }
|
|
45
45
|
]; };
|
|
46
46
|
__decorate([
|
|
47
47
|
HostBinding('attr.tabindex'),
|
|
@@ -62,7 +62,7 @@ var FocusableComponent = /** @class */ (function (_super) {
|
|
|
62
62
|
], FocusableComponent.prototype, "onBlur", null);
|
|
63
63
|
FocusableComponent = __decorate([
|
|
64
64
|
Component({ template: '' }),
|
|
65
|
-
__metadata("design:paramtypes", [ElementRef, FocusManager,
|
|
65
|
+
__metadata("design:paramtypes", [ElementRef, FocusManager, FocusBindingFactory])
|
|
66
66
|
], FocusableComponent);
|
|
67
67
|
return FocusableComponent;
|
|
68
68
|
}(DisposableComponent));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focusable.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/focusable.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEjF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"focusable.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/focusable.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEjF,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D;IAAwC,sCAAmB;IAmBzD,4BAA+B,EAAc,EAAW,YAA0B,EAAE,mBAAwC;QAA5H,YACE,iBAAO,SAMR;QAP8B,QAAE,GAAF,EAAE,CAAY;QAAW,kBAAY,GAAZ,YAAY,CAAc;QAE1E,IAAA,2BAAkF,EAAhF,gBAAK,EAAE,oBAAO,EAAE,kBAAM,EAAE,cAAI,EAAE,gBAAK,EAAE,oBAAO,EAAE,sBAAkC,CAAC;QACzF,IAAI,KAAI,CAAC,YAAY,EAAE;YACrB,KAAI,CAAC,aAAa,GAAG,KAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,KAAI,CAAC,CAAC;YAC/D,KAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,aAAa,CAAC,EAAE,EAAE,KAAI,CAAC,YAAY,CAAC,CAAC,CAAC;SACnF;;IACH,CAAC;IArBD,sBAAI,yCAAS;aAAb;YACE,OAAO,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7C,CAAC;;;OAAA;IAGD,oCAAO,GAAP;;QACE,MAAA,IAAI,CAAC,YAAY,0CAAE,aAAa,GAAG;IACrC,CAAC;IAGD,mCAAM,GAAN;;QACE,MAAA,IAAI,CAAC,YAAY,0CAAE,cAAc,GAAG;IACtC,CAAC;IAWD,sBAAI,4CAAY;aAAhB;YACE,OAAO,IAAI,CAAC,aAAa,CAAC;QAC5B,CAAC;;;OAAA;;gBAXkC,UAAU;gBAAyB,YAAY;gBAAuB,mBAAmB;;IAd5H;QADC,WAAW,CAAC,eAAe,CAAC;;;uDAG5B;IAGD;QADC,YAAY,CAAC,OAAO,CAAC;;;;qDAGrB;IAGD;QADC,YAAY,CAAC,MAAM,CAAC;;;;oDAGpB;IAjBU,kBAAkB;QAD9B,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;yCAoBS,UAAU,EAAyB,YAAY,EAAuB,mBAAmB;OAnBjH,kBAAkB,CAgC9B;IAAD,yBAAC;CAAA,AAhCD,CAAwC,mBAAmB,GAgC1D;SAhCY,kBAAkB","sourcesContent":["import { Component, ElementRef, HostBinding, HostListener } from '@angular/core';\n\nimport { Dsl, FocusManager } from '@coolon/pectin';\nimport { FocusBindingFactory } from '../directives/focus-binding-factory';\nimport { DisposableComponent } from './disposable-component';\n\n@Component({ template: '' })\nexport class FocusableComponent extends DisposableComponent {\n\n private _focusContext: FocusManager.Context;\n\n @HostBinding('attr.tabindex')\n get focusable() {\n return !!this.focusContext ? 0 : undefined;\n }\n\n @HostListener('focus')\n onFocus() {\n this.focusContext?.notifyFocusIn();\n }\n\n @HostListener('blur')\n onBlur() {\n this.focusContext?.notifyFocusOut();\n }\n\n constructor(protected readonly el: ElementRef, readonly focusManager: FocusManager, focusBindingFactory: FocusBindingFactory) {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n if (this.focusManager) {\n this._focusContext = this.focusManager.registerFocusable(this);\n this.registerDisposable(focusBindingFactory.createBinding(el, this.focusContext));\n }\n }\n\n get focusContext(): FocusManager.Context {\n return this._focusContext;\n }\n\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { __decorate, __metadata, __param } from "tslib";
|
|
2
|
+
import { DOCUMENT } from '@angular/common';
|
|
3
|
+
import { ElementRef, Inject, Injectable, NgZone } from '@angular/core';
|
|
4
|
+
import { FocusBinding } from './focus-binding';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
import * as i1 from "@angular/common";
|
|
7
|
+
var FocusBindingFactory = /** @class */ (function () {
|
|
8
|
+
function FocusBindingFactory(ngZone, document) {
|
|
9
|
+
this.ngZone = ngZone;
|
|
10
|
+
// @see https://stackoverflow.com/questions/49513359/could-not-resolve-type-document-in-angular5/53715642#53715642
|
|
11
|
+
this.document = document;
|
|
12
|
+
}
|
|
13
|
+
FocusBindingFactory.prototype.createBinding = function (el, focusContext) {
|
|
14
|
+
return new FocusBinding(el.nativeElement, this.ngZone, this.document, focusContext);
|
|
15
|
+
};
|
|
16
|
+
FocusBindingFactory.ctorParameters = function () { return [
|
|
17
|
+
{ type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
|
|
18
|
+
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
|
|
19
|
+
]; };
|
|
20
|
+
FocusBindingFactory.ɵprov = i0.ɵɵdefineInjectable({ factory: function FocusBindingFactory_Factory() { return new FocusBindingFactory(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i1.DOCUMENT)); }, token: FocusBindingFactory, providedIn: "root" });
|
|
21
|
+
FocusBindingFactory = __decorate([
|
|
22
|
+
Injectable({
|
|
23
|
+
providedIn: 'root'
|
|
24
|
+
}),
|
|
25
|
+
__param(0, Inject(NgZone)), __param(1, Inject(DOCUMENT)),
|
|
26
|
+
__metadata("design:paramtypes", [NgZone, Object])
|
|
27
|
+
], FocusBindingFactory);
|
|
28
|
+
return FocusBindingFactory;
|
|
29
|
+
}());
|
|
30
|
+
export { FocusBindingFactory };
|
|
31
|
+
//# sourceMappingURL=focus-binding-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-binding-factory.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/directives/focus-binding-factory.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;;;AAK/C;IAIE,6BAA6C,MAAc,EAAoB,QAAa;QAA/C,WAAM,GAAN,MAAM,CAAQ;QACzD,kHAAkH;QAClH,IAAI,CAAC,QAAQ,GAAG,QAAoB,CAAC;IACvC,CAAC;IAED,2CAAa,GAAb,UAAc,EAAc,EAAE,YAAkC;QAC9D,OAAO,IAAI,YAAY,CAAC,EAAE,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACtF,CAAC;;gBAPoD,MAAM,uBAA9C,MAAM,SAAC,MAAM;gDAAoC,MAAM,SAAC,QAAQ;;;IAJlE,mBAAmB;QAH/B,UAAU,CAAC;YACV,UAAU,EAAE,MAAM;SACnB,CAAC;QAKa,WAAA,MAAM,CAAC,MAAM,CAAC,CAAA,EAAmC,WAAA,MAAM,CAAC,QAAQ,CAAC,CAAA;yCAAzB,MAAM;OAJhD,mBAAmB,CAY/B;8BApBD;CAoBC,AAZD,IAYC;SAZY,mBAAmB","sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { ElementRef, Inject, Injectable, NgZone } from '@angular/core';\nimport { FocusManager } from '@coolon/pectin';\nimport { FocusBinding } from './focus-binding';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FocusBindingFactory {\n\n private document: Document;\n\n constructor(@Inject(NgZone) private readonly ngZone: NgZone, @Inject(DOCUMENT) document: any) {\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 createBinding(el: ElementRef, focusContext: FocusManager.Context): FocusBinding {\n return new FocusBinding(el.nativeElement, this.ngZone, this.document, focusContext);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-binding-factory.ngfactory.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/directives/focus-binding-factory.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __extends, __metadata, __param } from "tslib";
|
|
2
2
|
import { DOCUMENT } from '@angular/common';
|
|
3
|
-
import {
|
|
3
|
+
import { Inject, NgZone } from '@angular/core';
|
|
4
4
|
import { Dsl, FocusManager, GarbageCollector, Logger } from '@coolon/pectin';
|
|
5
5
|
var FocusBinding = /** @class */ (function (_super) {
|
|
6
6
|
__extends(FocusBinding, _super);
|
|
@@ -84,29 +84,4 @@ var FocusBinding = /** @class */ (function (_super) {
|
|
|
84
84
|
return FocusBinding;
|
|
85
85
|
}(GarbageCollector));
|
|
86
86
|
export { FocusBinding };
|
|
87
|
-
(function (FocusBinding) {
|
|
88
|
-
var Factory = /** @class */ (function () {
|
|
89
|
-
function Factory(ngZone, document) {
|
|
90
|
-
this.ngZone = ngZone;
|
|
91
|
-
// @see https://stackoverflow.com/questions/49513359/could-not-resolve-type-document-in-angular5/53715642#53715642
|
|
92
|
-
this.document = document;
|
|
93
|
-
}
|
|
94
|
-
Factory.prototype.createBinding = function (el, focusContext) {
|
|
95
|
-
return new FocusBinding(el.nativeElement, this.ngZone, this.document, focusContext);
|
|
96
|
-
};
|
|
97
|
-
Factory.ctorParameters = function () { return [
|
|
98
|
-
{ type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
|
|
99
|
-
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
|
|
100
|
-
]; };
|
|
101
|
-
Factory = __decorate([
|
|
102
|
-
Injectable({
|
|
103
|
-
providedIn: 'root'
|
|
104
|
-
}),
|
|
105
|
-
__param(0, Inject(NgZone)), __param(1, Inject(DOCUMENT)),
|
|
106
|
-
__metadata("design:paramtypes", [NgZone, Object])
|
|
107
|
-
], Factory);
|
|
108
|
-
return Factory;
|
|
109
|
-
}());
|
|
110
|
-
FocusBinding.Factory = Factory;
|
|
111
|
-
})(FocusBinding || (FocusBinding = {}));
|
|
112
87
|
//# sourceMappingURL=focus-binding.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focus-binding.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/directives/focus-binding.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"focus-binding.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/directives/focus-binding.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAc,MAAM,EAAc,MAAM,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,GAAG,EAAE,YAAY,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@angular/common';\nimport { ElementRef, Inject, Injectable, NgZone } from '@angular/core';\nimport { Dsl, FocusManager, GarbageCollector, Logger } from '@coolon/pectin';\n\nexport class FocusBinding extends GarbageCollector {\n\n private readonly document: Document;\n\n constructor(private readonly focusTargetElement: HTMLElement,\n @Inject(NgZone) private readonly ngZone: NgZone,\n @Inject(DOCUMENT) document: any,\n readonly focusContext: FocusManager.Context) {\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 // TODO: Make this also track the current enabled/disabled state.\n const { when } = Dsl.disposeWith(this);\n when.valueOf(this.focusContext.focused).changes((focused) => {\n if (focused && !this.alreadyHasFocus()) {\n this.tryAndFocus();\n }\n }, { initialValue: 'triggerChangeUnlessNil' });\n }\n\n onFocusIn() {\n this.focusContext.notifyFocusIn();\n }\n\n onFocusOut() {\n this.focusContext.notifyFocusOut();\n }\n\n // Hook method for debugging via tracing.\n alreadyHasFocus() {\n return this.isElementFocused(this.focusTarget);\n }\n\n // Hook method for debugging via tracing.\n isElementFocused(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.focusTargetElement;\n }\n\n // Hook method for debugging via tracing.\n modelShouldStillHaveFocus() {\n return this.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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/directives/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./command.directive\";\nexport * from \"./directives.module\";\nexport * from \"./focus-binding.directive\";\nexport * from \"./focus-binding\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/directives/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./command.directive\";\nexport * from \"./directives.module\";\nexport * from \"./focus-binding-factory\";\nexport * from \"./focus-binding.directive\";\nexport * from \"./focus-binding\";\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param, __awaiter } from 'tslib';
|
|
2
2
|
import { DOCUMENT, CommonModule, Location } from '@angular/common';
|
|
3
|
-
import { ElementRef, Inject, Input, HostListener, Directive, NgZone, NgModule, Injectable, Host, HostBinding, Component, EventEmitter, Output, ContentChild, TemplateRef, ChangeDetectorRef, ContentChildren, QueryList, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren,
|
|
3
|
+
import { ElementRef, Inject, Input, HostListener, Directive, NgZone, NgModule, ɵɵdefineInjectable, ɵɵinject, Injectable, Host, HostBinding, Component, EventEmitter, Output, ContentChild, TemplateRef, ChangeDetectorRef, ContentChildren, QueryList, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Optional, SkipSelf } from '@angular/core';
|
|
4
4
|
import { FormsModule } from '@angular/forms';
|
|
5
5
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
6
6
|
import { MatInputModule } from '@angular/material/input';
|
|
@@ -349,33 +349,33 @@ FocusBinding = __decorate([
|
|
|
349
349
|
__metadata("design:paramtypes", [HTMLElement,
|
|
350
350
|
NgZone, Object, Object])
|
|
351
351
|
], FocusBinding);
|
|
352
|
-
(function (FocusBinding) {
|
|
353
|
-
let Factory = class Factory {
|
|
354
|
-
constructor(ngZone, document) {
|
|
355
|
-
this.ngZone = ngZone;
|
|
356
|
-
// @see https://stackoverflow.com/questions/49513359/could-not-resolve-type-document-in-angular5/53715642#53715642
|
|
357
|
-
this.document = document;
|
|
358
|
-
}
|
|
359
|
-
createBinding(el, focusContext) {
|
|
360
|
-
return new FocusBinding(el.nativeElement, this.ngZone, this.document, focusContext);
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
Factory.ctorParameters = () => [
|
|
364
|
-
{ type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
|
|
365
|
-
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
|
|
366
|
-
];
|
|
367
|
-
Factory = __decorate([
|
|
368
|
-
Injectable({
|
|
369
|
-
providedIn: 'root'
|
|
370
|
-
}),
|
|
371
|
-
__param(0, Inject(NgZone)), __param(1, Inject(DOCUMENT)),
|
|
372
|
-
__metadata("design:paramtypes", [NgZone, Object])
|
|
373
|
-
], Factory);
|
|
374
|
-
FocusBinding.Factory = Factory;
|
|
375
|
-
})(FocusBinding || (FocusBinding = {}));
|
|
376
352
|
|
|
377
|
-
let
|
|
353
|
+
let FocusBindingFactory = class FocusBindingFactory {
|
|
354
|
+
constructor(ngZone, document) {
|
|
355
|
+
this.ngZone = ngZone;
|
|
356
|
+
// @see https://stackoverflow.com/questions/49513359/could-not-resolve-type-document-in-angular5/53715642#53715642
|
|
357
|
+
this.document = document;
|
|
358
|
+
}
|
|
359
|
+
createBinding(el, focusContext) {
|
|
360
|
+
return new FocusBinding(el.nativeElement, this.ngZone, this.document, focusContext);
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
FocusBindingFactory.ctorParameters = () => [
|
|
364
|
+
{ type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
|
|
365
|
+
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
|
|
366
|
+
];
|
|
367
|
+
FocusBindingFactory.ɵprov = ɵɵdefineInjectable({ factory: function FocusBindingFactory_Factory() { return new FocusBindingFactory(ɵɵinject(NgZone), ɵɵinject(DOCUMENT)); }, token: FocusBindingFactory, providedIn: "root" });
|
|
368
|
+
FocusBindingFactory = __decorate([
|
|
369
|
+
Injectable({
|
|
370
|
+
providedIn: 'root'
|
|
371
|
+
}),
|
|
372
|
+
__param(0, Inject(NgZone)), __param(1, Inject(DOCUMENT)),
|
|
373
|
+
__metadata("design:paramtypes", [NgZone, Object])
|
|
374
|
+
], FocusBindingFactory);
|
|
375
|
+
|
|
376
|
+
let FocusContainerComponent = class FocusContainerComponent extends DisposableComponent {
|
|
378
377
|
constructor(focusManager) {
|
|
378
|
+
super();
|
|
379
379
|
this.focusManager = focusManager;
|
|
380
380
|
this.tabIndex = -1;
|
|
381
381
|
}
|
|
@@ -389,7 +389,7 @@ FocusContainerComponent.ctorParameters = () => [
|
|
|
389
389
|
{ type: FocusManager, decorators: [{ type: Host }] }
|
|
390
390
|
];
|
|
391
391
|
__decorate([
|
|
392
|
-
HostBinding(
|
|
392
|
+
HostBinding('attr.tabindex'),
|
|
393
393
|
__metadata("design:type", Object)
|
|
394
394
|
], FocusContainerComponent.prototype, "tabIndex", void 0);
|
|
395
395
|
__decorate([
|
|
@@ -440,7 +440,7 @@ let FocusableComponent = class FocusableComponent extends DisposableComponent {
|
|
|
440
440
|
FocusableComponent.ctorParameters = () => [
|
|
441
441
|
{ type: ElementRef },
|
|
442
442
|
{ type: FocusManager },
|
|
443
|
-
{ type:
|
|
443
|
+
{ type: FocusBindingFactory }
|
|
444
444
|
];
|
|
445
445
|
__decorate([
|
|
446
446
|
HostBinding('attr.tabindex'),
|
|
@@ -461,7 +461,7 @@ __decorate([
|
|
|
461
461
|
], FocusableComponent.prototype, "onBlur", null);
|
|
462
462
|
FocusableComponent = __decorate([
|
|
463
463
|
Component({ template: '' }),
|
|
464
|
-
__metadata("design:paramtypes", [ElementRef, FocusManager,
|
|
464
|
+
__metadata("design:paramtypes", [ElementRef, FocusManager, FocusBindingFactory])
|
|
465
465
|
], FocusableComponent);
|
|
466
466
|
|
|
467
467
|
let AbstractInputComponent = class AbstractInputComponent extends DisposableComponent {
|
|
@@ -955,7 +955,7 @@ ComponentsModule = __decorate([
|
|
|
955
955
|
FocusableComponent
|
|
956
956
|
],
|
|
957
957
|
providers: [
|
|
958
|
-
|
|
958
|
+
FocusBindingFactory
|
|
959
959
|
]
|
|
960
960
|
})
|
|
961
961
|
], ComponentsModule);
|
|
@@ -4260,5 +4260,5 @@ function VisitParameterList(options) {
|
|
|
4260
4260
|
* Generated bundle index. Do not edit.
|
|
4261
4261
|
*/
|
|
4262
4262
|
|
|
4263
|
-
export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractInputComponent, AbstractInteractionContext, AbstractPlaceNavigationComponent, AbstractPopStateNavigation, Activity, ActivityContainerComponent, ActivityOutletComponent, ActivityRef, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CheckboxInputComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionContext, DialogInteractionContextFactory, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, EventCleanUpSession, FocusBinding, FocusBindingDirective, FocusContainerComponent, FocusableComponent, Formatter, InPlaceInteractionContextComponent, InteractionModule, InteractionService, InteractionServiceRoutingAdapter, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ModalInteractionContextFactory, Navigating, NavigatingDuringInteraction, NavigationContext, NavigationSession, NoopAuthGuard, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceGuard, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, PopStateDuringInteractionNavigation, PopStateNavigation, ROUTE_PARAMETER_LIST_KEY, RemoveLastInteractionFromUrlNavigationSession, ResizeAwareComponent, RouteId, ScrollContainerComponent, SelectInputComponent, StringInputComponent, SwitchCaseComponent, SwitchCaseDefaultDirective, SwitchCaseOption, SwitchCaseWhenDirective, SynchroniseInteractionContextIdsWithRoute, TabbedPlaceNavigationComponent, UrlService, UrlSnapshot, Visit, VisitParameter, VisitParameterList, VisitSanitiser, WaitUntilLeavingInteractionTransitionCancelled, WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish, WaitUntilPopStateDuringCanDeactivateInteractionFinishes, leftRightPlaceAnimation, slideDownOnEnterAnimation, slideRightOnEnterAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, AUP_PLACE_CONFIG as ɵba, PlaceRouter as ɵbc, InteractionService as ɵbd, ModalInteractionContextFactory as ɵbe, UrlService as ɵbf, PlaceHistory as ɵbg, TabbedPlaceNavigationComponent as ɵbh, AbstractPlaceNavigationComponent as ɵbi, ListPlaceNavComponent as ɵbj, InteractionModule as ɵbk, ActivityContainerComponent as ɵbl, AbstractInteractionContext as ɵbm, ActivityOutletComponent as ɵbn, ConfirmationDialogComponent as ɵbo, ACTIVITY_DATA as ɵbp, Activity as ɵbq, ConfirmThenDialogComponent as ɵbs, AlertDialogComponent as ɵbt, InPlaceInteractionContextComponent as ɵbv, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, CheckboxInputComponent as ɵk, ScrollContainerComponent as ɵl, NoopComponent as ɵm, SwitchCaseOption as ɵn, SwitchCaseWhenDirective as ɵo, SwitchCaseDefaultDirective as ɵp, SwitchCaseComponent as ɵq, FocusContainerComponent as ɵr, FocusableComponent as ɵs,
|
|
4263
|
+
export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractInputComponent, AbstractInteractionContext, AbstractPlaceNavigationComponent, AbstractPopStateNavigation, Activity, ActivityContainerComponent, ActivityOutletComponent, ActivityRef, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CheckboxInputComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionContext, DialogInteractionContextFactory, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, EventCleanUpSession, FocusBinding, FocusBindingDirective, FocusBindingFactory, FocusContainerComponent, FocusableComponent, Formatter, InPlaceInteractionContextComponent, InteractionModule, InteractionService, InteractionServiceRoutingAdapter, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ModalInteractionContextFactory, Navigating, NavigatingDuringInteraction, NavigationContext, NavigationSession, NoopAuthGuard, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceGuard, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, PopStateDuringInteractionNavigation, PopStateNavigation, ROUTE_PARAMETER_LIST_KEY, RemoveLastInteractionFromUrlNavigationSession, ResizeAwareComponent, RouteId, ScrollContainerComponent, SelectInputComponent, StringInputComponent, SwitchCaseComponent, SwitchCaseDefaultDirective, SwitchCaseOption, SwitchCaseWhenDirective, SynchroniseInteractionContextIdsWithRoute, TabbedPlaceNavigationComponent, UrlService, UrlSnapshot, Visit, VisitParameter, VisitParameterList, VisitSanitiser, WaitUntilLeavingInteractionTransitionCancelled, WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish, WaitUntilPopStateDuringCanDeactivateInteractionFinishes, leftRightPlaceAnimation, slideDownOnEnterAnimation, slideRightOnEnterAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, AUP_PLACE_CONFIG as ɵba, PlaceRouter as ɵbc, InteractionService as ɵbd, ModalInteractionContextFactory as ɵbe, UrlService as ɵbf, PlaceHistory as ɵbg, TabbedPlaceNavigationComponent as ɵbh, AbstractPlaceNavigationComponent as ɵbi, ListPlaceNavComponent as ɵbj, InteractionModule as ɵbk, ActivityContainerComponent as ɵbl, AbstractInteractionContext as ɵbm, ActivityOutletComponent as ɵbn, ConfirmationDialogComponent as ɵbo, ACTIVITY_DATA as ɵbp, Activity as ɵbq, ConfirmThenDialogComponent as ɵbs, AlertDialogComponent as ɵbt, InPlaceInteractionContextComponent as ɵbv, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, CheckboxInputComponent as ɵk, ScrollContainerComponent as ɵl, NoopComponent as ɵm, SwitchCaseOption as ɵn, SwitchCaseWhenDirective as ɵo, SwitchCaseDefaultDirective as ɵp, SwitchCaseComponent as ɵq, FocusContainerComponent as ɵr, FocusableComponent as ɵs, FocusBindingFactory as ɵt, PlaceModule as ɵu, EmptyStateComponent as ɵv, BusyOverlayComponent as ɵw, PlaceOutletComponent as ɵx, leftRightPlaceAnimation as ɵy, LEFT_RIGHT_PLACE_ANIMATION as ɵz };
|
|
4264
4264
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|