ag-grid-enterprise
Version:
Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
81 lines (80 loc) • 3.49 kB
TypeScript
import type { DragAndDropIcon, DragItem, DragSourceType, DropTarget, GridDraggingEvent } from 'ag-grid-community';
import { Component } from 'ag-grid-community';
import type { PillDragComp } from './pillDragComp';
export interface PillDropZonePanelParams {
emptyMessage?: string;
title?: string;
icon?: Element;
}
export declare abstract class PillDropZonePanel<TPill extends PillDragComp<TItem>, TItem> extends Component {
protected readonly horizontal: boolean;
protected readonly eWrapperPanel?: HTMLElement | undefined;
private state;
private dropTarget;
private potentialDndItems;
private readonly guiDestroyFunctions;
private params;
private readonly childPillComponents;
private insertIndex;
private readonly ePillDropList;
private positionableFeature;
private resizeEnabled;
protected abstract isItemDroppable(item: TItem, draggingEvent: GridDraggingEvent): boolean;
protected abstract updateItems(items: TItem[]): void;
protected abstract getExistingItems(): TItem[];
protected abstract getIconName(): DragAndDropIcon;
protected abstract getAriaLabel(): string;
protected abstract createPillComponent(item: TItem, dropTarget: DropTarget, ghost: boolean, horizontal: boolean): TPill;
protected abstract getItems(dragItem: DragItem<TItem>): TItem[];
protected abstract isInterestedIn(type: DragSourceType, sourceElement: Element): boolean;
constructor(horizontal: boolean, eWrapperPanel?: HTMLElement | undefined);
toggleResizable(resizable: boolean): void;
protected isSourceEventFromTarget(draggingEvent: GridDraggingEvent): boolean;
destroy(): void;
private destroyGui;
init(params?: PillDropZonePanelParams): void;
private onTabKeyDown;
private onFocusIn;
private onKeyDown;
private moveFocusedItem;
protected getItemMoveIndex(comp: TPill, isPrevious: boolean): number | null;
protected moveItem(comp: TPill, isPrevious: boolean): void;
protected addElementClasses(el: Element, suffix?: string): void;
private setupDropTarget;
protected minimumAllowedNewInsertIndex(): number;
private checkInsertIndex;
private normalizeAndUpdateInsertIndex;
private getNewInsertIndex;
private checkDragStartedBySelf;
private onDragging;
protected handleDragEnterEnd(_: GridDraggingEvent): void;
private onDragEnter;
protected isPotentialDndItems(): boolean;
protected handleDragLeaveEnd(_: GridDraggingEvent): void;
private onDragLeave;
private onDragCancel;
private onDragStop;
/**
* Drop the given items from the model. Overridden where re-deriving the whole list would not be equivalent
* to a removal — a row-group/pivot list re-seats a source col's hierarchy levels, so an omitted level
* would come straight back.
*/
protected removeItemsFromModel(_itemsToRemove: TItem[], remainingItems: TItem[]): void;
private removeItems;
private addItems;
addItem(item: TItem): void;
private rearrangeItems;
refreshGui(): void;
private getFocusedItem;
private focusItemAtIndex;
private restoreFocus;
focusList(fromBottom?: boolean): void;
private getNonGhostItems;
private addItemsToGui;
private addAriaLabelsToComponents;
protected createItemComponent(item: TItem, ghost: boolean): TPill;
private addIconAndTitleToGui;
private isExistingItemsEmpty;
private addEmptyMessageToGui;
private addArrow;
}