UNPKG

@progress/kendo-angular-treeview

Version:
131 lines (128 loc) 5.64 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, HostBinding, ChangeDetectorRef, ChangeDetectionStrategy } from "@angular/core"; import { DropAction } from '../models'; import { cancelIcon, insertBottomIcon, insertMiddleIcon, insertTopIcon, plusIcon } from "@progress/kendo-svg-icons"; import { NgIf, NgTemplateOutlet } from "@angular/common"; import { IconWrapperComponent } from "@progress/kendo-angular-icons"; import * as i0 from "@angular/core"; /** * @hidden */ export class DragClueComponent { cdr; hostClasses = true; /** * The text value of the dragged TreeView item. */ text; /** * The attempted operation according to the current drop target. */ action; /** * The look-up info for the currently dragged item. */ sourceItem; /** * The look-up info for the destination item (if hovering a valid drop target). */ destinationItem; /** * Defines the drag clue content template. */ template; posistionStyle = 'fixed'; get statusIconClass() { switch (this.action) { case DropAction.Add: return 'plus'; case DropAction.InsertTop: return 'insert-top'; case DropAction.InsertBottom: return 'insert-bottom'; case DropAction.InsertMiddle: return 'insert-middle'; case DropAction.Invalid: default: return 'cancel'; } } get statusSVGIcon() { switch (this.action) { case DropAction.Add: return plusIcon; case DropAction.InsertTop: return insertTopIcon; case DropAction.InsertBottom: return insertBottomIcon; case DropAction.InsertMiddle: return insertMiddleIcon; case DropAction.Invalid: default: return cancelIcon; } } constructor(cdr) { this.cdr = cdr; } // exposed as a public method that can be called from outside as the component uses `OnPush` strategy detectChanges() { this.cdr.detectChanges(); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DragClueComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DragClueComponent, isStandalone: true, selector: "kendo-treeview-drag-clue", host: { properties: { "class.k-header": "this.hostClasses", "class.k-drag-clue": "this.hostClasses", "style.position": "this.posistionStyle" } }, ngImport: i0, template: ` <ng-container *ngIf="!template"> <kendo-icon-wrapper innerCssClass="k-drag-status" [name]="statusIconClass" [svgIcon]="statusSVGIcon" > </kendo-icon-wrapper> <span>{{text}}</span> </ng-container> <ng-template *ngIf="template" [ngTemplateOutlet]="template" [ngTemplateOutletContext]="{ text: text, action: action, sourceItem: sourceItem, destinationItem: destinationItem }" > </ng-template> `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DragClueComponent, decorators: [{ type: Component, args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'kendo-treeview-drag-clue', template: ` <ng-container *ngIf="!template"> <kendo-icon-wrapper innerCssClass="k-drag-status" [name]="statusIconClass" [svgIcon]="statusSVGIcon" > </kendo-icon-wrapper> <span>{{text}}</span> </ng-container> <ng-template *ngIf="template" [ngTemplateOutlet]="template" [ngTemplateOutletContext]="{ text: text, action: action, sourceItem: sourceItem, destinationItem: destinationItem }" > </ng-template> `, standalone: true, imports: [NgIf, IconWrapperComponent, NgTemplateOutlet] }] }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { hostClasses: [{ type: HostBinding, args: ['class.k-header'] }, { type: HostBinding, args: ['class.k-drag-clue'] }], posistionStyle: [{ type: HostBinding, args: ['style.position'] }] } });