@alfresco/adf-content-services
Version:
Alfresco ADF content services
260 lines (259 loc) • 11.6 kB
TypeScript
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { EventEmitter, OnInit } from '@angular/core';
import { DataSorting, HighlightDirective, InfinitePaginationComponent, PaginatedComponent, ShowHeaderMode, UserPreferencesService } from '@alfresco/adf-core';
import { NodesApiService, SitesService, UploadService } from '../../common';
import { UntypedFormControl } from '@angular/forms';
import { Node, NodeEntry, NodePaging, Pagination, SearchRequest, SiteEntry, SitePaging } from '@alfresco/js-api';
import { DocumentListComponent } from '../../document-list/components/document-list.component';
import { RowFilter } from '../../document-list/data/row-filter.model';
import { ImageResolver } from '../../document-list/data/image-resolver.model';
import { CustomResourcesService } from '../../document-list/services/custom-resources.service';
import { NodeEntryEvent } from '../../document-list/components/node.event';
import { ContentNodeSelectorPanelService } from './content-node-selector-panel.service';
import { SearchQueryBuilderService } from '../../search/services/search-query-builder.service';
import * as i0 from "@angular/core";
export type ValidationFunction = (entry: Node) => boolean;
export declare const defaultValidation: () => boolean;
export declare class ContentNodeSelectorPanelComponent implements OnInit {
private customResourcesService;
private queryBuilderService;
private userPreferencesService;
private nodesApiService;
private uploadService;
private sitesService;
private contentNodeSelectorPanelService;
DEFAULT_PAGINATION: Pagination;
readonly disableActionFolderList: string[];
private showSiteList;
private showSearchField;
private showCounter;
private _emptyList;
/** If true will restrict the search and breadcrumbs to the currentFolderId */
restrictRootToCurrentFolderId: boolean;
/** Node ID of the folder currently listed. */
currentFolderId: string;
/**
* Hide the "My Files" option added to the site list by default.
* See the [Sites Dropdown component](sites-dropdown.component.md)
* for more information.
*/
dropdownHideMyFiles: boolean;
/**
* Custom site for site dropdown. This is the same as the `siteList`.
* property of the Sites Dropdown component (see its doc page
* for more information).
*/
dropdownSiteList: SitePaging;
_rowFilter: RowFilter;
/**
* Custom *where* filter function. See the
* Document List component
* for more information.
*/
where: string;
/**
* Custom row filter function. See the
* [Row Filter Model](row-filter.model.md) page
* for more information.
*/
set rowFilter(rowFilter: RowFilter);
get rowFilter(): RowFilter;
_excludeSiteContent: string[];
/**
* Custom list of site content componentIds.
* Used to filter out the corresponding items from the displayed nodes
*/
set excludeSiteContent(excludeSiteContent: string[]);
get excludeSiteContent(): string[];
/**
* Custom image resolver function. See the
* [Image Resolver Model](image-resolver.model.md) page
* for more information.
*/
imageResolver: ImageResolver;
/** Number of items shown per page in the list. */
pageSize: number;
/** Define the selection mode for document list. The allowed values are single or multiple */
selectionMode: 'single' | 'multiple';
/**
* Function used to decide if the selected node has permission to be selected.
* Default value is a function that always returns true.
*/
isSelectionValid: ValidationFunction;
/**
* Transformation to be performed on the chosen/folder node before building the
* breadcrumb UI. Can be useful when custom formatting is needed for the breadcrumb.
* You can change the path elements from the node that are used to build the
* breadcrumb using this function.
*/
breadcrumbTransform: (node: any) => any;
/** Toggle search input rendering */
set showSearch(value: boolean);
get showSearch(): boolean;
/** Toggle sites list dropdown rendering */
set showDropdownSiteList(value: boolean);
get showDropdownSiteList(): boolean;
/** Shows the files and folders in the search result */
set showFilesInResult(value: boolean);
/** Shows the node counter in the breadcrumb */
set showNodeCounter(value: boolean);
get showNodeCounter(): boolean;
/** Emitted when the user has chosen an item. */
select: EventEmitter<Node[]>;
/** Emitted when the navigation changes. */
navigationChange: EventEmitter<NodeEntryEvent>;
/** Emitted when the select site changes. */
siteChange: EventEmitter<string>;
/** Emitted when search is running. */
showingSearch: EventEmitter<boolean>;
/** Emitted when current folder loaded. */
currentFolder: EventEmitter<Node>;
/** Emitted when folder loaded. */
folderLoaded: EventEmitter<any>;
documentList: DocumentListComponent;
highlighter: HighlightDirective;
nodePaging: NodePaging | null;
siteId: null | string;
breadcrumbRootId: null | string;
searchTerm: string;
showingSearchResults: boolean;
loadingSearchResults: boolean;
inDialog: boolean;
_chosenNode: Node[];
selectionWithoutValidation: Node[];
folderIdToShow: string | null;
breadcrumbFolderTitle: string | null;
startSiteGuid: string | null;
hasValidQuery: boolean;
showHeader: ShowHeaderMode;
infinitePaginationComponent: InfinitePaginationComponent;
infiniteScroll: boolean;
debounceSearch: number;
searchInput: UntypedFormControl;
target: PaginatedComponent;
preselectedNodes: NodeEntry[];
currentUploadBatch: NodeEntry[];
sorting: string[] | DataSorting;
searchPanelExpanded: boolean;
private readonly destroyRef;
constructor(customResourcesService: CustomResourcesService, queryBuilderService: SearchQueryBuilderService, userPreferencesService: UserPreferencesService, nodesApiService: NodesApiService, uploadService: UploadService, sitesService: SitesService, contentNodeSelectorPanelService: ContentNodeSelectorPanelService);
set chosenNode(value: Node[]);
get chosenNode(): Node[];
get emptyList(): boolean;
getSelectedCount(): number;
ngOnInit(): void;
toggleSearchPanel(): void;
hasCustomModels(): boolean;
private onFileUploadEvent;
private onFileUploadDeletedEvent;
private getStartSite;
private createRowFilter;
private isExcludedSiteContent;
/**
* Updates the site attribute and starts a new search
*
* @param chosenSite SiteEntry to search within
*/
siteChanged(chosenSite: SiteEntry): void;
/**
* Get current breadcrumb folder node
*
* @returns the actually selected|entered folder node or null in case of searching for the breadcrumb
*/
get breadcrumbFolderNode(): Node | null;
/**
* Prepares the dialog for a new search
*
* @param searchRequest request options
*/
prepareDialogForNewSearch(searchRequest: SearchRequest): void;
/**
* Clear the search input and reset to last folder node in which search was performed
*/
clear(): void;
/**
* Resets the folder to be shown with the site selection or the initial landing folder
*/
resetFolderToShow(): void;
/**
* Clear the search input and search related data
*/
clearSearch(): void;
private addCorrespondingNodeIdsQuery;
private setSearchScopeToNodes;
/**
* Show the results of the search
*
* @param results Search results
*/
private showSearchResults;
/**
* Sets showingSearchResults state to be able to differentiate between search results or folder results
*
* @param $event node event
*/
onFolderChange($event: NodeEntryEvent): void;
/**
* Attempts to set the currently loaded node
*
* @param nodePaging pagination model
*/
onFolderLoaded(nodePaging: NodePaging): void;
/**
* Updates pagination.hasMoreItems to false after filtering only folders during 'COPY' and 'MOVE' action
*
* @param nodePaging pagination model
*/
updatePaginationAfterRowFilter(nodePaging: NodePaging): void;
/**
* Returns whether breadcrumb has to be shown or not
*
* @returns `true` if needs to show the breadcrumb, otherwise `false`
*/
showBreadcrumbs(): true | Node[];
/**
* Loads the next batch of search results
*
* @param pagination Pagination object
*/
getNextPageOfSearch(pagination: Pagination): void;
/**
* Selects node as chosen if it has the right permission, clears the selection otherwise
*
* @param entry node entry
*/
private attemptNodeSelection;
private isActionDisabledForFolder;
/**
* Clears the chosen node
*/
resetChosenNode(): void;
/**
* It filters and emit the selection coming from the document list
*
* @param nodesEntries selected nodes
*/
onCurrentSelection(nodesEntries: NodeEntry[]): void;
setTitleIfCustomSite(site: SiteEntry): void;
hasPreselectNodes(): boolean;
isSingleSelectionMode(): boolean;
getPreselectNodesBasedOnSelectionMode(): NodeEntry[];
private resetPagination;
static ɵfac: i0.ɵɵFactoryDeclaration<ContentNodeSelectorPanelComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<ContentNodeSelectorPanelComponent, "adf-content-node-selector-panel", never, { "restrictRootToCurrentFolderId": { "alias": "restrictRootToCurrentFolderId"; "required": false; }; "currentFolderId": { "alias": "currentFolderId"; "required": true; }; "dropdownHideMyFiles": { "alias": "dropdownHideMyFiles"; "required": false; }; "dropdownSiteList": { "alias": "dropdownSiteList"; "required": false; }; "where": { "alias": "where"; "required": false; }; "rowFilter": { "alias": "rowFilter"; "required": false; }; "excludeSiteContent": { "alias": "excludeSiteContent"; "required": false; }; "imageResolver": { "alias": "imageResolver"; "required": false; }; "pageSize": { "alias": "pageSize"; "required": false; }; "selectionMode": { "alias": "selectionMode"; "required": false; }; "isSelectionValid": { "alias": "isSelectionValid"; "required": false; }; "breadcrumbTransform": { "alias": "breadcrumbTransform"; "required": false; }; "showSearch": { "alias": "showSearch"; "required": false; }; "showDropdownSiteList": { "alias": "showDropdownSiteList"; "required": false; }; "showFilesInResult": { "alias": "showFilesInResult"; "required": false; }; "showNodeCounter": { "alias": "showNodeCounter"; "required": false; }; }, { "select": "select"; "navigationChange": "navigationChange"; "siteChange": "siteChange"; "showingSearch": "showingSearch"; "currentFolder": "currentFolder"; "folderLoaded": "folderLoaded"; }, never, never, true, never>;
}