@tinkoff/ng-polymorpheus
Advanced tools
Comparing version 4.0.1 to 4.0.2
@@ -47,3 +47,3 @@ (function (global, factory) { | ||
} | ||
PolymorpheusComponent.prototype.createInjector = function (injector, context) { | ||
PolymorpheusComponent.prototype.createInjector = function (injector, useValue) { | ||
return i0.Injector.create({ | ||
@@ -54,3 +54,3 @@ parent: this.injector || injector, | ||
provide: POLYMORPHEUS_CONTEXT, | ||
useValue: context, | ||
useValue: useValue, | ||
}, | ||
@@ -101,2 +101,6 @@ ], | ||
/** | ||
* @deprecated: use {@link PolymorpheusContext} instead | ||
* Primitive types used as content by {@link PolymorpheusOutletDirective} | ||
*/ | ||
var PrimitiveContext = /** @class */ (function () { | ||
@@ -115,2 +119,15 @@ function PrimitiveContext($implicit) { | ||
}()); | ||
var PolymorpheusContext = /** @class */ (function () { | ||
function PolymorpheusContext($implicit) { | ||
this.$implicit = $implicit; | ||
} | ||
Object.defineProperty(PolymorpheusContext.prototype, "polymorpheusOutlet", { | ||
get: function () { | ||
return this.$implicit; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
return PolymorpheusContext; | ||
}()); | ||
@@ -134,5 +151,5 @@ var PolymorpheusOutletDirective = /** @class */ (function () { | ||
}); | ||
PolymorpheusOutletDirective.prototype.ngOnChanges = function (_a) { | ||
PolymorpheusOutletDirective.prototype.ngOnChanges = function (_b) { | ||
var _this = this; | ||
var content = _a.content; | ||
var content = _b.content; | ||
if (this.viewRef) { | ||
@@ -149,5 +166,6 @@ this.viewRef.context = this.getContext(); | ||
if (isComponent(this.content)) { | ||
var proxy = new Proxy(this.context, { | ||
get: function (_, key) { return _this.context[key]; }, | ||
}); | ||
var proxy = this.context && | ||
new Proxy(this.context, { | ||
get: function (_, key) { var _a; return (_a = _this.context) === null || _a === void 0 ? void 0 : _a[key]; }, | ||
}); | ||
var injector = this.content.createInjector(this.injector, proxy); | ||
@@ -168,8 +186,12 @@ var componentFactory = injector | ||
}; | ||
PolymorpheusOutletDirective.ngTemplateContextGuard = function (_dir, _ctx) { | ||
return true; | ||
}; | ||
PolymorpheusOutletDirective.prototype.getContext = function () { | ||
return isTemplate(this.content) | ||
? this.context | ||
: new PrimitiveContext(typeof this.content === 'function' | ||
? this.content(this.context) | ||
: this.content); | ||
if (isTemplate(this.content) || isComponent(this.content)) { | ||
return this.context; | ||
} | ||
return new PolymorpheusContext(typeof this.content === 'function' | ||
? this.content(this.context) | ||
: this.content); | ||
}; | ||
@@ -176,0 +198,0 @@ return PolymorpheusOutletDirective; |
@@ -12,3 +12,3 @@ import { Injector, Type } from '@angular/core'; | ||
constructor(component: Type<T>, injector?: Injector | null); | ||
createInjector(injector: Injector, context: C): Injector; | ||
createInjector(injector: Injector, useValue?: C): Injector; | ||
} |
import { DoCheck, Injector, OnChanges, SimpleChanges, TemplateRef, ViewContainerRef } from '@angular/core'; | ||
import { PrimitiveContext } from '../classes/primitive-context'; | ||
import { PolymorpheusContext } from '../classes/context'; | ||
import { PolymorpheusContent } from '../types/content'; | ||
@@ -12,7 +12,8 @@ import * as i0 from "@angular/core"; | ||
content: PolymorpheusContent<C>; | ||
context: C; | ||
constructor(viewContainerRef: ViewContainerRef, injector: Injector, templateRef: TemplateRef<PrimitiveContext>); | ||
context?: C; | ||
constructor(viewContainerRef: ViewContainerRef, injector: Injector, templateRef: TemplateRef<PolymorpheusContext<string>>); | ||
private get template(); | ||
ngOnChanges({ content }: SimpleChanges): void; | ||
ngDoCheck(): void; | ||
static ngTemplateContextGuard<T>(_dir: PolymorpheusOutletDirective<T>, _ctx: any): _ctx is PolymorpheusContext<string>; | ||
private getContext; | ||
@@ -19,0 +20,0 @@ static ɵfac: i0.ɵɵFactoryDeclaration<PolymorpheusOutletDirective<any>, never>; |
@@ -14,3 +14,3 @@ import { Injector } from '@angular/core'; | ||
} | ||
createInjector(injector, context) { | ||
createInjector(injector, useValue) { | ||
return Injector.create({ | ||
@@ -21,3 +21,3 @@ parent: this.injector || injector, | ||
provide: POLYMORPHEUS_CONTEXT, | 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sYXNzIGZvciBhIGNvbXBvbmVudCB0aGF0IHdpbGwgYmUgdXNlZCBhcyBjb250ZW50IGZvciB7QGxpbmsgUG9seW1vcnBoZXVzT3V0bGV0RGlyZWN0aXZlfVxyXG4gKlxyXG4gKiBAcGFyYW0gY29tcG9uZW50IOKAlCBhbiBBbmd1bGFyIGNvbXBvbmVudCB0byBiZSBkeW5hbWljYWxseSBjcmVhdGVkXHJcbiAqIEBwYXJhbSBpbmplY3RvciDigJQgb3B0aW9uYWwge0BsaW5rIEluamVjdG9yfSBmb3IgbGF6eSBsb2FkZWQgbW9kdWxlIGNhc2VcclxuICovXHJcbmV4cG9ydCBjbGFzcyBQb2x5bW9ycGhldXNDb21wb25lbnQ8VCwgQyBleHRlbmRzIFJlY29yZDxhbnksIGFueT4+IHtcclxuICAgIGNvbnN0cnVjdG9yKFxyXG4gICAgICAgIHJlYWRvbmx5IGNvbXBvbmVudDogVHlwZTxUPixcclxuICAgICAgICBwcml2YXRlIHJlYWRvbmx5IGluamVjdG9yOiBJbmplY3RvciB8IG51bGwgPSBudWxsLFxyXG4gICAgKSB7fVxyXG5cclxuICAgIGNyZWF0ZUluamVjdG9yKGluamVjdG9yOiBJbmplY3RvciwgY29udGV4dDogQyk6IEluamVjdG9yIHtcclxuICAgICAgICByZXR1cm4gSW5qZWN0b3IuY3JlYXRlKHtcclxuICAgICAgICAgICAgcGFyZW50OiB0aGlzLmluamVjdG9yIHx8IGluamVjdG9yLFxyXG4gICAgICAgICAgICBwcm92aWRlcnM6IFtcclxuICAgICAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgICAgICBwcm92aWRlOiBQT0xZTU9SUEhFVVNfQ09OVEVYVCxcclxuICAgICAgICAgICAgICAgICAgICB1c2VWYWx1ZTogY29udGV4dCxcclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgIF0sXHJcbiAgICAgICAgfSk7XHJcbiAgICB9XHJcbn1cclxuIl19 | ||
//# sourceMappingURL=data:application/json;base64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ldERpcmVjdGl2ZX1cclxuICpcclxuICogQHBhcmFtIGNvbXBvbmVudCDigJQgYW4gQW5ndWxhciBjb21wb25lbnQgdG8gYmUgZHluYW1pY2FsbHkgY3JlYXRlZFxyXG4gKiBAcGFyYW0gaW5qZWN0b3Ig4oCUIG9wdGlvbmFsIHtAbGluayBJbmplY3Rvcn0gZm9yIGxhenkgbG9hZGVkIG1vZHVsZSBjYXNlXHJcbiAqL1xyXG5leHBvcnQgY2xhc3MgUG9seW1vcnBoZXVzQ29tcG9uZW50PFQsIEMgZXh0ZW5kcyBSZWNvcmQ8YW55LCBhbnk+PiB7XHJcbiAgICBjb25zdHJ1Y3RvcihcclxuICAgICAgICByZWFkb25seSBjb21wb25lbnQ6IFR5cGU8VD4sXHJcbiAgICAgICAgcHJpdmF0ZSByZWFkb25seSBpbmplY3RvcjogSW5qZWN0b3IgfCBudWxsID0gbnVsbCxcclxuICAgICkge31cclxuXHJcbiAgICBjcmVhdGVJbmplY3RvcihpbmplY3RvcjogSW5qZWN0b3IsIHVzZVZhbHVlPzogQyk6IEluamVjdG9yIHtcclxuICAgICAgICByZXR1cm4gSW5qZWN0b3IuY3JlYXRlKHtcclxuICAgICAgICAgICAgcGFyZW50OiB0aGlzLmluamVjdG9yIHx8IGluamVjdG9yLFxyXG4gICAgICAgICAgICBwcm92aWRlcnM6IFtcclxuICAgICAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgICAgICBwcm92aWRlOiBQT0xZTU9SUEhFVVNfQ09OVEVYVCxcclxuICAgICAgICAgICAgICAgICAgICB1c2VWYWx1ZSxcclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgIF0sXHJcbiAgICAgICAgfSk7XHJcbiAgICB9XHJcbn1cclxuIl19 |
import { ChangeDetectorRef, ComponentFactoryResolver, Directive, Input, TemplateRef, } from '@angular/core'; | ||
import { PolymorpheusComponent } from '../classes/component'; | ||
import { PrimitiveContext } from '../classes/primitive-context'; | ||
import { PolymorpheusContext } from '../classes/context'; | ||
import { PolymorpheusTemplate } from './template'; | ||
@@ -31,5 +31,6 @@ import * as i0 from "@angular/core"; | ||
if (isComponent(this.content)) { | ||
const proxy = new Proxy(this.context, { | ||
get: (_, key) => this.context[key], | ||
}); | ||
const proxy = this.context && | ||
new Proxy(this.context, { | ||
get: (_, key) => { var _a; return (_a = this.context) === null || _a === void 0 ? void 0 : _a[key]; }, | ||
}); | ||
const injector = this.content.createInjector(this.injector, proxy); | ||
@@ -50,8 +51,12 @@ const componentFactory = injector | ||
} | ||
static ngTemplateContextGuard(_dir, _ctx) { | ||
return true; | ||
} | ||
getContext() { | ||
return isTemplate(this.content) | ||
? this.context | ||
: new PrimitiveContext(typeof this.content === 'function' | ||
? this.content(this.context) | ||
: this.content); | ||
if (isTemplate(this.content) || isComponent(this.content)) { | ||
return this.context; | ||
} | ||
return new PolymorpheusContext(typeof this.content === 'function' | ||
? this.content(this.context) | ||
: this.content); | ||
} | ||
@@ -82,2 +87,2 @@ } | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0bGV0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvbmctcG9seW1vcnBoZXVzL3NyYy9kaXJlY3RpdmVzL291dGxldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0gsaUJBQWlCLEVBQ2pCLHdCQUF3QixFQUV4QixTQUFTLEVBSVQsS0FBSyxFQUdMLFdBQVcsR0FFZCxNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQUMscUJBQXFCLEVBQUMsTUFBTSxzQkFBc0IsQ0FBQztBQUMzRCxPQUFPLEVBQUMsZ0JBQWdCLEVBQUMsTUFBTSw4QkFBOEIsQ0FBQztBQUU5RCxPQUFPLEVBQUMsb0JBQW9CLEVBQUMsTUFBTSxZQUFZLENBQUM7O0FBS2hELE1BQ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xyXG4gICAgICAgIHByaXZhdGUgcmVhZG9ubHkgaW5qZWN0b3I6IEluamVjdG9yLFxyXG4gICAgICAgIHByaXZhdGUgcmVhZG9ubHkgdGVtcGxhdGVSZWY6IFRlbXBsYXRlUmVmPFByaW1pdGl2ZUNvbnRleHQ+LFxyXG4gICAgKSB7fVxyXG5cclxuICAgIHByaXZhdGUgZ2V0IHRlbXBsYXRlKCk6IFRlbXBsYXRlUmVmPHVua25vd24+IHtcclxuICAgICAgICBpZiAoaXNEaXJlY3RpdmUodGhpcy5jb250ZW50KSkge1xyXG4gICAgICAgICAgICByZXR1cm4gdGhpcy5jb250ZW50LnRlbXBsYXRlO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgcmV0dXJuIHRoaXMuY29udGVudCBpbnN0YW5jZW9mIFRlbXBsYXRlUmVmID8gdGhpcy5jb250ZW50IDogdGhpcy50ZW1wbGF0ZVJlZjtcclxuICAgIH1cclxuXHJcbiAgICBuZ09uQ2hhbmdlcyh7Y29udGVudH06IFNpbXBsZUNoYW5nZXMpIHtcclxuICAgICAgICBpZiAodGhpcy52aWV3UmVmKSB7XHJcbiAgICAgICAgICAgIHRoaXMudmlld1JlZi5jb250ZXh0ID0gdGhpcy5nZXRDb250ZXh0KCk7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBpZiAodGhpcy5jb21wb25lbnRSZWYpIHtcclxuICAgICAgICAgICAgdGhpcy5jb21wb25lbnRSZWYuaW5qZWN0b3IuZ2V0KENoYW5nZURldGVjdG9yUmVmKS5tYXJrRm9yQ2hlY2soKTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGlmICghY29udGVudCkge1xyXG4gICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICB0aGlzLnZpZXdDb250YWluZXJSZWYuY2xlYXIoKTtcclxuXHJcbiAgICAgICAgaWYgKGlzQ29tcG9uZW50KHRoaXMuY29udGVudCkpIHtcclxuICAgICAgICAgICAgY29uc3QgcHJveHkgPSBuZXcgUHJveHkodGhpcy5jb250ZXh0LCB7XHJcbiAgICAgICAgICAgICAgICBnZXQ6IChfLCBrZXkpID0+IHRoaXMuY29udGV4dFtrZXkgYXMga2V5b2YgQ10sXHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBjb25zdCBpbmplY3RvciA9IHRoaXMuY29udGVudC5jcmVhdGVJbmplY3Rvcih0aGlzLmluamVjdG9yLCBwcm94eSk7XHJcbiAgICAgICAgICAgIGNvbnN0IGNvbXBvbmVudEZhY3RvcnkgPSBpbmplY3RvclxyXG4gICAgICAgICAgICAgICAgLmdldChDb21wb25lbnRGYWN0b3J5UmVzb2x2ZXIpXHJcbiAgICAgICAgICAgICAgICAucmVzb2x2ZUNvbXBvbmVudEZhY3RvcnkodGhpcy5jb250ZW50LmNvbXBvbmVudCk7XHJcblxyXG4gICAgICAgICAgICB0aGlzLmNvbXBvbmVudFJlZiA9IHRoaXMudmlld0NvbnRhaW5lclJlZi5jcmVhdGVDb21wb25lbnQoXHJcbiAgICAgICAgICAgICAgICBjb21wb25lbnRGYWN0b3J5LFxyXG4gICAgICAgICAgICAgICAgMCxcclxuICAgICAgICAgICAgICAgIGluamVjdG9yLFxyXG4gICAgICAgICAgICApO1xyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgIHRoaXMudmlld1JlZiA9IHRoaXMudmlld0NvbnRhaW5lclJlZi5jcmVhdGVFbWJlZGRlZFZpZXcoXHJcbiAgICAgICAgICAgICAgICB0aGlzLnRlbXBsYXRlLFxyXG4gICAgICAgICAgICAgICAgdGhpcy5nZXRDb250ZXh0KCksXHJcbiAgICAgICAgICAgICk7XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG5cclxuICAgIG5nRG9DaGVjaygpIHtcclxuICAgICAgICBpZiAoaXNEaXJlY3RpdmUodGhpcy5jb250ZW50KSkge1xyXG4gICAgICAgICAgICB0aGlzLmNvbnRlbnQuY2hlY2soKTtcclxuICAgICAgICB9XHJcbiAgICB9XHJcblxyXG4gICAgcHJpdmF0ZSBnZXRDb250ZXh0KCk6IHVua25vd24ge1xyXG4gICAgICAgIHJldHVybiBpc1RlbXBsYXRlKHRoaXMuY29udGVudClcclxuICAgICAgICAgICAgPyB0aGlzLmNvbnRleHRcclxuICAgICAgICAgICAgOiBuZXcgUHJpbWl0aXZlQ29udGV4dChcclxuICAgICAgICAgICAgICAgICAgdHlwZW9mIHRoaXMuY29udGVudCA9PT0gJ2Z1bmN0aW9uJ1xyXG4gICAgICAgICAgICAgICAgICAgICAgPyB0aGlzLmNvbnRlbnQodGhpcy5jb250ZXh0KVxyXG4gICAgICAgICAgICAgICAgICAgICAgOiB0aGlzLmNvbnRlbnQsXHJcbiAgICAgICAgICAgICAgKTtcclxuICAgIH1cclxufVxyXG5cclxuZnVuY3Rpb24gaXNEaXJlY3RpdmU8QyBleHRlbmRzIFJlY29yZDxhbnksIGFueT4+KFxyXG4gICAgY29udGVudDogUG9seW1vcnBoZXVzQ29udGVudDxDPixcclxuKTogY29udGVudCBpcyBQb2x5bW9ycGhldXNUZW1wbGF0ZTxDPiB7XHJcbiAgICByZXR1cm4gY29udGVudCBpbnN0YW5jZW9mIFBvbHltb3JwaGV1c1RlbXBsYXRlO1xyXG59XHJcblxyXG5mdW5jdGlvbiBpc0NvbXBvbmVudDxDIGV4dGVuZHMgUmVjb3JkPGFueSwgYW55Pj4oXHJcbiAgICBjb250ZW50OiBQb2x5bW9ycGhldXNDb250ZW50PEM+LFxyXG4pOiBjb250ZW50IGlzIFBvbHltb3JwaGV1c0NvbXBvbmVudDxhbnksIEM+IHtcclxuICAgIHJldHVybiBjb250ZW50IGluc3RhbmNlb2YgUG9seW1vcnBoZXVzQ29tcG9uZW50O1xyXG59XHJcblxyXG5mdW5jdGlvbiBpc1RlbXBsYXRlPEMgZXh0ZW5kcyBSZWNvcmQ8YW55LCBhbnk+PihcclxuICAgIGNvbnRlbnQ6IFBvbHltb3JwaGV1c0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lZjxQb2x5bW9ycGhldXNDb250ZXh0PHN0cmluZz4+LFxyXG4gICAgKSB7fVxyXG5cclxuICAgIHByaXZhdGUgZ2V0IHRlbXBsYXRlKCk6IFRlbXBsYXRlUmVmPHVua25vd24+IHtcclxuICAgICAgICBpZiAoaXNEaXJlY3RpdmUodGhpcy5jb250ZW50KSkge1xyXG4gICAgICAgICAgICByZXR1cm4gdGhpcy5jb250ZW50LnRlbXBsYXRlO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgcmV0dXJuIHRoaXMuY29udGVudCBpbnN0YW5jZW9mIFRlbXBsYXRlUmVmID8gdGhpcy5jb250ZW50IDogdGhpcy50ZW1wbGF0ZVJlZjtcclxuICAgIH1cclxuXHJcbiAgICBuZ09uQ2hhbmdlcyh7Y29udGVudH06IFNpbXBsZUNoYW5nZXMpIHtcclxuICAgICAgICBpZiAodGhpcy52aWV3UmVmKSB7XHJcbiAgICAgICAgICAgIHRoaXMudmlld1JlZi5jb250ZXh0ID0gdGhpcy5nZXRDb250ZXh0KCk7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBpZiAodGhpcy5jb21wb25lbnRSZWYpIHtcclxuICAgICAgICAgICAgdGhpcy5jb21wb25lbnRSZWYuaW5qZWN0b3IuZ2V0KENoYW5nZURldGVjdG9yUmVmKS5tYXJrRm9yQ2hlY2soKTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGlmICghY29udGVudCkge1xyXG4gICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICB0aGlzLnZpZXdDb250YWluZXJSZWYuY2xlYXIoKTtcclxuXHJcbiAgICAgICAgaWYgKGlzQ29tcG9uZW50KHRoaXMuY29udGVudCkpIHtcclxuICAgICAgICAgICAgY29uc3QgcHJveHkgPVxyXG4gICAgICAgICAgICAgICAgdGhpcy5jb250ZXh0ICYmXHJcbiAgICAgICAgICAgICAgICBuZXcgUHJveHkodGhpcy5jb250ZXh0LCB7XHJcbiAgICAgICAgICAgICAgICAgICAgZ2V0OiAoXywga2V5KSA9PiB0aGlzLmNvbnRleHQ/LltrZXkgYXMga2V5b2YgQ10sXHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgY29uc3QgaW5qZWN0b3IgPSB0aGlzLmNvbnRlbnQuY3JlYXRlSW5qZWN0b3IodGhpcy5pbmplY3RvciwgcHJveHkpO1xyXG4gICAgICAgICAgICBjb25zdCBjb21wb25lbnRGYWN0b3J5ID0gaW5qZWN0b3JcclxuICAgICAgICAgICAgICAgIC5nZXQoQ29tcG9uZW50RmFjdG9yeVJlc29sdmVyKVxyXG4gICAgICAgICAgICAgICAgLnJlc29sdmVDb21wb25lbnRGYWN0b3J5KHRoaXMuY29udGVudC5jb21wb25lbnQpO1xyXG5cclxuICAgICAgICAgICAgdGhpcy5jb21wb25lbnRSZWYgPSB0aGlzLnZpZXdDb250YWluZXJSZWYuY3JlYXRlQ29tcG9uZW50KFxyXG4gICAgICAgICAgICAgICAgY29tcG9uZW50RmFjdG9yeSxcclxuICAgICAgICAgICAgICAgIDAsXHJcbiAgICAgICAgICAgICAgICBpbmplY3RvcixcclxuICAgICAgICAgICAgKTtcclxuICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICB0aGlzLnZpZXdSZWYgPSB0aGlzLnZpZXdDb250YWluZXJSZWYuY3JlYXRlRW1iZWRkZWRWaWV3KFxyXG4gICAgICAgICAgICAgICAgdGhpcy50ZW1wbGF0ZSxcclxuICAgICAgICAgICAgICAgIHRoaXMuZ2V0Q29udGV4dCgpLFxyXG4gICAgICAgICAgICApO1xyXG4gICAgICAgIH1cclxuICAgIH1cclxuXHJcbiAgICBuZ0RvQ2hlY2soKSB7XHJcbiAgICAgICAgaWYgKGlzRGlyZWN0aXZlKHRoaXMuY29udGVudCkpIHtcclxuICAgICAgICAgICAgdGhpcy5jb250ZW50LmNoZWNrKCk7XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG5cclxuICAgIHN0YXRpYyBuZ1RlbXBsYXRlQ29udGV4dEd1YXJkPFQ+KFxyXG4gICAgICAgIF9kaXI6IFBvbHltb3JwaGV1c091dGxldERpcmVjdGl2ZTxUPixcclxuICAgICAgICBfY3R4OiBhbnksXHJcbiAgICApOiBfY3R4IGlzIFBvbHltb3JwaGV1c0NvbnRleHQ8c3RyaW5nPiB7XHJcbiAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICB9XHJcblxyXG4gICAgcHJpdmF0ZSBnZXRDb250ZXh0KCk6IHVua25vd24ge1xyXG4gICAgICAgIGlmIChpc1RlbXBsYXRlKHRoaXMuY29udGVudCkgfHwgaXNDb21wb25lbnQodGhpcy5jb250ZW50KSkge1xyXG4gICAgICAgICAgICByZXR1cm4gdGhpcy5jb250ZXh0O1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgcmV0dXJuIG5ldyBQb2x5bW9ycGhldXNDb250ZXh0KFxyXG4gICAgICAgICAgICB0eXBlb2YgdGhpcy5jb250ZW50ID09PSAnZnVuY3Rpb24nXHJcbiAgICAgICAgICAgICAgICA/IHRoaXMuY29udGVudCh0aGlzLmNvbnRleHQhKVxyXG4gICAgICAgICAgICAgICAgOiB0aGlzLmNvbnRlbnQsXHJcbiAgICAgICAgKTtcclxuICAgIH1cclxufVxyXG5cclxuZnVuY3Rpb24gaXNEaXJlY3RpdmU8QyBleHRlbmRzIFJlY29yZDxhbnksIGFueT4+KFxyXG4gICAgY29udGVudDogUG9seW1vcnBoZXVzQ29udGVudDxDPixcclxuKTogY29udGVudCBpcyBQb2x5bW9ycGhldXNUZW1wbGF0ZTxDPiB7XHJcbiAgICByZXR1cm4gY29udGVudCBpbnN0YW5jZW9mIFBvbHltb3JwaGV1c1RlbXBsYXRlO1xyXG59XHJcblxyXG5mdW5jdGlvbiBpc0NvbXBvbmVudDxDIGV4dGVuZHMgUmVjb3JkPGFueSwgYW55Pj4oXHJcbiAgICBjb250ZW50OiBQb2x5bW9ycGhldXNDb250ZW50PEM+LFxyXG4pOiBjb250ZW50IGlzIFBvbHltb3JwaGV1c0NvbXBvbmVudDxhbnksIEM+IHtcclxuICAgIHJldHVybiBjb250ZW50IGluc3RhbmNlb2YgUG9seW1vcnBoZXVzQ29tcG9uZW50O1xyXG59XHJcblxyXG5mdW5jdGlvbiBpc1RlbXBsYXRlPEMgZXh0ZW5kcyBSZWNvcmQ8YW55LCBhbnk+PihcclxuICAgIGNvbnRlbnQ6IFBvbHltb3JwaGV1c0NvbnRlbnQ8Qz4sXHJcbik6IGNvbnRlbnQgaXMgUG9seW1vcnBoZXVzVGVtcGxhdGU8Qz4gfCBUZW1wbGF0ZVJlZjxDPiB7XHJcbiAgICByZXR1cm4gaXNEaXJlY3RpdmUoY29udGVudCkgfHwgY29udGVudCBpbnN0YW5jZW9mIFRlbXBsYXRlUmVmO1xyXG59XHJcbiJdfQ== |
@@ -21,3 +21,3 @@ import * as i0 from '@angular/core'; | ||
} | ||
createInjector(injector, context) { | ||
createInjector(injector, useValue) { | ||
return Injector.create({ | ||
@@ -28,3 +28,3 @@ parent: this.injector || injector, | ||
provide: POLYMORPHEUS_CONTEXT, | ||
useValue: context, | ||
useValue, | ||
}, | ||
@@ -71,2 +71,6 @@ ], | ||
/** | ||
* @deprecated: use {@link PolymorpheusContext} instead | ||
* Primitive types used as content by {@link PolymorpheusOutletDirective} | ||
*/ | ||
class PrimitiveContext { | ||
@@ -80,2 +84,10 @@ constructor($implicit) { | ||
} | ||
class PolymorpheusContext { | ||
constructor($implicit) { | ||
this.$implicit = $implicit; | ||
} | ||
get polymorpheusOutlet() { | ||
return this.$implicit; | ||
} | ||
} | ||
@@ -107,5 +119,6 @@ class PolymorpheusOutletDirective { | ||
if (isComponent(this.content)) { | ||
const proxy = new Proxy(this.context, { | ||
get: (_, key) => this.context[key], | ||
}); | ||
const proxy = this.context && | ||
new Proxy(this.context, { | ||
get: (_, key) => { var _a; return (_a = this.context) === null || _a === void 0 ? void 0 : _a[key]; }, | ||
}); | ||
const injector = this.content.createInjector(this.injector, proxy); | ||
@@ -126,8 +139,12 @@ const componentFactory = injector | ||
} | ||
static ngTemplateContextGuard(_dir, _ctx) { | ||
return true; | ||
} | ||
getContext() { | ||
return isTemplate(this.content) | ||
? this.context | ||
: new PrimitiveContext(typeof this.content === 'function' | ||
? this.content(this.context) | ||
: this.content); | ||
if (isTemplate(this.content) || isComponent(this.content)) { | ||
return this.context; | ||
} | ||
return new PolymorpheusContext(typeof this.content === 'function' | ||
? this.content(this.context) | ||
: this.content); | ||
} | ||
@@ -134,0 +151,0 @@ } |
{ | ||
"name": "@tinkoff/ng-polymorpheus", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"peerDependencies": { | ||
@@ -5,0 +5,0 @@ "@angular/core": ">=12.0.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97954
746