@alfresco/adf-content-services
Version:
Alfresco ADF content services
131 lines (130 loc) • 6.02 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, OnDestroy, OnInit, QueryList, TemplateRef } from '@angular/core';
import { Observable } from 'rxjs';
import { TreeNode } from '../models/tree-node.interface';
import { TreeService } from '../services/tree.service';
import { PaginationModel, UserPreferencesService } from '@alfresco/adf-core';
import { SelectionModel } from '@angular/cdk/collections';
import { MatCheckbox } from '@angular/material/checkbox';
import { TreeContextMenuResult } from '../models/tree-context-menu-result.interface';
import * as i0 from "@angular/core";
export declare class TreeComponent<T extends TreeNode> implements OnInit, OnDestroy {
treeService: TreeService<T>;
private userPreferenceService;
/** TemplateRef to provide empty template when no nodes are loaded */
emptyContentTemplate: TemplateRef<any>;
/** TemplateRef to provide context menu items for context menu displayed on each row*/
nodeActionsMenuTemplate: TemplateRef<any>;
/** Variable defining if tree header should be sticky. By default set to false */
stickyHeader: boolean;
/** Variable defining if tree nodes should be selectable. By default set to false */
selectableNodes: boolean;
/** Tree display name */
displayName: string;
/** Load more suffix for load more button */
loadMoreSuffix: string;
/** Icon shown when node has children and is collapsed. By default set to chevron_right */
expandIcon: string;
/** Icon shown when node is expanded. By default set to expand_more */
collapseIcon: string;
/** Emitted when pagination has been changed */
paginationChanged: EventEmitter<PaginationModel>;
/** Emitted when any context menu option is selected */
contextMenuOptionSelected: EventEmitter<TreeContextMenuResult<T>>;
nodeCheckboxes: QueryList<MatCheckbox>;
private loadingRootSource;
private _contextMenuSource;
private _contextMenuOptions;
private contextMenuOptionsChanged$;
loadingRoot$: Observable<boolean>;
treeNodesSelection: SelectionModel<T>;
constructor(treeService: TreeService<T>, userPreferenceService: UserPreferencesService);
set contextMenuSource(contextMenuSource: T);
/** Array of context menu options which should be displayed for each row. */
set contextMenuOptions(contextMenuOptions: any[]);
get contextMenuOptions(): any[];
ngOnInit(): void;
ngOnDestroy(): void;
/**
* Checks if node is LoadMoreNode node
*
* @param _idx (unused)
* @param node node to be checked
* @returns `true` if there are more items to load, otherwise `false`
*/
isLoadMoreNode(_idx: number, node: T): boolean;
/**
* Checks if tree is empty
*
* @returns boolean
*/
isEmpty(): boolean;
/**
* Returns action icon based on expanded/collapsed node state.
*
* @param node node to be checked
* @returns collapse or expand icon
*/
expandCollapseIconValue(node: T): string;
/**
* Refreshes the tree, root nodes are reloaded, tree selection is cleared.
*
* @param skipCount Number of root nodes to skip.
* @param maxItems Maximum number of nodes returned from Observable.
* @param searchTerm Specifies if categories should be filtered out by name or not. If not specified then returns categories without filtering.
*/
refreshTree(skipCount?: number, maxItems?: number, searchTerm?: string): void;
/**
* Collapses or expanding the node based on its current state
*
* @param node node to be collapsed/expanded
*/
expandCollapseNode(node: T): void;
/**
* Loads more subnode for a given parent node
*
* @param node parent node
*/
loadMoreSubnodes(node: T): void;
/**
* When node is selected it selects all its descendants
*
* @param node selected node
*/
onNodeSelected(node: T): void;
/**
* Checks if all descendants of a node are selected
*
* @param node selected node
* @returns boolean
*/
descendantsAllSelected(node: T): boolean;
/**
* Checks if some descendants of a node are selected
*
* @param node selected node
* @returns boolean
*/
descendantsPartiallySelected(node: T): boolean;
private checkParentsSelection;
private checkRootNodeSelection;
private onTreeSelectionChange;
private isRegularNode;
static ɵfac: i0.ɵɵFactoryDeclaration<TreeComponent<any>, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<TreeComponent<any>, "adf-tree", never, { "emptyContentTemplate": { "alias": "emptyContentTemplate"; "required": false; }; "nodeActionsMenuTemplate": { "alias": "nodeActionsMenuTemplate"; "required": false; }; "stickyHeader": { "alias": "stickyHeader"; "required": false; }; "selectableNodes": { "alias": "selectableNodes"; "required": false; }; "displayName": { "alias": "displayName"; "required": false; }; "loadMoreSuffix": { "alias": "loadMoreSuffix"; "required": false; }; "expandIcon": { "alias": "expandIcon"; "required": false; }; "collapseIcon": { "alias": "collapseIcon"; "required": false; }; "contextMenuOptions": { "alias": "contextMenuOptions"; "required": false; }; }, { "paginationChanged": "paginationChanged"; "contextMenuOptionSelected": "contextMenuOptionSelected"; }, never, never, true, never>;
}