UNPKG

@progress/kendo-angular-common

Version:

Kendo UI for Angular - Utility Package

109 lines (104 loc) 5.66 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Component, ElementRef, HostBinding, Input, ViewChild } from '@angular/core'; import { watermarkStyles, bannerStyles, licenseKeyUrl, buttonStyles } from './utils'; import { isDocumentAvailable } from '../utils'; import { NgIf, NgStyle } from '@angular/common'; import * as i0 from "@angular/core"; let bannerPresentOnPage = false; /** * @hidden */ export class WatermarkOverlayComponent { watermarkStyle = watermarkStyles; licenseMessage; banner; isOpen = true; bannerMounted = false; bannerStyles = bannerStyles; buttonStyles = buttonStyles; licenseKeyUrl = licenseKeyUrl; ngOnInit() { if (!bannerPresentOnPage) { this.bannerMounted = true; bannerPresentOnPage = true; } } ngAfterViewInit() { if (this.isBannerRendered) { document.body.appendChild(this.banner.nativeElement); } } ngOnDestroy() { if (this.isBannerRendered) { document.body.removeChild(this.banner.nativeElement); } } closeBanner() { this.isOpen = false; } get isBannerRendered() { return isDocumentAvailable() && this.banner && this.banner.nativeElement; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WatermarkOverlayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: WatermarkOverlayComponent, isStandalone: true, selector: "div[kendoWatermarkOverlay]", inputs: { licenseMessage: "licenseMessage" }, host: { properties: { "style": "this.watermarkStyle" } }, viewQueries: [{ propertyName: "banner", first: true, predicate: ["banner"], descendants: true }], ngImport: i0, template: ` <div #banner *ngIf="isOpen && bannerMounted" [ngStyle]="bannerStyles"> <span [ngStyle]="{ display: 'flex', alignSelf: 'center', marginRight: '8px' }"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none"> <path fill-rule="evenodd" clip-rule="evenodd" d="M8 1L0 15H16L8 1ZM7 6V11H9V6H7ZM7 14V12H9V14H7Z" fill="#1E1E1E"/> </svg> </span> <span *ngIf="licenseMessage" [innerHtml]="licenseMessage"></span> <span *ngIf="!licenseMessage"> We couldn't verify your <a [href]="licenseKeyUrl">license key</a> for Kendo UI for Angular. Please see the browser console for details and resolution steps. </span> <div [ngStyle]="{ display: 'flex', alignItems: 'center', marginLeft: '24px' }"> <button title='Close' [ngStyle]="buttonStyles" (click)="closeBanner()"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none"> <path d="M13 4.41562L9.41563 8L13 11.5844L11.5844 13L8 9.41563L4.41562 13L3 11.5844L6.58437 8L3 4.41562L4.41562 3L8 6.58437L11.5844 3L13 4.41562Z" fill="#1E1E1E"/> </svg> </button> </div> </div> `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WatermarkOverlayComponent, decorators: [{ type: Component, args: [{ selector: 'div[kendoWatermarkOverlay]', template: ` <div #banner *ngIf="isOpen && bannerMounted" [ngStyle]="bannerStyles"> <span [ngStyle]="{ display: 'flex', alignSelf: 'center', marginRight: '8px' }"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none"> <path fill-rule="evenodd" clip-rule="evenodd" d="M8 1L0 15H16L8 1ZM7 6V11H9V6H7ZM7 14V12H9V14H7Z" fill="#1E1E1E"/> </svg> </span> <span *ngIf="licenseMessage" [innerHtml]="licenseMessage"></span> <span *ngIf="!licenseMessage"> We couldn't verify your <a [href]="licenseKeyUrl">license key</a> for Kendo UI for Angular. Please see the browser console for details and resolution steps. </span> <div [ngStyle]="{ display: 'flex', alignItems: 'center', marginLeft: '24px' }"> <button title='Close' [ngStyle]="buttonStyles" (click)="closeBanner()"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none"> <path d="M13 4.41562L9.41563 8L13 11.5844L11.5844 13L8 9.41563L4.41562 13L3 11.5844L6.58437 8L3 4.41562L4.41562 3L8 6.58437L11.5844 3L13 4.41562Z" fill="#1E1E1E"/> </svg> </button> </div> </div> `, standalone: true, imports: [NgIf, NgStyle] }] }], propDecorators: { watermarkStyle: [{ type: HostBinding, args: ['style'] }], licenseMessage: [{ type: Input }], banner: [{ type: ViewChild, args: ['banner'] }] } });