@alfresco/adf-content-services
Version:
Alfresco ADF content services
98 lines (97 loc) • 4.58 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 { FileInfo, TranslationService } from '@alfresco/adf-core';
import { FileUploadErrorEvent } from '../../../common/events/file.event';
import { FileModel } from '../../../common/models/file.model';
import { UploadService } from '../../../common/services/upload.service';
import { EventEmitter, NgZone, OnInit } from '@angular/core';
import { UploadFilesEvent } from '../upload-files.event';
import * as i0 from "@angular/core";
export declare abstract class UploadBase implements OnInit {
protected uploadService: UploadService;
protected translationService: TranslationService;
protected ngZone: NgZone;
/**
* Sets a limit on the maximum size (in bytes) of a file to be uploaded.
* Has no effect if undefined.
*/
maxFilesSize: number;
/**
* The ID of the root. Use the nodeId for
* Content Services or the taskId/processId for Process Services.
*/
rootFolderId: string;
/** Toggles component disabled state (if there is no node permission checking). */
disabled: boolean;
/** Filter for accepted file types. */
acceptedFilesType: string;
/** Toggles versioning. */
versioning: boolean;
/** majorVersion boolean field to true to indicate a major version should be created. */
majorVersion: boolean;
/** When you overwrite existing content, you can use the comment field to add a version comment that appears in the version history */
comment: string;
/** Custom node type for uploaded file */
nodeType: string;
/** Emitted when the file is uploaded successfully. */
success: EventEmitter<any>;
/** Emitted when an error occurs. */
error: EventEmitter<FileUploadErrorEvent>;
/** Emitted when the upload begins. */
beginUpload: EventEmitter<UploadFilesEvent>;
/** Emitted when dropping a file over another file to update the version. */
updateFileVersion: EventEmitter<CustomEvent<any>>;
private readonly destroyRef;
ngOnInit(): void;
/**
* Upload a list of file in the specified path
*
* @param files files to upload
*/
uploadFiles(files: File[]): void;
uploadFilesInfo(files: FileInfo[]): void;
private uploadQueue;
/**
* Checks if the given file is allowed by the extension filters
*
* @param file FileModel
* @returns `true` if file is acceptable, otherwise `false`
*/
protected isFileAcceptable(file: FileModel): boolean;
/**
* Creates FileModel from File
*
* @param file file instance
* @param parentId parent id
* @param path upload path
* @param id model id
* @returns file model
*/
protected createFileModel(file: File, parentId: string, path: string, id?: string): FileModel;
protected isFileSizeAllowed(file: FileModel): boolean;
protected isMaxFileSizeDefined(): boolean;
protected isFileSizeCorrect(file: FileModel): boolean;
/**
* Checks if the given file is an acceptable size
*
* @param file FileModel
* @returns `true` if file size is acceptable, otherwise `false`
*/
private isFileSizeAcceptable;
static ɵfac: i0.ɵɵFactoryDeclaration<UploadBase, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<UploadBase, never, never, { "maxFilesSize": { "alias": "maxFilesSize"; "required": false; }; "rootFolderId": { "alias": "rootFolderId"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "acceptedFilesType": { "alias": "acceptedFilesType"; "required": false; }; "versioning": { "alias": "versioning"; "required": false; }; "majorVersion": { "alias": "majorVersion"; "required": false; }; "comment": { "alias": "comment"; "required": false; }; "nodeType": { "alias": "nodeType"; "required": false; }; }, { "success": "success"; "error": "error"; "beginUpload": "beginUpload"; "updateFileVersion": "updateFileVersion"; }, never, never, false, never>;
}