import * as rxjs from 'rxjs'; import * as i0 from '@angular/core'; import { OnDestroy, AfterViewInit, ChangeDetectorRef, EventEmitter } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { PropertyValue, ILfSelectable, LfBreadcrumb, ItemWithId } from '@laserfiche/lf-ui-components/shared'; import { ColumnOrderBy, ColumnDef, LfSelectionListComponent, SelectedItemEvent } from '@laserfiche/lf-ui-components/lf-selection-list'; interface LfTreeNode { id: string; icon: string | string[]; isContainer: boolean; isLeaf: boolean; name: string; path: string; attributes?: Map; } interface LfTreeNodePage { page: LfTreeNode[]; nextPage: string | undefined; } /** * A tree data structure provider that can be used as a data source for UI components, such as the lf-repository-browser component, to navigate a tree structure. */ interface LfTreeNodeService { /** * Returns a page containing the children or the parent tree node. The implementation may provide expose ordering and filtering functionality. * @param folder: string that represents the ID of the folder to get data from * @param nextPage: string representing the next page requested. If undefined, the first page is returned **/ getFolderChildrenAsync(folder: LfTreeNode, nextPage?: string, orderBy?: ColumnOrderBy): Promise; /** * Returns the root LfTreeNode */ getRootTreeNodeAsync(): Promise; /** * Gets the parent LfTreeNode of the passed in node * @param treeNode: LfTreeNode object to get the parent of * returns - Promise with the parent of the parameter LfTreeNode or undefined if its the root LfTreeNode and does not have a parent */ getParentTreeNodeAsync(treeNode: LfTreeNode): Promise; /** * Gets the LfTreeNode referenced by the identifier. This function must support getting the LfTreeNode by Id, optionally by secondary identifiers, such as the path, etc. * @param identifier Identifier for the LfTreeNode. */ getTreeNodeByIdentifierAsync?(identifier: string): Promise; } type BreadcrumbNavigationEvent = { breadcrumbs: LfTreeNode[]; selected: LfTreeNode; }; declare class LfRepositoryBrowserComponent implements OnDestroy, AfterViewInit { /**@internal */ ref: ChangeDetectorRef; /**@internal */ popupDialog: MatDialog; /**@internal */ private localizationService; /**@internal */ private el; /** * read-only property to get current breadcrumbs */ get breadcrumbs(): LfTreeNode[]; /** * read-only property to retrieve currently opened LfTreeNode */ get currentFolder(): LfTreeNode | undefined; /** * Property to set height in pixels of each item in lf-repository-browser */ set item_size(value: number | string); get item_size(): number; /** * Property to set number of items rendered, should be set to more than the number of visible nodes */ set page_size(value: number | string); get page_size(): number; /** * Property to get and set the current column to order by */ get column_order_by(): ColumnOrderBy | undefined; set column_order_by(orderBy: ColumnOrderBy | undefined); /** * Property to set whether or not to always show header. By default will only show header if there is more than one column */ set always_show_header(showHeader: boolean | undefined | string); /** * Function to set additional columns to display. You can use this to set a specific name column as well, or accept the default. */ setColumnsToDisplay: (cols: ColumnDef[]) => void; /** * Function to initialize the lf-repository-browser component * @param treeNodeService LfRepositoryService service * @param initialOpenedNode The LfTreeNode that you would like to open, or the identifier of the LfTreeNode. The identifier should match the implementation of service.getTreeNodeByIdentifierAsync(..) (i.e. id, path, etc.) */ initAsync: (treeNodeService: LfTreeNodeService, initialOpenedNode?: LfTreeNode | string) => Promise; /** * This function will be called for each LfTreeNode to determine if it is selectable, when it is rendered */ isSelectable?: (treeNode: LfTreeNode) => Promise; /** * Property to get and set whether multiple select is enabled on the component */ set multiple(value: boolean | string); get multiple(): boolean; /** * Function to set selectedNodes. If current data does not include all the requested node, it will call getFolderChildren until there are no more, or maxFetchIterations is reached. * @param nodesToSelect array of LfTreeNodes to select by id * @param maxFetchIterations Max number of times to get data if the current data doesn't contain all of the requested nodes. Default is 5. * @returns void */ setSelectedNodesAsync: (nodesToSelect: LfTreeNode[], maxFetchIterations?: number) => Promise; /** * Function to refresh data in folder (get first page) * @param clearSelectedValues Optional parameter to clear all the currently selected values. Default is true. */ refreshAsync: (clearSelectedValues?: boolean) => Promise; /** * Function to open selected node(s). If there is just one container node it will open the container in the UI and emit the entryDblClicked event, * if there is more than one node or it is not a container, it will just emit the entryDblClicked event */ openSelectedNodesAsync: () => Promise; /** * Function to open focused node. If there is just one container node it will open the container in the UI and emit the entryDblClicked event */ openFocusedNodeAsync: () => Promise; /** * Focuses the first item in the repository browser list * TODO: Add an optional parameter to allow for focusing a specific node */ focus: () => void; /** Event triggered on double click (open) of a node. This can be accompanied by the UI opening a single container */ entryDblClicked: EventEmitter; /** Event triggered on selection (click/space bar) of a node.*/ entrySelected: EventEmitter; /** Event triggered on focus of a node.*/ entryFocused: EventEmitter; /** @internal */ entryList: LfSelectionListComponent | undefined; /** @internal */ private selectedItems; /** @internal */ private focusedEntry; /** @internal */ private _multipleSelectEnabled; /** @internal */ private _pageSize; /** @internal */ private _itemSize; /** @internal */ repoBrowserUniqueId: string; /** @internal */ currentFolderChildren: ILfSelectable[]; /** @internal */ hasError: boolean; /** @internal */ isLoading: boolean; /** * @internal * TODO: Add a message for when the repository browser is not initialized * When that happens default isLoading to false */ initialized: boolean; /** @internal */ nextPage: string | undefined; /** @internal */ lastCalledPage: string | undefined; /** @internal */ treeNodeService: LfTreeNodeService; /** @internal */ readonly AN_ERROR_OCCURED: rxjs.Observable; /** @internal */ get shouldShowErrorMessage(): boolean; /** @internal */ readonly THIS_FOLDER_IS_EMPTY: rxjs.Observable; /** @internal */ get shouldShowEmptyMessage(): boolean; /** @internal */ protected _currentFolder?: LfTreeNode; /** @internal */ protected maximumChildrenReceived: boolean; /** @internal */ private _breadcrumbs; /** @internal */ private scrolledIndexChanged; /** * @internal * Used to track if data is currently being pulled * */ private lastDataCall?; /** @internal */ private isFetchingData; /** @internal */ constructor(); /** @internal */ ngAfterViewInit(): void; /** * @internal * Handles when a bread crumb is clicked * @param event * @returns */ onBreadcrumbNavigation(navigationEvent: BreadcrumbNavigationEvent): Promise; /** @internal */ toBreadcrumbNavigationEvent(event: { breadcrumbs: LfBreadcrumb[]; selected: LfBreadcrumb; }): BreadcrumbNavigationEvent; /** * @internal * @param entry * @returns list of strings that represent img src's */ getIcons(entry: any): string[]; /** * @internal * Handles when a entry in the repository browser is double clicked * @param entry * @returns */ onDblClickAsync(treeNode: ItemWithId | undefined): Promise; /** * @internal * Handles the scrolling event from the lf-selection-list */ onScroll(): void; /** * @internal * Handles the SelectedItemEvent from the lf-selection-list * @param event */ onItemSelected(event: SelectedItemEvent): Promise; /** @internal */ onEntryFocused(item: ItemWithId | undefined): void; /** * @internal * Opens the entry passed as the parameter * Example: This will get called when an entry is double clicked * @param entry */ openChildFolderAsync(entry: LfTreeNode): Promise; /** * @internal */ openSelectedItemsAsync(): Promise; /** * @internal * Callback that is passed to the lf-selection-list so it can continue to get more data if needed to select * initial values * @returns */ private checkForMoreDataCallback; /** * @internal * Maps ILfSelectable list to a TreeNode list * @param selected * @returns */ private convertSelectedItemsToTreeNode; /** * @internal * Attempts to focus the entryList component * @param node Not used right now but is part of the TODO for focus fuction * @param tries */ private _focus; /** * @internal * Attempts to initialize the repository browser * Will initialize with the root node if not currentIdOrEntry is provided * Otherwise will use the provided entry to build the breadcrumbs and pull the corresponding data * @param currentIdOrEntry * @returns */ private initializeAsync; /** * @internal * Uses the entry passed in to build the breadcrumbs * @param selectedEntry * @returns */ private initializeBreadcrumbOptionsAsync; /** * @internal * Maps TreeNode list to ILfSelectable items for use in the entryList * @param nodes * @returns */ private mapTreeNodesToLfSelectableAsync; /** * @internal * Resets the errors, selected values, currentFolderChildren and nextPage */ private resetFolderProperties; /** * @internal * Makes the parentEntry parameter into the current parent node * Will setup the breadcrumbs to be the listOfAncestorEntries with the parentEntry as the last one if passed in * @param parentEntry * @param listOfAncestorEntries * @returns */ private setNodeAsParentAsync; /** * @internal * Resets the list and pulls new data for the parentEntry * @param parentEntry * @param refresh Not Used currently */ private updateAllPossibleEntriesAsync; /** @internal */ private refreshTreeNodeAsync; /** @internal */ private resetSelectedItemsAsync; /** @internal */ private makeDataCall; /** @internal */ private syncEntryListViewportSize; /** * @internal * Does the work to call the treeNodeService and map the returned values to ILfSelectable entries * @param parentEntry * @returns */ private updateFolderChildrenAsync; /** @internal */ ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export { LfRepositoryBrowserComponent }; export type { LfTreeNode, LfTreeNodePage, LfTreeNodeService };