@alfresco/adf-content-services
Version:
Alfresco ADF content services
323 lines (322 loc) • 18 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 { AppConfigService, CustomEmptyContentTemplateDirective, CustomLoadingContentTemplateDirective, CustomNoPermissionTemplateDirective, DataCellEvent, DataColumn, DataColumnListComponent, DataRow, DataRowActionEvent, DataSorting, DataTableComponent, DataTableSchema, DataTableService, PaginatedComponent, PaginationModel, RequestPaginationModel, ShowHeaderMode, ThumbnailService, UserPreferencesService } from '@alfresco/adf-core';
import { Node, NodeEntry, NodePaging, NodesApi, Pagination } from '@alfresco/js-api';
import { AfterContentInit, ElementRef, EventEmitter, OnChanges, OnInit, SimpleChanges } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { BehaviorSubject, Subject } from 'rxjs';
import { ContentService, NodesApiService } from '../../common';
import { FilterSearch } from '../../search';
import { RowFilter } from '../data/row-filter.model';
import { ShareDataRow } from '../data/share-data-row.model';
import { ShareDataTableAdapter } from '../data/share-datatable-adapter';
import { ContentActionModel } from '../models/content-action.model';
import { PermissionStyleModel } from '../models/permissions-style.model';
import { DocumentListService } from '../services/document-list.service';
import { LockService } from '../services/lock.service';
import { NodeEntityEvent, NodeEntryEvent } from './node.event';
import { AlfrescoApiService } from '../../services/alfresco-api.service';
import * as i0 from "@angular/core";
export declare class DocumentListComponent extends DataTableSchema implements OnInit, OnChanges, AfterContentInit, PaginatedComponent {
private documentListService;
private elementRef;
private appConfig;
private userPreferencesService;
private contentService;
private thumbnailService;
private alfrescoApiService;
private nodeService;
private dataTableService;
private lockService;
private dialog;
static SINGLE_CLICK_NAVIGATION: string;
static DOUBLE_CLICK_NAVIGATION: string;
DEFAULT_PAGINATION: Pagination;
DEFAULT_SORTING: DataSorting[];
columnList: DataColumnListComponent;
customLoadingContent: CustomLoadingContentTemplateDirective;
customNoPermissionsTemplate: CustomNoPermissionTemplateDirective;
customNoContentTemplate: CustomEmptyContentTemplateDirective;
/** Include additional information about the node in the server request. For example: association, isLink, isLocked and others. */
includeFields: string[];
/**
* Filters the Node list using the *where* condition of the REST API
* (for example, isFolder=true). See the REST API documentation for more information.
*/
where: string;
/**
* Define a set of CSS styles to apply depending on the permission
* of the user on that node. See the Permission Style model
* page for further details and examples.
*/
permissionsStyle: PermissionStyleModel[];
/** The default route for all the location-based columns (if declared). */
locationFormat: string;
/** Toggles navigation to folder content or file preview */
navigate: boolean;
/** Toggles the header */
showHeader: ShowHeaderMode;
/**
* User interaction for folder navigation or file preview.
* Valid values are "click" and "dblclick". Default value: "dblclick"
*/
navigationMode: string;
/** Show document thumbnails rather than icons */
thumbnails: boolean;
/**
* Row selection mode. Can be null, `single` or `multiple`. For `multiple` mode,
* you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows.
*/
selectionMode: string;
/** Toggles multiselect mode */
multiselect: boolean;
/** Toggles content actions for each row */
contentActions: boolean;
/** Position of the content actions dropdown menu. Can be set to "left" or "right". */
contentActionsPosition: string;
/** Toggles context menus for each row */
contextMenuActions: boolean;
/** Custom image for empty folder. Default value: './assets/images/empty_doc_lib.svg' */
emptyFolderImageUrl: string;
/**
* When true, this enables you to drop files directly into subfolders shown
* as items in the list or into another file to trigger updating it's version.
* When false, the dropped file will be added to the
* current folder (ie, the one containing all the items shown in the list).
* See the Upload directive for further details about how the file drop is
* handled.
*/
allowDropFiles: boolean;
/**
* Defines default sorting. The format is an array of 2 strings `[key, direction]`
* i.e. `['name', 'desc']` or `['name', 'asc']`. Set this value only if you want to
* override the default sorting detected by the component based on columns.
*/
sorting: string[] | DataSorting;
/**
* Defines default sorting. The format is an array of strings `[key direction, otherKey otherDirection]`
* i.e. `['name desc', 'nodeType asc']` or `['name asc']`. Set this value if you want a base
* rule to be added to the sorting apart from the one driven by the header.
*/
additionalSorting: DataSorting;
/**
* Defines sorting mode. Can be either `client` (items in the list
* are sorted client-side) or `server` (the ordering supplied by the
* server is used without further client-side sorting).
* Note that the `server` option *does not* request the server to sort the data
* before delivering it.
*/
sortingMode: 'server' | 'client';
/**
* The inline style to apply to every row. See
* the Angular NgStyle
* docs for more details and usage examples.
*/
rowStyle: {
[key: string]: any;
};
/** The CSS class to apply to every row */
rowStyleClass: string;
/**
* Toggles the loading state and animated spinners for the component. Used in
* combination with `navigate=false` to perform custom navigation and loading
* state indication.
*/
loading: boolean;
_rowFilter: RowFilter | null;
/**
* Custom function to choose whether to show or hide rows.
* See the [Row Filter Model](row-filter.model.md) page for
* more information.
*/
set rowFilter(rowFilter: RowFilter);
get rowFilter(): RowFilter;
/**
* Custom function to choose image file paths to show. See the
* [Image Resolver Model](image-resolver.model.md) page for
* more information.
*/
imageResolver: any | null;
/** Toggles the sticky header mode. */
stickyHeader: boolean;
/** Toggles the header filters mode. */
headerFilters: boolean;
/** Initial value for filter. */
filterValue: any;
/** The ID of the folder node to display or a reserved string alias for special sources */
currentFolderId: string;
/**
* Array of nodes to be pre-selected. All nodes in the
* array are pre-selected in multi selection mode, but only the first node
* is pre-selected in single selection mode.
*/
preselectNodes: NodeEntry[];
/** The Document list will show all the nodes contained in the NodePaging entity */
node: NodePaging;
/** Default value is stored in the user preference settings. Use this only if you are not using pagination. */
maxItems: number;
/** Key of columns preset set in extension.json */
columnsPresetKey?: string;
/** Sets columns visibility for DataTableSchema */
set setColumnsVisibility(columnsVisibility: {
[columnId: string]: boolean;
} | undefined);
/** Sets columns width for DataTableSchema */
set setColumnsWidths(columnsWidths: {
[columnId: string]: number;
} | undefined);
/** Sets columns order for DataTableSchema */
set setColumnsOrder(columnsOrder: string[] | undefined);
/** Limit of possible visible columns, including "$thumbnail" column if provided */
maxColumnsVisible?: number;
/** Enables column resizing for datatable */
isResizingEnabled: boolean;
/** Enables blur when resizing datatable columns */
blurOnResize: boolean;
/** Display checkboxes in datatable rows on hover only */
displayCheckboxesOnHover: boolean;
/** Display drag and drop hint. */
displayDragAndDropHint: boolean;
/** Emitted when the user clicks a list node */
nodeClick: EventEmitter<NodeEntityEvent>;
/** Emitted when the user double-clicks a list node */
nodeDblClick: EventEmitter<NodeEntityEvent>;
/** Emitted when the current display folder changes */
folderChange: EventEmitter<NodeEntryEvent>;
/**
* Emitted when the user acts upon files with either single or double click
* (depends on `navigation-mode`). Useful for integration with the
* Viewer component.
*/
preview: EventEmitter<NodeEntityEvent>;
/** Emitted when the Document List has loaded all items and is ready for use */
ready: EventEmitter<NodePaging>;
/** Emitted when the API fails to get the Document List data */
error: EventEmitter<any>;
/** Emitted when the node selection change */
nodeSelected: EventEmitter<NodeEntry[]>;
/** Emitted when a filter value is selected */
filterSelection: EventEmitter<FilterSearch[]>;
/** Emitted when column widths change */
columnsWidthChanged: EventEmitter<{
[columnId: string]: number;
}>;
/** Emitted when columns visibility change */
columnsVisibilityChanged: EventEmitter<{
[columnId: string]: boolean;
}>;
/** Emitted when columns order change */
columnsOrderChanged: EventEmitter<string[]>;
/** Emitted when the selected row items count in the table changed. */
selectedItemsCountChanged: EventEmitter<number>;
dataTable: DataTableComponent;
actions: ContentActionModel[];
contextActionHandler: Subject<any>;
data: ShareDataTableAdapter;
noPermission: boolean;
selection: NodeEntry[];
$folderNode: Subject<Node>;
allowFiltering: boolean;
orderBy: string[];
preselectedRows: DataRow[];
folderNode: Node;
private _pagination;
pagination: BehaviorSubject<PaginationModel>;
sortingSubject: BehaviorSubject<DataSorting[]>;
private rowMenuCache;
private loadingTimeout;
private readonly destroyRef;
private _nodesApi;
get nodesApi(): NodesApi;
constructor(documentListService: DocumentListService, elementRef: ElementRef, appConfig: AppConfigService, userPreferencesService: UserPreferencesService, contentService: ContentService, thumbnailService: ThumbnailService, alfrescoApiService: AlfrescoApiService, nodeService: NodesApiService, dataTableService: DataTableService, lockService: LockService, dialog: MatDialog);
getContextActions(node: NodeEntry): {
model: ContentActionModel;
node: NodeEntry;
subject: Subject<any>;
}[];
private getDefaultSorting;
isMobile(): boolean;
isEmpty(): boolean;
ngOnInit(): void;
ngAfterContentInit(): void;
ngOnChanges(changes: SimpleChanges): void;
reload(hideLoadingSpinner?: boolean): void;
reloadWithoutResettingSelection(hideLoadingSpinner?: boolean): void;
contextActionCallback(action: any): void;
getNodeActions(node: NodeEntry | any): ContentActionModel[];
private refreshAction;
private isActionVisible;
private isActionDisabled;
onShowContextMenu(e?: Event): void;
navigateTo(node: Node | string): boolean;
private getNodeFolderDestinationId;
private isLinkFolder;
private updateCustomSourceData;
/**
* Invoked when executing content action for a document or folder.
*
* @param node Node to be the context of the execution.
* @param action Action to be executed against the context.
*/
executeContentAction(node: NodeEntry, action: ContentActionModel): void;
private setLoadingState;
loadFolder(hideLoadingSpinner?: boolean): void;
resetSelection(): void;
onPageLoaded(nodePaging: NodePaging): void;
onSortingChanged(event: CustomEvent): void;
private buildOrderByArray;
onPreviewFile(node: NodeEntry): void;
onColumnsVisibilityChange(columns: DataColumn[]): void;
onColumnOrderChange(columnsWithNewOrder: DataColumn[]): void;
onColumnsWidthChange(columns: DataColumn[]): void;
onSelectedItemsCountChanged(count: number): void;
onNodeClick(nodeEntry: NodeEntry): void;
onNodeDblClick(nodeEntry: NodeEntry): void;
executeActionClick(nodeEntry: NodeEntry): void;
onNodeSelect(event: {
row: ShareDataRow;
selection: Array<ShareDataRow>;
}): void;
onNodeUnselect(event: {
row: ShareDataRow;
selection: Array<ShareDataRow>;
}): void;
onShowRowContextMenu(event: DataCellEvent): void;
onShowRowActionsMenu(event: DataCellEvent): void;
onExecuteRowAction(event: DataRowActionEvent): void;
private enforceSingleClickNavigationForMobile;
canNavigateFolder(node: Node): boolean;
private onDataReady;
updatePagination(requestPaginationModel: RequestPaginationModel): void;
private syncPagination;
onFilterSelectionChange(activeFilters: FilterSearch[]): void;
resetNewFolderPagination(): void;
private handleError;
getPreselectedNodesBasedOnSelectionMode(): NodeEntry[];
getPreselectedRowsBasedOnSelectionMode(): DataRow[];
getSelectionBasedOnSelectionMode(): DataRow[];
onPreselectNodes(): void;
private preserveExistingSelection;
preselectRowsOfPreselectedNodes(): void;
unselectRowFromNodeId(nodeId: string): void;
private isSingleSelectionMode;
private isMultipleSelectionMode;
private hasPreselectedNodes;
private hasPreselectedRows;
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentListComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<DocumentListComponent, "adf-document-list", never, { "includeFields": { "alias": "includeFields"; "required": false; }; "where": { "alias": "where"; "required": false; }; "permissionsStyle": { "alias": "permissionsStyle"; "required": false; }; "locationFormat": { "alias": "locationFormat"; "required": false; }; "navigate": { "alias": "navigate"; "required": false; }; "showHeader": { "alias": "showHeader"; "required": false; }; "navigationMode": { "alias": "navigationMode"; "required": false; }; "thumbnails": { "alias": "thumbnails"; "required": false; }; "selectionMode": { "alias": "selectionMode"; "required": false; }; "multiselect": { "alias": "multiselect"; "required": false; }; "contentActions": { "alias": "contentActions"; "required": false; }; "contentActionsPosition": { "alias": "contentActionsPosition"; "required": false; }; "contextMenuActions": { "alias": "contextMenuActions"; "required": false; }; "emptyFolderImageUrl": { "alias": "emptyFolderImageUrl"; "required": false; }; "allowDropFiles": { "alias": "allowDropFiles"; "required": false; }; "sorting": { "alias": "sorting"; "required": false; }; "additionalSorting": { "alias": "additionalSorting"; "required": false; }; "sortingMode": { "alias": "sortingMode"; "required": false; }; "rowStyle": { "alias": "rowStyle"; "required": false; }; "rowStyleClass": { "alias": "rowStyleClass"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "_rowFilter": { "alias": "_rowFilter"; "required": false; }; "rowFilter": { "alias": "rowFilter"; "required": false; }; "imageResolver": { "alias": "imageResolver"; "required": false; }; "stickyHeader": { "alias": "stickyHeader"; "required": false; }; "headerFilters": { "alias": "headerFilters"; "required": false; }; "filterValue": { "alias": "filterValue"; "required": false; }; "currentFolderId": { "alias": "currentFolderId"; "required": false; }; "preselectNodes": { "alias": "preselectNodes"; "required": false; }; "node": { "alias": "node"; "required": false; }; "maxItems": { "alias": "maxItems"; "required": false; }; "columnsPresetKey": { "alias": "columnsPresetKey"; "required": false; }; "setColumnsVisibility": { "alias": "setColumnsVisibility"; "required": false; }; "setColumnsWidths": { "alias": "setColumnsWidths"; "required": false; }; "setColumnsOrder": { "alias": "setColumnsOrder"; "required": false; }; "maxColumnsVisible": { "alias": "maxColumnsVisible"; "required": false; }; "isResizingEnabled": { "alias": "isResizingEnabled"; "required": false; }; "blurOnResize": { "alias": "blurOnResize"; "required": false; }; "displayCheckboxesOnHover": { "alias": "displayCheckboxesOnHover"; "required": false; }; "displayDragAndDropHint": { "alias": "displayDragAndDropHint"; "required": false; }; }, { "nodeClick": "nodeClick"; "nodeDblClick": "nodeDblClick"; "folderChange": "folderChange"; "preview": "preview"; "ready": "ready"; "error": "error"; "nodeSelected": "nodeSelected"; "filterSelection": "filterSelection"; "columnsWidthChanged": "columnsWidthChanged"; "columnsVisibilityChanged": "columnsVisibilityChanged"; "columnsOrderChanged": "columnsOrderChanged"; "selectedItemsCountChanged": "selectedItemsCountChanged"; }, ["columnList", "customLoadingContent", "customNoPermissionsTemplate", "customNoContentTemplate"], ["adf-custom-empty-content-template, empty-folder-content", "adf-custom-no-permission-template, no-permission-content", "adf-custom-loading-content-template"], true, never>;
}