UNPKG

@progress/kendo-angular-treeview

Version:
45 lines (44 loc) 2.44 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Injectable, ComponentFactoryResolver } from '@angular/core'; import { dataItemsEqual, isPresent } from '../../utils'; import { DropHintComponent } from './drop-hint.component'; import { DragAndDropAssetService } from '../editing-services/drag-and-drop-asset.service'; import * as i0 from "@angular/core"; /** * @hidden */ export class DropHintService extends DragAndDropAssetService { componentFactoryResolver; constructor(componentFactoryResolver) { super(); this.componentFactoryResolver = componentFactoryResolver; } initialize(container, template) { if (isPresent(this._componentRef)) { this.ngOnDestroy(); } const hintComponentFactory = this.componentFactoryResolver.resolveComponentFactory(DropHintComponent); this.componentRef = container.createComponent(hintComponentFactory); this.hide(); this.componentRef.instance.template = template; this.componentRef.changeDetectorRef.detectChanges(); } updateDropHintData(action, sourceItem, destinationItem) { const dropHint = this.componentRef.instance; if (action === dropHint.action && dataItemsEqual(sourceItem, dropHint.sourceItem) && dataItemsEqual(destinationItem, dropHint.destinationItem)) { return; } dropHint.action = action; dropHint.sourceItem = sourceItem; dropHint.destinationItem = destinationItem; dropHint.detectChanges(); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropHintService, deps: [{ token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropHintService }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropHintService, decorators: [{ type: Injectable }], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }]; } });