import * as i0 from '@angular/core'; import { InjectionToken, ElementRef, TemplateRef, OnInit, OnDestroy, AfterContentInit, QueryList, OnChanges, AfterContentChecked, EventEmitter, SimpleChanges, PipeTransform, ComponentFactoryResolver } from '@angular/core'; import { Observable, Subscription } from 'rxjs'; import * as i17 from 'barsa-novin-ray-core'; import { BaseComponent, MetaobjectDataModel, ReportViewBaseComponent, UiReportViewBaseSetting, BaseModule, DynamicComponentService } from 'barsa-novin-ray-core'; import * as i12 from '@angular/router'; import { Router } from '@angular/router'; import * as i10 from '@angular/common'; import * as i11 from '@angular/forms'; import * as i13 from '@angular/cdk/drag-drop'; import * as i14 from '@angular/cdk/table'; import * as i15 from '@fundamental-ngx/core'; import * as i16 from '@fundamental-ngx/platform'; type CompactType = ('horizontal' | 'vertical') | null | undefined; /** * Client rect utilities. * This file is taken from Angular Material repository. */ interface KtdClientRect { top: number; bottom: number; left: number; right: number; width: number; height: number; } interface KtdGridLayoutItem { id: string; x: number; y: number; w: number; h: number; minW?: number; minH?: number; maxW?: number; maxH?: number; } type KtdGridCompactType = CompactType; interface KtdGridBackgroundCfg { show: 'never' | 'always' | 'whenDragging'; borderColor?: string; gapColor?: string; rowColor?: string; columnColor?: string; borderWidth?: number; } interface KtdGridCfg { cols: number; rowHeight: number | 'fit'; height?: number | null; layout: KtdGridLayoutItem[]; preventCollision: boolean; gap: number; } type KtdGridLayout = KtdGridLayoutItem[]; interface KtdGridItemRect { top: number; left: number; width: number; height: number; } interface KtdGridItemRenderData { id: string; top: T; left: T; width: T; height: T; } /** * We inject a token because of the 'circular dependency issue warning'. In case we don't had this issue with the circular dependency, we could just * import KtdGridComponent on KtdGridItem and execute the needed function to get the rendering data. */ type KtdGridItemRenderDataTokenType = (id: string) => KtdGridItemRenderData; declare const GRID_ITEM_GET_RENDER_DATA_TOKEN: InjectionToken; interface KtdDraggingData { pointerDownEvent: MouseEvent | TouchEvent; pointerDragEvent: MouseEvent | TouchEvent; gridElemClientRect: KtdClientRect; dragElemClientRect: KtdClientRect; scrollDifference: { top: number; left: number; }; } interface KtdDictionary { [key: string]: T; } /** * Type describing the allowed values for a boolean input. * @docs-private */ type BooleanInput = string | boolean | null | undefined; type NumberInput = string | number | null | undefined; /** * Injection token that can be used to reference instances of `KtdGridDragHandle`. It serves as * alternative token to the actual `KtdGridDragHandle` class which could cause unnecessary * retention of the class and its directive metadata. */ declare const KTD_GRID_DRAG_HANDLE: InjectionToken; /** Handle that can be used to drag a KtdGridItem instance. */ declare class KtdGridDragHandle { element: ElementRef; /** Inserted by Angular inject() migration for backwards compatibility */ constructor(); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Injection token that can be used to reference instances of `KtdGridItemPlaceholder`. It serves as * alternative token to the actual `KtdGridItemPlaceholder` class which could cause unnecessary * retention of the class and its directive metadata. */ declare const KTD_GRID_ITEM_PLACEHOLDER: InjectionToken>; /** Directive that can be used to create a custom placeholder for a KtdGridItem instance. */ declare class KtdGridItemPlaceholder { templateRef: TemplateRef; /** Context data to be added to the placeholder template instance. */ data: T; /** Inserted by Angular inject() migration for backwards compatibility */ constructor(); static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, "ng-template[buwGridItemPlaceholder]", never, { "data": { "alias": "data"; "required": false; }; }, {}, never, never, false, never>; } /** * Injection token that can be used to reference instances of `KtdGridResizeHandle`. It serves as * alternative token to the actual `KtdGridResizeHandle` class which could cause unnecessary * retention of the class and its directive metadata. */ declare const KTD_GRID_RESIZE_HANDLE: InjectionToken; /** Handle that can be used to drag a KtdGridItem instance. */ declare class KtdGridResizeHandle { element: ElementRef; /** Inserted by Angular inject() migration for backwards compatibility */ constructor(); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class KtdGridItemComponent extends BaseComponent implements OnInit, OnDestroy, AfterContentInit { static ngAcceptInputType_minW: NumberInput; static ngAcceptInputType_minH: NumberInput; static ngAcceptInputType_maxW: NumberInput; static ngAcceptInputType_maxH: NumberInput; static ngAcceptInputType_draggable: BooleanInput; static ngAcceptInputType_resizable: BooleanInput; static ngAcceptInputType_dragStartThreshold: NumberInput; /** Elements that can be used to drag the grid item. */ _dragHandles: QueryList; _resizeHandles: QueryList; resizeElem: ElementRef; /** Template ref for placeholder */ placeholder: KtdGridItemPlaceholder; /** Min and max size input properties. Any of these would 'override' the min/max values specified in the layout. */ minW?: number; minH?: number; maxW?: number; maxH?: number; /** CSS transition style. Note that for more performance is preferable only make transition on transform property. */ transition: string; dragStart$: Observable; resizeStart$: Observable; private _dragStartThreshold; private gridService; private renderer; private ngZone; private getItemRenderData; /** Id of the grid item. This property is strictly compulsory. */ get id(): string; set id(val: string); private _id; /** Minimum amount of pixels that the user should move before it starts the drag sequence. */ get dragStartThreshold(): number; set dragStartThreshold(val: number); /** Whether the item is draggable or not. Defaults to true. Does not affect manual dragging using the startDragManually method. */ get draggable(): boolean; set draggable(val: boolean); private _draggable; private _draggable$; private _manualDragEvents$; /** Whether the item is resizable or not. Defaults to true. */ get resizable(): boolean; set resizable(val: boolean); private _resizable; private _resizable$; private dragStartSubject; private resizeStartSubject; private subscriptions; /** Inserted by Angular inject() migration for backwards compatibility */ constructor(); ngOnInit(): void; ngAfterContentInit(): void; ngOnDestroy(): void; /** * To manually start dragging, route the desired pointer events to this method. * Dragging initiated by this method will work regardless of the value of the draggable Input. * It is the caller's responsibility to call this method with only the events that are desired to cause a drag. * For example, if you only want left clicks to cause a drag, it is your responsibility to filter out other mouse button events. * @param startEvent The pointer event that should initiate the drag. */ startDragManually(startEvent: MouseEvent | TouchEvent): void; setStyles({ top, left, width, height }: { top: string; left: string; width?: string; height?: string; }): void; private _dragStart$; private _resizeStart$; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** Tracks items by id. This function is mean to be used in conjunction with the ngFor that renders the 'buw-grid-items' */ declare function ktdTrackById(_index: number, item: { id: string; }): any; /** * Call react-grid-layout utils 'compact()' function and return the compacted layout. * @param layout to be compacted. * @param compactType, type of compaction. * @param cols, number of columns of the grid. */ declare function ktdGridCompact(layout: KtdGridLayout, compactType: KtdGridCompactType, cols: number): KtdGridLayout; interface KtdDragResizeEvent { layout: KtdGridLayout; layoutItem: KtdGridLayoutItem; gridItemRef: KtdGridItemComponent; } type KtdDragStart = KtdDragResizeEvent; type KtdResizeStart = KtdDragResizeEvent; type KtdDragEnd = KtdDragResizeEvent; type KtdResizeEnd = KtdDragResizeEvent; interface KtdGridItemResizeEvent { width: number; height: number; gridItemRef: KtdGridItemComponent; } declare function parseRenderItemToPixels(renderItem: KtdGridItemRenderData): KtdGridItemRenderData; declare function __gridItemGetRenderDataFactoryFunc(gridCmp: KtdGridComponent): (id: string) => KtdGridItemRenderData; declare function ktdGridItemGetRenderDataFactoryFunc(gridCmp: KtdGridComponent): any; declare class KtdGridComponent implements OnChanges, AfterContentInit, AfterContentChecked, OnDestroy { private gridService; private elementRef; private viewContainerRef; private renderer; private ngZone; /** Query list of grid items that are being rendered. */ _gridItems: QueryList; /** Emits when layout change */ layoutUpdated: EventEmitter; /** Emits when drag starts */ dragStarted: EventEmitter; /** Emits when resize starts */ resizeStarted: EventEmitter; /** Emits when drag ends */ dragEnded: EventEmitter; /** Emits when resize ends */ resizeEnded: EventEmitter; /** Emits when a grid item is being resized and its bounds have changed */ gridItemResize: EventEmitter; /** * Parent element that contains the scroll. If an string is provided it would search that element by id on the dom. * If no data provided or null autoscroll is not performed. */ scrollableParent: HTMLElement | Document | string | null; /** Whether or not to update the internal layout when some dependent property change. */ get compactOnPropsChange(): boolean; set compactOnPropsChange(value: boolean); private _compactOnPropsChange; /** If true, grid items won't change position when being dragged over. Handy when using no compaction */ get preventCollision(): boolean; set preventCollision(value: boolean); private _preventCollision; /** Number of CSS pixels that would be scrolled on each 'tick' when auto scroll is performed. */ get scrollSpeed(): number; set scrollSpeed(value: number); private _scrollSpeed; /** Type of compaction that will be applied to the layout (vertical, horizontal or free). Defaults to 'vertical' */ get compactType(): KtdGridCompactType; set compactType(val: KtdGridCompactType); private _compactType; /** * Row height as number or as 'fit'. * If rowHeight is a number value, it means that each row would have those css pixels in height. * if rowHeight is 'fit', it means that rows will fit in the height available. If 'fit' value is set, a 'height' should be also provided. */ get rowHeight(): number | 'fit'; set rowHeight(val: number | 'fit'); private _rowHeight; /** Number of columns */ get cols(): number; set cols(val: number); private _cols; /** Layout of the grid. Array of all the grid items with its 'id' and position on the grid. */ get layout(): KtdGridLayout; set layout(layout: KtdGridLayout); private _layout; /** Grid gap in css pixels */ get gap(): number; set gap(val: number); private _gap; /** * If height is a number, fixes the height of the grid to it, recommended when rowHeight = 'fit' is used. * If height is null, height will be automatically set according to its inner grid items. * Defaults to null. * */ get height(): number | null; set height(val: number | null); private _height; get backgroundConfig(): KtdGridBackgroundCfg | null; set backgroundConfig(val: KtdGridBackgroundCfg | null); private _backgroundConfig; private gridCurrentHeight; get config(): KtdGridCfg; /** Reference to the view of the placeholder element. */ private placeholderRef; /** Element that is rendered as placeholder when a grid item is being dragged */ private placeholder; private _gridItemsRenderData; private subscriptions; /** Inserted by Angular inject() migration for backwards compatibility */ constructor(); ngOnChanges(changes: SimpleChanges): void; ngAfterContentInit(): void; ngAfterContentChecked(): void; resize(): void; ngOnDestroy(): void; compactLayout(): void; getItemsRenderData(): KtdDictionary>; getItemRenderData(itemId: string): KtdGridItemRenderData; calculateRenderData(): void; render(): void; private setBackgroundCssVariables; private updateGridItemsStyles; private setGridBackgroundVisible; private initSubscriptions; /** * Perform a general grid drag action, from start to end. A general grid drag action basically includes creating the placeholder element and adding * some class animations. calcNewStateFunc needs to be provided in order to calculate the new state of the layout. * @param gridItem that is been dragged * @param pointerDownEvent event (mousedown or touchdown) where the user initiated the drag * @param calcNewStateFunc function that return the new layout state and the drag element position */ private performDragSequence$; /** * It adds the `buw-grid-item-animating` class and removes it when the animated transition is complete. * This function is meant to be executed when the drag has ended. * @param gridItem that has been dragged */ private addGridItemAnimatingClass; /** Creates placeholder element */ private createPlaceholderElement; /** Destroys the placeholder element and its ViewRef. */ private destroyPlaceholder; static ngAcceptInputType_cols: NumberInput; static ngAcceptInputType_rowHeight: NumberInput; static ngAcceptInputType_scrollSpeed: NumberInput; static ngAcceptInputType_compactOnPropsChange: BooleanInput; static ngAcceptInputType_preventCollision: BooleanInput; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class NavContainerComponent extends BaseComponent implements OnInit, OnDestroy { _router: Router; onTabSelect(e: any): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class LayoutContainerComponent extends BaseComponent implements OnInit, OnDestroy { grid: KtdGridComponent; layout: KtdGridLayout; moDataList: MetaobjectDataModel[]; trackById: typeof ktdTrackById; cols: number; rowHeight: number; rowHeightFit: boolean; gridHeight: null | number; compactType: 'vertical' | 'horizontal' | null; transitions: { name: string; value: string; }[]; currentTransition: string; placeholders: string[]; currentPlaceholder: string; dragStartThreshold: number; gap: number; autoScroll: boolean; disableDrag: boolean; disableResize: boolean; disableRemove: boolean; autoResize: boolean; preventCollision: boolean; isDragging: boolean; isResizing: boolean; showBackground: boolean; resizeSubscription: Subscription; gridBackgroundVisibilityOptions: string[]; gridBackgroundConfig: Required; document: Document; ngOnInit(): void; ngOnDestroy(): void; ngOnChanges(changes: SimpleChanges): void; onDragStarted(_event: KtdDragStart): void; onResizeStarted(_event: KtdResizeStart): void; onDragEnded(_event: KtdDragEnd): void; onResizeEnded(_event: KtdResizeEnd): void; onLayoutUpdated(layout: KtdGridLayout): void; onAutoScrollChange(checked: boolean): void; onDisableDragChange(checked: boolean): void; onDisableResizeChange(checked: boolean): void; onShowBackgroundChange(checked: boolean): void; onDisableRemoveChange(checked: boolean): void; onAutoResizeChange(checked: boolean): void; onPreventCollisionChange(checked: boolean): void; onColsChange(event: Event): void; onRowHeightChange(event: Event): void; onGridHeightChange(event: Event): void; onDragStartThresholdChange(event: Event): void; onGapChange(event: Event): void; generateLayout(): void; /** Adds a grid item to the layout */ addItemToLayout(): void; /** * Fired when a mousedown happens on the remove grid item button. * Stops the event from propagating an causing the drag to start. * We don't want to drag when mousedown is fired on remove icon button. */ stopEventPropagation(event: Event): void; /** Removes the item from the layout */ removeItem(id: string): void; updateGridBgBorderWidth(borderWidth: string): void; updateGridBgColor(color: string, property: string): void; getCurrentBackgroundVisibility(): string; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class ReportGridLayoutComponent extends ReportViewBaseComponent implements OnInit, OnDestroy { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class LayoutGridMapperPipe implements PipeTransform { transform(molist: MetaobjectDataModel[]): KtdGridLayout; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵpipe: i0.ɵɵPipeDeclaration; } declare class BarsaUserWorkspaceModule extends BaseModule { protected dcm: DynamicComponentService; protected componentFactoryResolver: ComponentFactoryResolver; protected dynamicComponents: (typeof KtdGridItemComponent | typeof KtdGridComponent | typeof NavContainerComponent | typeof LayoutContainerComponent | typeof ReportGridLayoutComponent)[]; /** Inserted by Angular inject() migration for backwards compatibility */ constructor(); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } export { BarsaUserWorkspaceModule, GRID_ITEM_GET_RENDER_DATA_TOKEN, KTD_GRID_DRAG_HANDLE, KTD_GRID_ITEM_PLACEHOLDER, KTD_GRID_RESIZE_HANDLE, KtdGridComponent, KtdGridDragHandle, KtdGridItemComponent, KtdGridItemPlaceholder, KtdGridResizeHandle, LayoutContainerComponent, NavContainerComponent, ReportGridLayoutComponent, __gridItemGetRenderDataFactoryFunc, ktdGridCompact, ktdGridItemGetRenderDataFactoryFunc, ktdTrackById, parseRenderItemToPixels }; export type { KtdClientRect, KtdDragEnd, KtdDragStart, KtdDraggingData, KtdGridBackgroundCfg, KtdGridCfg, KtdGridCompactType, KtdGridItemRect, KtdGridItemRenderData, KtdGridItemRenderDataTokenType, KtdGridItemResizeEvent, KtdGridLayout, KtdGridLayoutItem, KtdResizeEnd, KtdResizeStart };