[ADF-] update library to use new js-api 3.0.0 (#4097)

This commit is contained in:
Eugenio Romano
2019-01-06 23:57:01 +01:00
committed by Eugenio Romano
parent 2acd1b4e26
commit 3ef7d3b7ea
430 changed files with 1966 additions and 2149 deletions

View File

@@ -47,9 +47,9 @@ export class HighlightDirective {
const elements = this.el.nativeElement.querySelectorAll(selector);
elements.forEach((element) => {
const result: HighlightTransformResult = this.highlightTransformService.highlight(element.innerHTML, search, classToApply);
if (result.changed) {
this.renderer.setProperty(element, 'innerHTML', result.text);
const highlightTransformResult: HighlightTransformResult = this.highlightTransformService.highlight(element.innerHTML, search, classToApply);
if (highlightTransformResult.changed) {
this.renderer.setProperty(element, 'innerHTML', highlightTransformResult.text);
}
});
}

View File

@@ -18,14 +18,14 @@
/* tslint:disable:no-input-rename */
import { Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output } from '@angular/core';
import { MinimalNodeEntity, MinimalNodeEntryEntity, DeletedNodeEntity, DeletedNodeMinimalEntry } from 'alfresco-js-api';
import { NodeEntry, Node, DeletedNodeEntity, DeletedNode } from '@alfresco/js-api';
import { Observable, forkJoin, from, of } from 'rxjs';
import { AlfrescoApiService } from '../services/alfresco-api.service';
import { TranslationService } from '../services/translation.service';
import { map, catchError } from 'rxjs/operators';
interface ProcessedNodeData {
entry: MinimalNodeEntryEntity | DeletedNodeMinimalEntry;
entry: Node | DeletedNode;
status: number;
}
@@ -52,7 +52,7 @@ interface ProcessStatus {
export class NodeDeleteDirective implements OnChanges {
/** Array of nodes to delete. */
@Input('adf-delete')
selection: MinimalNodeEntity[] | DeletedNodeEntity[];
selection: NodeEntry[] | DeletedNodeEntity[];
/** If true then the nodes are deleted immediately rather than being put in the trash */
@Input()
@@ -86,7 +86,7 @@ export class NodeDeleteDirective implements OnChanges {
this.elementRef.nativeElement.disabled = disable;
}
private process(selection: MinimalNodeEntity[] | DeletedNodeEntity[]) {
private process(selection: NodeEntry[] | DeletedNodeEntity[]) {
if (selection && selection.length) {
const batch = this.getDeleteNodesBatch(selection);
@@ -105,7 +105,7 @@ export class NodeDeleteDirective implements OnChanges {
return selection.map((node) => this.deleteNode(node));
}
private deleteNode(node: MinimalNodeEntity | DeletedNodeEntity): Observable<ProcessedNodeData> {
private deleteNode(node: NodeEntry | DeletedNodeEntity): Observable<ProcessedNodeData> {
const id = (<any> node.entry).nodeId || node.entry.id;
let promise;

View File

@@ -19,7 +19,7 @@ import { Directive, Input, HostListener } from '@angular/core';
import { MatDialog } from '@angular/material';
import { AlfrescoApiService } from '../services/alfresco-api.service';
import { DownloadZipDialogComponent } from '../dialogs/download-zip.dialog';
import { MinimalNodeEntity } from 'alfresco-js-api';
import { NodeEntry } from '@alfresco/js-api';
@Directive({
selector: '[adfNodeDownload]'
@@ -29,7 +29,7 @@ export class NodeDownloadDirective {
/** Nodes to download. */
// tslint:disable-next-line:no-input-rename
@Input('adfNodeDownload')
nodes: MinimalNodeEntity | MinimalNodeEntity[];
nodes: NodeEntry | NodeEntry[];
@HostListener('click')
onClick() {
@@ -46,7 +46,7 @@ export class NodeDownloadDirective {
* Packs result into a .ZIP archive if there is more than one node selected.
* @param selection Multiple selected nodes to download
*/
downloadNodes(selection: MinimalNodeEntity | Array<MinimalNodeEntity>) {
downloadNodes(selection: NodeEntry | Array<NodeEntry>) {
if (!this.isSelectionValid(selection)) {
return;
@@ -67,7 +67,7 @@ export class NodeDownloadDirective {
* Packs result into a .ZIP archive is the node is a Folder.
* @param node Node to download
*/
downloadNode(node: MinimalNodeEntity) {
downloadNode(node: NodeEntry) {
if (node && node.entry) {
const entry = node.entry;
@@ -86,11 +86,11 @@ export class NodeDownloadDirective {
}
}
private isSelectionValid(selection: MinimalNodeEntity | Array<MinimalNodeEntity>) {
private isSelectionValid(selection: NodeEntry | Array<NodeEntry>) {
return selection || (selection instanceof Array && selection.length > 0);
}
private downloadFile(node: MinimalNodeEntity) {
private downloadFile(node: NodeEntry) {
if (node && node.entry) {
const contentApi = this.apiService.getInstance().content;
// nodeId for Shared node
@@ -103,7 +103,7 @@ export class NodeDownloadDirective {
}
}
private downloadZip(selection: Array<MinimalNodeEntity>) {
private downloadZip(selection: Array<NodeEntry>) {
if (selection && selection.length > 0) {
// nodeId for Shared node
const nodeIds = selection.map((node: any) => (node.entry.nodeId || node.entry.id));

View File

@@ -18,7 +18,7 @@
/* tslint:disable:no-input-rename */
import { Directive, EventEmitter, HostListener, Input, OnChanges, Output } from '@angular/core';
import { FavoriteBody, MinimalNodeEntity } from 'alfresco-js-api';
import { FavoriteBody, NodeEntry } from '@alfresco/js-api';
import { Observable, from, forkJoin, of } from 'rxjs';
import { AlfrescoApiService } from '../services/alfresco-api.service';
import { catchError, map } from 'rxjs/operators';
@@ -32,7 +32,7 @@ export class NodeFavoriteDirective implements OnChanges {
/** Array of nodes to toggle as favorites. */
@Input('adf-node-favorite')
selection: MinimalNodeEntity[] = [];
selection: NodeEntry[] = [];
/** Emitted when the favorite setting is complete. */
@Output() toggle: EventEmitter<any> = new EventEmitter();
@@ -97,7 +97,7 @@ export class NodeFavoriteDirective implements OnChanges {
}
}
markFavoritesNodes(selection: MinimalNodeEntity[]) {
markFavoritesNodes(selection: NodeEntry[]) {
if (selection.length <= this.favorites.length) {
const newFavorites = this.reduce(this.favorites, selection);
this.favorites = newFavorites;
@@ -120,10 +120,10 @@ export class NodeFavoriteDirective implements OnChanges {
}
private getProcessBatch(selection): any[] {
return selection.map((selected: MinimalNodeEntity) => this.getFavorite(selected));
return selection.map((selected: NodeEntry) => this.getFavorite(selected));
}
private getFavorite(selected: MinimalNodeEntity): Observable<any> {
private getFavorite(selected: NodeEntry): Observable<any> {
const node = selected.entry;
// ACS 6.x with 'isFavorite' include
@@ -133,8 +133,7 @@ export class NodeFavoriteDirective implements OnChanges {
// ACS 5.x and 6.x without 'isFavorite' include
const { name, isFile, isFolder } = node;
// shared files have nodeId
const id = node.nodeId || node.id;
const id = node.id;
const promise = this.alfrescoApiService.favoritesApi.getFavorite('-me-', id);

View File

@@ -18,7 +18,7 @@
/* tslint:disable:no-input-rename */
import { ChangeDetectorRef, Directive, ElementRef, Host, Inject, Input, OnChanges, Optional, Renderer2, SimpleChanges } from '@angular/core';
import { MinimalNodeEntity } from 'alfresco-js-api';
import { NodeEntry } from '@alfresco/js-api';
import { ContentService } from './../services/content.service';
import { EXTENDIBLE_COMPONENT } from './../interface/injection.tokens';
@@ -39,7 +39,7 @@ export class NodePermissionDirective implements OnChanges {
/** Nodes to check permission for. */
@Input('adf-nodes')
nodes: MinimalNodeEntity[] = [];
nodes: NodeEntry[] = [];
constructor(private elementRef: ElementRef,
private renderer: Renderer2,
@@ -117,7 +117,7 @@ export class NodePermissionDirective implements OnChanges {
* @param permission Permission to check for each node
* @memberof NodePermissionDirective
*/
hasPermission(nodes: MinimalNodeEntity[], permission: string): boolean {
hasPermission(nodes: NodeEntry[], permission: string): boolean {
if (nodes && nodes.length > 0) {
return nodes.every((node) => this.contentService.hasPermission(node.entry, permission));
}

View File

@@ -18,7 +18,7 @@
/* tslint:disable:component-selector no-input-rename */
import { Directive, EventEmitter, HostListener, Input, Output } from '@angular/core';
import { DeletedNodeEntry, DeletedNodesPaging, PathInfoEntity } from 'alfresco-js-api';
import { DeletedNodeEntry, DeletedNodesPaging, PathInfoEntity } from '@alfresco/js-api';
import { Observable, forkJoin, from, of } from 'rxjs';
import { AlfrescoApiService } from '../services/alfresco-api.service';
import { TranslationService } from '../services/translation.service';

View File

@@ -68,7 +68,7 @@ export class UploadDirective implements OnInit, OnDestroy {
this.upload.type = 'file';
this.upload.style.display = 'none';
this.upload.addEventListener('change', (e) => this.onSelectFiles(e));
this.upload.addEventListener('change', (event) => this.onSelectFiles(event));
if (this.multiple) {
this.upload.setAttribute('multiple', '');
@@ -153,7 +153,7 @@ export class UploadDirective implements OnInit, OnDestroy {
onUploadFiles(files: FileInfo[]) {
if (this.enabled && files.length > 0) {
let e = new CustomEvent('upload-files', {
let customEvent = new CustomEvent('upload-files', {
detail: {
sender: this,
data: this.data,
@@ -162,7 +162,7 @@ export class UploadDirective implements OnInit, OnDestroy {
bubbles: true
});
this.el.nativeElement.dispatchEvent(e);
this.el.nativeElement.dispatchEvent(customEvent);
}
}
@@ -245,18 +245,18 @@ export class UploadDirective implements OnInit, OnDestroy {
/**
* Invoked when user selects files or folders by means of File Dialog
* @param e DOM event
* @param event DOM event
*/
onSelectFiles(e: any): void {
onSelectFiles(event: any): void {
if (this.isClickMode()) {
const input = (<HTMLInputElement> e.currentTarget);
const input = (<HTMLInputElement> event.currentTarget);
const files = FileUtils.toFileArray(input.files);
this.onUploadFiles(files.map((file) => <FileInfo> {
entry: null,
file: file,
relativeFolder: '/'
}));
e.target.value = '';
event.target.value = '';
}
}
}