UNPKG

@progress/kendo-angular-pivotgrid

Version:
74 lines (73 loc) 2.81 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 } from '@angular/core'; import * as i0 from "@angular/core"; /** * @hidden */ export const append = (element, container) => { let appended = false; return () => { if (!appended) { container.appendChild(element); appended = true; } return element; }; }; /** * @hidden */ export class DropCueService { dom; create() { this.dom = document.createElement('span'); const wrapper = document.createElement('div'); wrapper.classList.add('k-drop-hint', 'k-drop-hint-v'); const hintStart = document.createElement('div'); hintStart.classList.add('k-drop-hint-start'); const hintLine = document.createElement('div'); hintLine.classList.add('k-drop-hint-line'); const hintEnd = document.createElement('div'); hintEnd.classList.add('k-drop-hint-end'); wrapper.append(hintStart, hintLine, hintEnd); this.dom.append(wrapper); this.hide(); } attach(container) { return append(this.dom, container)(); } remove(container) { if (this.dom && this.dom.parentElement && container.contains(this.dom)) { container.removeChild(this.dom); this.dom = null; } } hide() { this.dom.style.display = 'none'; } show(direction, container, target) { if (!this.dom) { this.create(); } if (direction === 'before') { container.insertBefore(this.dom, target); } else { if (target.classList.contains('k-chip') && target.matches(':last-child')) { container.insertBefore(this.dom, target); return; } // eslint-disable-next-line no-unused-expressions target.classList.contains('k-chip') ? target.after(this.dom) : container.appendChild(this.dom); } this.dom.style.display = ''; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropCueService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropCueService }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropCueService, decorators: [{ type: Injectable }] });