ui-framework-jps
Version:
A simple UI framework for state management and UI components
73 lines (72 loc) • 4.33 kB
TypeScript
import { CollectionView } from "../interface/CollectionView";
import { AbstractView } from "./AbstractView";
import { CollectionViewDOMConfig, CollectionViewSorter, CollectionViewSorterDirection, Modifier } from "../../ConfigurationTypes";
import { CollectionViewRenderer } from "../interface/CollectionViewRenderer";
import { CollectionViewEventHandler } from "../interface/CollectionViewEventHandler";
import { CollectionViewListener } from "../interface/CollectionViewListener";
import { CollectionViewEventDelegate } from "../interface/CollectionViewEventDelegate";
import { CollectionFilter } from "../../../filter/Types";
export declare type CollectionBuffer = {
name: string;
values: any[];
};
export declare abstract class AbstractCollectionView extends AbstractView implements CollectionView, CollectionViewEventHandler {
protected collectionName: string;
protected renderer: CollectionViewRenderer | null;
protected selectedItem: any | null;
protected collectionUIConfig: CollectionViewDOMConfig;
protected eventHandlerDelegate: CollectionViewEventDelegate;
protected filter: CollectionFilter | null;
protected sorterConfig: CollectionViewSorter | null;
protected onlyDisplayWithFilter: boolean;
protected buffers: CollectionBuffer[];
protected constructor(uiConfig: CollectionViewDOMConfig, collectionName: string);
abstract getIdForItemInNamedCollection(name: string, item: any): string;
abstract getItemInNamedCollection(name: string, compareWith: any): any;
abstract renderDisplayForItemInNamedCollection(containerEl: HTMLElement, name: string, item: any): void;
abstract getItemDescription(from: string, item: any): string;
abstract hasActionPermission(actionName: string, from: string, item: any): boolean;
abstract setFieldValue(objectId: string, fieldId: string, value: any): void;
abstract getDisplayedCollection(): any[];
render(): void;
clearDisplay(): void;
eventStartDrag(event: DragEvent): void;
eventClickItem(event: MouseEvent): void;
eventDeleteClickItem(event: MouseEvent): void;
eventActionClicked(event: MouseEvent): void;
getCollectionName(): string;
getItemId(from: string, item: any): string;
getCollectionUIConfig(): CollectionViewDOMConfig;
addEventCollectionListener(listener: CollectionViewListener): void;
setContainedBy(container: HTMLElement): void;
onDocumentLoaded(): void;
renderBackgroundForItemInNamedCollection(containerEl: HTMLElement, name: string, item: any): void;
compareItemsForEquality(item1: any, item2: any): boolean;
getModifierForItemInNamedCollection(name: string, item: any): Modifier;
getSecondaryModifierForItemInNamedCollection(name: string, item: any): Modifier;
getBadgeValueForItemInNamedCollection(name: string, item: any): number;
getBackgroundImageForItemInNamedCollection(name: string, item: any): string;
updateViewForNamedCollection(name: string, newState: any): void;
hasPermissionToDeleteItemInNamedCollection(name: string, item: any): boolean;
hasPermissionToUpdateItemInNamedCollection(name: string, item: any): boolean;
hasPermissionForActionOnItemInNamedCollection(actionName: string, name: string, item: any): boolean;
setRenderer(renderer: CollectionViewRenderer): void;
getSecondaryBadgeValueForItemInNamedCollection(name: string, item: any): number;
getTertiaryBadgeValueForItemInNamedCollection(name: string, item: any): number;
applyDefaultSort(item1: any, item2: any): number;
getItemIcons(name: string, item: any): string[];
prependItemIcons(name: string, item: any): boolean;
applyFilter(filter: CollectionFilter): void;
applySorter(sorter: CollectionViewSorter): void;
clearFilter(): void;
clearSorter(): void;
hasFilter(): boolean;
getCurrentFilter(): CollectionFilter | null;
hasSorter(): boolean;
setOnlyDisplayWithFilter(onlyDisplayWithFilter: boolean): void;
protected setBufferForName(name: string, values: any[]): void;
protected getBufferForName(name: string): any[];
protected useFieldSorter(item1: any, item2: any, fieldId: string, direction: CollectionViewSorterDirection): number;
protected useSorter(item1: any, item2: any): number;
protected getFilteredState(currentState: any): any[];
}