ntk-cms-filemanager
Version:
Ntk Cms Api And Model For Typscript
492 lines (464 loc) • 22.7 kB
TypeScript
import * as i0 from '@angular/core';
import { OnInit, AfterViewInit, TemplateRef, EventEmitter, ElementRef, ChangeDetectorRef, PipeTransform, ModuleWithProviders } from '@angular/core';
import * as i15 from '@ngx-translate/core';
import { TranslateService } from '@ngx-translate/core';
import * as i16 from 'ngx-ntk-smart-module';
import { NtkSmartModalService } from 'ngx-ntk-smart-module';
import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { FileContentService, FileCategoryService } from 'ntk-cms-api';
import * as i17 from 'ngx-ntk-file-picker';
import { FilePickerAdapter, FilePreviewModel, UploadResponse, UploaderCaptions, ValidationError } from 'ngx-ntk-file-picker';
import * as i14 from '@angular/common';
declare class ComponentOptionModel {
childMethods: any;
parentMethods: any;
data: any;
}
declare enum DownloadModeEnum {
DOWNLOAD_DISABLED = 0,
DOWNLOAD_FILES = 1,
DOWNLOAD_ALL = 2
}
interface ConfigInterface {
baseURL: string;
baseUploadURL: string;
api: {
listFile: string;
listFolder: string;
uploadFile: string;
downloadFile: string;
deleteFile: string;
deleteFolder: string;
createFolder: string;
createFile: string;
getOneFile: string;
getOneFolder: string;
renameFile: string;
renameFolder: string;
searchFiles: string;
};
options: {
title: string;
allowFolderDownload: DownloadModeEnum;
showFilesInsideTree: boolean;
showSelectFile: boolean;
showSelectFolder: boolean;
fileUplodMaxCount: number;
fileUplodTypeAccept: string;
fileUplodExtensions: string[];
};
}
interface NodeInterface {
isRoot: boolean;
id: number;
pathToNode: string;
pathToParent: string;
isFolder: boolean;
isExpanded: boolean;
stayOpen?: boolean;
name?: string;
children?: any;
extension?: string;
size?: number;
parentId?: number;
createdDate?: Date;
updatedDate?: Date;
downloadLinksrc?: string;
downloadThumbnailSrc?: string;
}
declare class TreeModel {
private _currentPath;
private _nodes;
private _selectedNodeId;
config: ConfigInterface;
constructor(config: ConfigInterface);
get currentPath(): string;
set currentPath(value: string);
get nodes(): NodeInterface;
set nodes(value: NodeInterface);
get selectedNodeId(): string;
set selectedNodeId(value: string);
}
interface StateInterface {
path: string;
selectedNode: NodeInterface;
isLoading: boolean;
inProcessingList: Array<string>;
}
interface AppStore {
fileManagerState: StateInterface;
}
declare class FileManagerStoreService {
private state;
private sub;
constructor();
dispatch(param: Actions): void;
getState<R>(mapFn: (value: AppStore, index: number) => R): Observable<R>;
processStart(name: string): void;
processStop(name: string): void;
static ɵfac: i0.ɵɵFactoryDeclaration<FileManagerStoreService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<FileManagerStoreService>;
}
interface ActionInterface {
readonly type: string;
payload?: any;
}
declare class SetPath implements ActionInterface {
readonly type = "SET_PATH";
payload: string;
}
declare class SetLoadingState implements ActionInterface {
readonly type = "SET_LOADING_STATE";
payload: boolean;
}
declare class SetInProcessingList implements ActionInterface {
readonly type = "SET_IN_PROCESSING_LIST";
payload: Array<string>;
}
declare class SetSelectedNode implements ActionInterface {
readonly type = "SET_SELECTED_NODE";
payload: NodeInterface;
}
type Actions = SetPath | SetLoadingState | SetSelectedNode | SetInProcessingList;
declare class NodeService {
private http;
private store;
private fileContentService;
private fileCategoryService;
serviceTree: TreeModel;
private privatePath;
constructor(http: HttpClient, store: FileManagerStoreService, fileContentService: FileContentService, fileCategoryService: FileCategoryService);
/** GUID */
private guid;
private S4;
newGuid(): string;
/** GUID */
startManagerAt(path: string): void;
refreshCurrentPath_orginal(): void;
refreshCurrentPath(): void;
getNodes_orginal(path: string): Promise<Array<NodeInterface>>;
getNodes(path: string): Promise<Array<NodeInterface>>;
private getParentPath_orginal;
private getParentPath;
private parseNodes_orginal;
private parseNodes;
private createNode_orginal;
private createNode;
private getNodesFromServer_orginal;
private getNodesFromServer;
findNodeByPath_orginal(nodePath: string): NodeInterface;
findNodeByPath(nodePath: string): NodeInterface;
findNodeById_orginal(id: number): NodeInterface;
findNodeById(id: number): NodeInterface;
findNodeByIdHelper_orginal(id: number, node?: NodeInterface): any;
findNodeByIdHelper(id: number, node?: NodeInterface): any;
foldRecursively_orginal(node: NodeInterface): void;
foldRecursively(node: NodeInterface): void;
foldAll_orginal(): void;
foldAll(refresh?: boolean): void;
get currentPath(): string;
set currentPath(value: string);
getCategoryList(folderId: number, path: string): Observable<Array<NodeInterface>>;
getFileList(folderId: number, path: string): Observable<Array<NodeInterface>>;
static ɵfac: i0.ɵɵFactoryDeclaration<NodeService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<NodeService>;
}
declare class NodeClickedService {
ngxSmartModalService: NtkSmartModalService;
private nodeService;
private store;
private http;
private fileContentService;
private fileCategoryService;
serviceTree: TreeModel;
constructor(ngxSmartModalService: NtkSmartModalService, nodeService: NodeService, store: FileManagerStoreService, http: HttpClient, fileContentService: FileContentService, fileCategoryService: FileCategoryService);
startDownload_orginal(node: NodeInterface): void;
startDownload(node: NodeInterface): void;
initDelete_orginal(node: NodeInterface): void;
initDelete(node: NodeInterface): void;
searchForString_orginal(input: string): void;
searchForString(input: string): void;
createFolder_orginal(currentParent: number, newDirName: string): void;
createFolder(currentParent: number, newDirName: string): void;
createFile(currentParent: number, fileName: string, uploadFileGUID: string, successMethod: any, failMethod: any): void;
rename_orginal(node: NodeInterface, newName: string): void;
rename(node: NodeInterface, newName: string): void;
private sideEffectHelper;
private reachServer;
private successWithSideViewClose;
private searchSuccess;
private actionSuccess;
private actionFailed;
static ɵfac: i0.ɵɵFactoryDeclaration<NodeClickedService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<NodeClickedService>;
}
declare class TranslateUiService {
private translateService;
private http;
private availableLanguages;
private translationPath;
constructor(translateService: TranslateService, http: HttpClient);
init(language?: string): void;
private loadTranslation;
setLanguage(language: string): void;
getCurrentLanguage(): string;
getAvailableLanguages(): string[];
static ɵfac: i0.ɵɵFactoryDeclaration<TranslateUiService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<TranslateUiService>;
}
declare class CmsFileManagerComponent implements OnInit, AfterViewInit {
private store;
private nodeService;
private nodeClickedService;
ngxSmartModalService: NtkSmartModalService;
translate: TranslateService;
private cdr;
private el;
private translateUiService;
private _language;
set language(value: string);
get language(): string;
iconTemplate: TemplateRef<any>;
folderContentTemplate: TemplateRef<any>;
folderContentBackTemplate: TemplateRef<any>;
folderContentNewFileTemplate: TemplateRef<any>;
folderContentNewFolderTemplate: TemplateRef<any>;
folderContentReloadTemplate: TemplateRef<any>;
openFilemanagerButtonView: boolean;
openDirectUploadSave: boolean;
openDirectUploadView: boolean;
loadingOverlayTemplate: TemplateRef<any>;
sideViewTemplate: TemplateRef<any>;
set selectFileType(model: Array<string>);
configSelectFileType: Array<string>;
tree: TreeModel;
isPopup: boolean;
openFilemanagerButtonLabelKey: string;
openSelectFileDescription: string;
itemClicked: EventEmitter<any>;
itemSelected: EventEmitter<any>;
openPopupForm: boolean;
openFormChange: EventEmitter<boolean>;
set openForm(model: boolean);
get openForm(): boolean;
openFilemanagerButtonLabel: string;
selectedNode: NodeInterface;
sideMenuClosed: boolean;
loading: boolean;
newFileDialog: boolean;
newFolderDialog: boolean;
HighestZIndex: number;
startManagerRuned: boolean;
mainModal: ElementRef;
constructor(store: FileManagerStoreService, nodeService: NodeService, nodeClickedService: NodeClickedService, ngxSmartModalService: NtkSmartModalService, translate: TranslateService, cdr: ChangeDetectorRef, el: ElementRef, translateUiService: TranslateUiService);
ngOnInit(): void;
ngAfterViewInit(): void;
onItemClicked(event: any): void;
searchClicked(data: any): void;
handleFileManagerClickEvent(event: any): any;
nodeClickHandler(node: NodeInterface, closing?: boolean): void;
highlightSelected(node: NodeInterface): void;
private highilghtChildElement;
private getElementById;
private removeClass;
fmShowHide(act: boolean): void;
onActionOpen(status: boolean): void;
backdropClicked(): void;
handleUploadDialog(event: any): void;
handleNewFolderDialog(event: any): void;
confirmSelection(): void;
allowConfirmSelection(selectedNode: NodeInterface): boolean;
cancelSelection(): void;
AllowFileView(model: NodeInterface): boolean;
findHighestZIndex(elem: string): number;
AllowViewImage(node: NodeInterface): boolean;
static ɵfac: i0.ɵɵFactoryDeclaration<CmsFileManagerComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<CmsFileManagerComponent, "cms-file-manager", never, { "language": { "alias": "language"; "required": false; }; "iconTemplate": { "alias": "iconTemplate"; "required": false; }; "folderContentTemplate": { "alias": "folderContentTemplate"; "required": false; }; "folderContentBackTemplate": { "alias": "folderContentBackTemplate"; "required": false; }; "folderContentNewFileTemplate": { "alias": "folderContentNewFileTemplate"; "required": false; }; "folderContentNewFolderTemplate": { "alias": "folderContentNewFolderTemplate"; "required": false; }; "folderContentReloadTemplate": { "alias": "folderContentReloadTemplate"; "required": false; }; "openFilemanagerButtonView": { "alias": "openFilemanagerButtonView"; "required": false; }; "openDirectUploadSave": { "alias": "openDirectUploadSave"; "required": false; }; "openDirectUploadView": { "alias": "openDirectUploadView"; "required": false; }; "loadingOverlayTemplate": { "alias": "loadingOverlayTemplate"; "required": false; }; "sideViewTemplate": { "alias": "sideViewTemplate"; "required": false; }; "selectFileType": { "alias": "selectFileType"; "required": false; }; "tree": { "alias": "tree"; "required": false; }; "isPopup": { "alias": "isPopup"; "required": false; }; "openFilemanagerButtonLabelKey": { "alias": "openFilemanagerButtonLabelKey"; "required": false; }; "openSelectFileDescription": { "alias": "openSelectFileDescription"; "required": false; }; "openForm": { "alias": "openForm"; "required": false; }; }, { "itemClicked": "itemClicked"; "itemSelected": "itemSelected"; "openFormChange": "openFormChange"; }, never, never, false, never>;
}
declare class FolderContentComponent implements OnInit {
private nodeService;
private store;
private cdr;
folderContentTemplate: TemplateRef<any>;
folderContentBackTemplate: TemplateRef<any>;
folderContentNewFolderTemplate: TemplateRef<any>;
folderContentNewFileTemplate: TemplateRef<any>;
folderContentReloadTemplate: TemplateRef<any>;
openUploadDialog: EventEmitter<any>;
openNewFolderDialog: EventEmitter<any>;
nodes: NodeInterface;
obj: ObjectConstructor;
constructor(nodeService: NodeService, store: FileManagerStoreService, cdr: ChangeDetectorRef);
ngOnInit(): void;
newFileClickedAction(): void;
newFolderClickedAction(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<FolderContentComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<FolderContentComponent, "lib-filemanager-folder-content", never, { "folderContentTemplate": { "alias": "folderContentTemplate"; "required": false; }; "folderContentBackTemplate": { "alias": "folderContentBackTemplate"; "required": false; }; "folderContentNewFolderTemplate": { "alias": "folderContentNewFolderTemplate"; "required": false; }; "folderContentNewFileTemplate": { "alias": "folderContentNewFileTemplate"; "required": false; }; "folderContentReloadTemplate": { "alias": "folderContentReloadTemplate"; "required": false; }; }, { "openUploadDialog": "openUploadDialog"; "openNewFolderDialog": "openNewFolderDialog"; }, never, never, false, never>;
}
declare class NodeComponent implements OnInit {
private store;
private nodeService;
private nodeClickedService;
private cdr;
node: NodeInterface;
isSingleClick: boolean;
constructor(store: FileManagerStoreService, nodeService: NodeService, nodeClickedService: NodeClickedService, cdr: ChangeDetectorRef);
selectedNode: NodeInterface;
method1CallForClick(event: MouseEvent): void;
method2CallForDblClick(event: any): void;
ngOnInit(): void;
private open;
private showMenu;
private toggleNodeExpanded;
private setNodeSelectedState;
static ɵfac: i0.ɵɵFactoryDeclaration<NodeComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NodeComponent, "lib-filemanager-node", never, { "node": { "alias": "node"; "required": false; }; }, {}, never, ["*"], false, never>;
}
declare class TreeComponent implements AfterViewInit, OnInit {
private nodeService;
private store;
private cdr;
templateRef: TemplateRef<any>;
treeModel: TreeModel;
config: ConfigInterface;
nodes: NodeInterface;
currentTreeLevel: string;
constructor(nodeService: NodeService, store: FileManagerStoreService, cdr: ChangeDetectorRef);
ngOnInit(): void;
ngAfterViewInit(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<TreeComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<TreeComponent, "lib-filemanager-tree", never, { "treeModel": { "alias": "treeModel"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, {}, ["templateRef"], never, false, never>;
}
declare class NodeListerComponent implements OnInit {
private store;
private cdr;
templateRef: TemplateRef<any>;
nodes: NodeInterface;
showFiles: boolean;
obj: ObjectConstructor;
constructor(store: FileManagerStoreService, cdr: ChangeDetectorRef);
ngOnInit(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<NodeListerComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NodeListerComponent, "lib-filemanager-node-lister", never, { "nodes": { "alias": "nodes"; "required": false; }; "showFiles": { "alias": "showFiles"; "required": false; }; }, {}, ["templateRef"], never, false, never>;
}
declare class NavBarComponent implements OnInit {
private store;
private nodeService;
private cdr;
currentPath: string[];
constructor(store: FileManagerStoreService, nodeService: NodeService, cdr: ChangeDetectorRef);
ngOnInit(): void;
onClick(path: string[], index: number): void;
static ɵfac: i0.ɵɵFactoryDeclaration<NavBarComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NavBarComponent, "lib-filemanager-nav-bar", never, {}, {}, never, never, false, never>;
}
declare class NavigationComponent implements OnInit {
private nodeClickedService;
constructor(nodeClickedService: NodeClickedService);
ngOnInit(): void;
onClick(input: string): void;
static ɵfac: i0.ɵɵFactoryDeclaration<NavigationComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NavigationComponent, "lib-filemanager-navigation", never, {}, {}, never, ["*"], false, never>;
}
declare class LoadingOverlayComponent implements OnInit {
private translateService;
loadingOverlayTemplate: TemplateRef<any>;
timeoutMessage: any;
constructor(translateService: TranslateService);
ngOnInit(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<LoadingOverlayComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<LoadingOverlayComponent, "lib-filemanager-loading-overlay", never, { "loadingOverlayTemplate": { "alias": "loadingOverlayTemplate"; "required": false; }; }, {}, never, never, false, never>;
}
declare class FileUploaderPickerAdapter extends FilePickerAdapter {
private http;
constructor(http: HttpClient);
baseUploadURL: string;
routeUpload: string;
uploadFile(fileItem: FilePreviewModel): Observable<UploadResponse>;
removeFile(fileItem: FilePreviewModel): Observable<any>;
}
declare class UploadComponent implements OnInit, AfterViewInit {
private http;
private nodeService;
set optionSelectFileType(model: string | string[]);
constructor(http: HttpClient, nodeService: NodeService);
get getCurrentPath(): any;
createFile: EventEmitter<any>;
openDialog: boolean;
openSelectFileDescription: string;
closeDialog: EventEmitter<any>;
openDirectUploadSave: boolean;
openDirectUploadView: boolean;
adapter: FileUploaderPickerAdapter;
fileUplodMaxCount: number;
fileTypeAccept: string;
fileExtensions: string[];
counter: number;
myFiles: FilePreviewModel[];
captions: UploaderCaptions;
ngOnInit(): void;
ngAfterViewInit(): void;
uploadFiles(): void;
allowClose: boolean;
newClickedAction(): void;
onFileAdded(model: FilePreviewModel): void;
onUploadSuccess(model: FilePreviewModel): void;
onValidationError(error: ValidationError): void;
onRemoveSuccess(e: FilePreviewModel): void;
myCustomValidator(file: File): Observable<boolean>;
static ɵfac: i0.ɵɵFactoryDeclaration<UploadComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<UploadComponent, "lib-filemanager-upload", never, { "optionSelectFileType": { "alias": "optionSelectFileType"; "required": false; }; "openDialog": { "alias": "openDialog"; "required": false; }; "openSelectFileDescription": { "alias": "openSelectFileDescription"; "required": false; }; "openDirectUploadSave": { "alias": "openDirectUploadSave"; "required": false; }; "openDirectUploadView": { "alias": "openDirectUploadView"; "required": false; }; }, { "createFile": "createFile"; "closeDialog": "closeDialog"; }, never, never, false, never>;
}
declare class NewFolderComponent implements OnInit {
private translateService;
openDialog: boolean;
uploadFolder: ElementRef;
buttonClicked: EventEmitter<any>;
closeDialog: EventEmitter<any>;
createDir: EventEmitter<any>;
buttonText: string;
inputValue: string;
constructor(translateService: TranslateService);
ngOnInit(): void;
onClick(): void;
onInputChange(event: any): void;
newClickedAction(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<NewFolderComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NewFolderComponent, "lib-filemanager-newfolder", never, { "openDialog": { "alias": "openDialog"; "required": false; }; }, { "buttonClicked": "buttonClicked"; "closeDialog": "closeDialog"; "createDir": "createDir"; }, never, never, false, never>;
}
declare class SideViewComponent implements OnInit {
private store;
private cdr;
sideViewTemplate: TemplateRef<any>;
node: NodeInterface;
allowFolderDownload: DownloadModeEnum;
clickEvent: EventEmitter<any>;
constructor(store: FileManagerStoreService, cdr: ChangeDetectorRef);
ngOnInit(): void;
onClick(event: any, type: string): void;
isDisabled(): boolean;
AllowPlayMP3(node: NodeInterface): boolean;
AllowViewImage(node: NodeInterface): boolean;
static ɵfac: i0.ɵɵFactoryDeclaration<SideViewComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<SideViewComponent, "lib-filemanager-side-view", never, { "sideViewTemplate": { "alias": "sideViewTemplate"; "required": false; }; "node": { "alias": "node"; "required": false; }; "allowFolderDownload": { "alias": "allowFolderDownload"; "required": false; }; }, { "clickEvent": "clickEvent"; }, never, never, false, never>;
}
declare class MapToIterablePipe implements PipeTransform {
transform(dict: any): any[];
static ɵfac: i0.ɵɵFactoryDeclaration<MapToIterablePipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<MapToIterablePipe, "mapToIterablePipe", false>;
}
declare class FileSizePipe implements PipeTransform {
private units;
transform(bytes?: number, precision?: number): string;
static ɵfac: i0.ɵɵFactoryDeclaration<FileSizePipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<FileSizePipe, "fileSize", false>;
}
declare class CmsFileManagerModule {
static forRoot(): ModuleWithProviders<CmsFileManagerModule>;
static ɵfac: i0.ɵɵFactoryDeclaration<CmsFileManagerModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<CmsFileManagerModule, [typeof CmsFileManagerComponent, typeof FolderContentComponent, typeof NodeComponent, typeof TreeComponent, typeof NodeListerComponent, typeof NavBarComponent, typeof NavigationComponent, typeof LoadingOverlayComponent, typeof UploadComponent, typeof NewFolderComponent, typeof SideViewComponent, typeof MapToIterablePipe, typeof FileSizePipe], [typeof i14.CommonModule, typeof i15.TranslateModule, typeof i16.NtkSmartModalModule, typeof i17.FilePickerModule], [typeof CmsFileManagerComponent]>;
static ɵinj: i0.ɵɵInjectorDeclaration<CmsFileManagerModule>;
}
export { CmsFileManagerComponent, CmsFileManagerModule, ComponentOptionModel, DownloadModeEnum, FolderContentComponent, LoadingOverlayComponent, NavBarComponent, NavigationComponent, NewFolderComponent, NodeComponent, NodeListerComponent, NodeService, SideViewComponent, TranslateUiService, TreeComponent, TreeModel, UploadComponent };
export type { ConfigInterface, NodeInterface, StateInterface };