UNPKG

@progress/kendo-angular-common

Version:

Kendo UI for Angular - Utility Package

114 lines (107 loc) 6.79 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, 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; 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]", 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>No valid license found for Kendo UI for Angular. Learn how to activate your license.</span> <div [ngStyle]="{ display: 'flex', alignItems: 'center', marginLeft: '24px' }"> <a [href]="licenseKeyUrl" [ngStyle]="{marginRight: '8px', display: 'flex'}"> <button title='Learn More' [ngStyle]="buttonStyles"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none"> <path d="M15 8C15 11.8656 11.8656 15 8 15C4.13437 15 1 11.8656 1 8C1 4.13437 4.13437 1 8 1C11.8656 1 15 4.13437 15 8ZM14 8C14 4.6875 11.3125 2 8 2C4.6875 2 2 4.6875 2 8C2 11.3125 4.6875 14 8 14C11.3125 14 14 11.3125 14 8ZM11 6C11 7.4125 10.2687 8.05937 9.73125 8.53125C9.25937 8.94688 9 9.17813 9 10H7C7 8.275 7.84688 7.525 8.40938 7.03125C8.84062 6.65312 9 6.50938 9 6C9 5.45 8.55 5 8 5C7.45 5 7 5.45 7 6H5C5 4.34375 6.34375 3 8 3C9.65625 3 11 4.34375 11 6ZM9 13V11H7V13H9Z" fill="#1E1E1E"/> </svg> </button> </a> <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>No valid license found for Kendo UI for Angular. Learn how to activate your license.</span> <div [ngStyle]="{ display: 'flex', alignItems: 'center', marginLeft: '24px' }"> <a [href]="licenseKeyUrl" [ngStyle]="{marginRight: '8px', display: 'flex'}"> <button title='Learn More' [ngStyle]="buttonStyles"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none"> <path d="M15 8C15 11.8656 11.8656 15 8 15C4.13437 15 1 11.8656 1 8C1 4.13437 4.13437 1 8 1C11.8656 1 15 4.13437 15 8ZM14 8C14 4.6875 11.3125 2 8 2C4.6875 2 2 4.6875 2 8C2 11.3125 4.6875 14 8 14C11.3125 14 14 11.3125 14 8ZM11 6C11 7.4125 10.2687 8.05937 9.73125 8.53125C9.25937 8.94688 9 9.17813 9 10H7C7 8.275 7.84688 7.525 8.40938 7.03125C8.84062 6.65312 9 6.50938 9 6C9 5.45 8.55 5 8 5C7.45 5 7 5.45 7 6H5C5 4.34375 6.34375 3 8 3C9.65625 3 11 4.34375 11 6ZM9 13V11H7V13H9Z" fill="#1E1E1E"/> </svg> </button> </a> <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'] }], banner: [{ type: ViewChild, args: ['banner'] }] } });