Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private injectorFor(data:any) {
const injectorTokens = new WeakMap();
// Pass the service because otherwise we're getting a cyclic dependency between the portal
// host service and the bound portal
data.service = this;
injectorTokens.set(OpQueryConfigurationLocalsToken, data);
return new PortalInjector(this.injector, injectorTokens);
}
private createInjector(
customTokens: WeakMap,
control: ConfirmationControl
): PortalInjector {
const injectionTokens = customTokens || new WeakMap();
injectionTokens.set(ConfirmationControl, control);
return new PortalInjector(this.injector, injectionTokens);
}
private attachOverlayContainer(overlayRef, overlayRefWrapper, injectionTokens: WeakMap) {
const injector = new PortalInjector(this._injector, injectionTokens);
const overlayPortal = new ComponentPortal(this._component, null, injector);
const overlayPortalRef: ComponentRef = overlayRef.attach(overlayPortal);
return overlayPortalRef.instance;
}
}
private createInjector>(
config: NoteSnippetEditorConfig,
ref: NoteSnippetEditorRef,
): PortalInjector {
const injectionTokens = new WeakMap([
[NoteSnippetEditorRef, ref],
[NoteSnippetEditorConfig, config],
]);
return new PortalInjector(this.injector, injectionTokens);
}
private createInjector( config: OwlDialogConfig, dialogRef: OwlDialogRef, dialogContainer: OwlDialogContainerComponent ) {
const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
const injectionTokens = new WeakMap();
injectionTokens.set(OwlDialogRef, dialogRef);
injectionTokens.set(OwlDialogContainerComponent, dialogContainer);
injectionTokens.set(OWL_DIALOG_DATA, config.data);
return new PortalInjector(userInjector || this.injector, injectionTokens);
}
private createInjector(message: MessageObject, messageRef: MessageOverlayRef) {
const injectionTokens = new WeakMap();
injectionTokens.set(MessageOverlayRef, messageRef);
injectionTokens.set(MESSAGE_OBJECT_DATA, message.data);
return new PortalInjector(this.injector, injectionTokens);
}
private _createInjector(
config: MatSnackBarConfig,
snackBarRef: MatSnackBarRef): PortalInjector {
const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
return new PortalInjector(userInjector || this._injector, new WeakMap([
[MatSnackBarRef, snackBarRef],
[MAT_SNACK_BAR_DATA, config.data]
]));
}
}
private createInjector(
customTokens: WeakMap,
control: ModalInstance
): PortalInjector {
const injectionTokens = customTokens || new WeakMap();
injectionTokens.set(ModalInstance, control);
return new PortalInjector(this.injector, injectionTokens);
}
overlayY: 'center'
};
config.positionStrategy = this.overlay.position().flexibleConnectedTo(target as HTMLElement)
.withPositions([connectedPosition]);
const overlayRef = this.overlay.create(config);
overlayRef.backdropClick().subscribe(() => {
overlayRef.dispose();
});
const injectionTokens = new WeakMap([
[EDIT_ATTRIBUTE_VALUE_PANEL_DATA, {
attributeValue: attribute.value
} as EditAttributeValuePanelData],
[OverlayRef, overlayRef]
]);
const injector = new PortalInjector(this.viewContainerRef.injector, injectionTokens);
const componentRef = overlayRef.attach(new ComponentPortal(EditAttributeValuePanelComponent,
this.viewContainerRef, injector));
componentRef.onDestroy(() => {
if (componentRef.instance.result !== null) {
const attributeValue = componentRef.instance.result;
const updatedAttribute = {...attribute};
updatedAttribute.value = attributeValue;
this.attributeService.saveEntityAttributes(this.entityIdValue,
this.attributeScope as AttributeScope, [updatedAttribute]).subscribe(
() => {
this.reloadAttributes();
}
);
}
});
}
protected createPortal(): ComponentPortal {
const injectionTokens = new WeakMap();
injectionTokens.set(ComponentLayerRef, this);
const portalInjector = new PortalInjector(this.injector, injectionTokens);
return new ComponentPortal(this.componentType, this.opts.viewContainerRef, portalInjector);
}