diff --git a/demo-shell/src/app/components/trashcan/trashcan.component.ts b/demo-shell/src/app/components/trashcan/trashcan.component.ts index 763367b1eb..b4a9b6e8f6 100644 --- a/demo-shell/src/app/components/trashcan/trashcan.component.ts +++ b/demo-shell/src/app/components/trashcan/trashcan.component.ts @@ -16,8 +16,8 @@ */ import { Component, ViewChild, OnInit, OnDestroy } from '@angular/core'; -import { DocumentListComponent } from '@alfresco/adf-content-services'; -import { UserPreferencesService, UserPreferenceValues, RestoreMessageModel, NotificationService } from '@alfresco/adf-core'; +import { DocumentListComponent, RestoreMessageModel } from '@alfresco/adf-content-services'; +import { UserPreferencesService, UserPreferenceValues, NotificationService } from '@alfresco/adf-core'; import { Router } from '@angular/router'; import { PathInfoEntity } from '@alfresco/js-api'; import { Subject } from 'rxjs'; diff --git a/docs/core/directives/check-allowable-operation.directive.md b/docs/content-services/directives/check-allowable-operation.directive.md similarity index 79% rename from docs/core/directives/check-allowable-operation.directive.md rename to docs/content-services/directives/check-allowable-operation.directive.md index 31f4225471..1714cf0b15 100644 --- a/docs/core/directives/check-allowable-operation.directive.md +++ b/docs/content-services/directives/check-allowable-operation.directive.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2019-02-13 --- -# [Check Allowable Operation directive](lib/core/src/lib/directives/check-allowable-operation.directive.ts "Defined in check-allowable-operation.directive.ts") +# [Check Allowable Operation directive](../../../lib/content-services/src/lib/directives/check-allowable-operation.directive.ts "Defined in check-allowable-operation.directive.ts") Selectively disables an HTML element or Angular component. @@ -47,7 +47,7 @@ Selectively disables an HTML element or Angular component. ## Details -The [Check Allowable Operation Directive](check-allowable-operation.directive.md) lets you disable an HTML element or Angular component +The [Check Allowable Operation Directive](../../../lib/content-services/src/lib/directives/check-allowable-operation.directive.ts) lets you disable an HTML element or Angular component by taking a collection of [`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md) instances and checking their permissions. The decorated element will be disabled if: @@ -57,7 +57,7 @@ The decorated element will be disabled if: ### HTML element example -A typical use case is to bind a [Document List](../../content-services/components/document-list.component.md) +A typical use case is to bind a [Document List](../components/document-list.component.md) selection property to a toolbar button. In the following example, the "Delete" button should be disabled if no selection is present or if user does not have permission to delete at least one node in the selection: @@ -80,8 +80,8 @@ one or more documents that they have permission to delete. ### Angular component example -You can add the directive to any Angular component that implements the [`NodeAllowableOperationSubject`](lib/core/src/lib/directives/check-allowable-operation.directive.ts) -interface (the [Upload Drag Area component](../../content-services/components/upload-drag-area.component.md), +You can add the directive to any Angular component that implements the [`NodeAllowableOperationSubject`](../../../lib/content-services/src/lib/interfaces/node-allowable-operation-subject.interface.ts) +interface (the [Upload Drag Area component](../components/upload-drag-area.component.md), for example). You can also use it in much the same way as you would with an HTML element: ```html @@ -95,14 +95,14 @@ for example). You can also use it in much the same way as you would with an HTML ``` To enable your own component to work with this directive, you need to implement the -[`NodeAllowableOperationSubject`](lib/core/src/lib/directives/check-allowable-operation.directive.ts) interface and also define it as an -[`EXTENDIBLE_COMPONENT`](lib/core/src/lib/interface/injection.tokens.ts) +[`NodeAllowableOperationSubject`](../../../lib/content-services/src/lib/interfaces/node-allowable-operation-subject.interface.ts) interface and also define it as an +[`EXTENDIBLE_COMPONENT`](../../../lib/core/src/lib/interface/injection.tokens.ts) parent component, as described in the following sections. ### Implementing the NodeAllowableOperationSubject interface -The component must implement the [`NodeAllowableOperationSubject`](lib/core/src/lib/directives/check-allowable-operation.directive.ts) interface which means it must have a +The component must implement the [`NodeAllowableOperationSubject`](../../../lib/content-services/src/lib/interfaces/node-allowable-operation-subject.interface.ts) interface which means it must have a boolean `disabled` property. This is the property that will be set by the directive: ```js @@ -121,7 +121,7 @@ up to the `@Host()` component. The host component is typically the component tha the dependency. However, when this component is projected into a parent component, the parent becomes the host. This means you must provide your component with forward referencing as the -[`EXTENDIBLE_COMPONENT`](lib/core/src/lib/interface/injection.tokens.ts) +[`EXTENDIBLE_COMPONENT`](../../../lib/core/src/lib/interface/injection.tokens.ts) and also provide your component as a `viewProvider`: ```js diff --git a/docs/core/directives/node-delete.directive.md b/docs/content-services/directives/node-delete.directive.md similarity index 90% rename from docs/core/directives/node-delete.directive.md rename to docs/content-services/directives/node-delete.directive.md index 8ce41b3889..3da6f3af84 100644 --- a/docs/core/directives/node-delete.directive.md +++ b/docs/content-services/directives/node-delete.directive.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2018-11-20 --- -# [Node Delete directive](lib/core/src/lib/directives/node-delete.directive.ts "Defined in node-delete.directive.ts") +# [Node Delete directive](../../../lib/content-services/src/lib/directives/node-delete.directive.ts "Defined in node-delete.directive.ts") Deletes multiple files and folders. diff --git a/docs/core/directives/node-favorite.directive.md b/docs/content-services/directives/node-favorite.directive.md similarity index 93% rename from docs/core/directives/node-favorite.directive.md rename to docs/content-services/directives/node-favorite.directive.md index 0d35d1ba1b..1df76a7cd5 100644 --- a/docs/core/directives/node-favorite.directive.md +++ b/docs/content-services/directives/node-favorite.directive.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2018-11-13 --- -# [Node Favorite directive](lib/core/src/lib/directives/node-favorite.directive.ts "Defined in node-favorite.directive.ts") +# [Node Favorite directive](../../../lib/content-services/src/lib/directives/node-favorite.directive.ts "Defined in node-favorite.directive.ts") Selectively toggles nodes as favorites. diff --git a/docs/core/directives/node-restore.directive.md b/docs/content-services/directives/node-restore.directive.md similarity index 87% rename from docs/core/directives/node-restore.directive.md rename to docs/content-services/directives/node-restore.directive.md index a458d4076b..5460fa448a 100644 --- a/docs/core/directives/node-restore.directive.md +++ b/docs/content-services/directives/node-restore.directive.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2019-01-16 --- -# [Node Restore directive](lib/core/src/lib/directives/node-restore.directive.ts "Defined in node-restore.directive.ts") +# [Node Restore directive](../../../lib/content-services/src/lib/directives/node-restore.directive.ts "Defined in node-restore.directive.ts") Restores deleted nodes to their original location. @@ -56,7 +56,7 @@ Restores deleted nodes to their original location. | Name | Type | Description | | ---- | ---- | ----------- | -| restore | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`RestoreMessageModel`](../../../lib/core/directives/node-restore.directive.ts)`>` | Emitted when restoration is complete. | +| restore | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`RestoreMessageModel`](../../../lib/content-services/src/lib/interfaces/restore-message-model.interface.ts)`>` | Emitted when restoration is complete. | ## Details diff --git a/lib/core/src/lib/directives/check-allowable-operation.directive.spec.ts b/lib/content-services/src/lib/directives/check-allowable-operation.directive.spec.ts similarity index 95% rename from lib/core/src/lib/directives/check-allowable-operation.directive.spec.ts rename to lib/content-services/src/lib/directives/check-allowable-operation.directive.spec.ts index 3ac7e9efb9..a6f3a8094f 100644 --- a/lib/core/src/lib/directives/check-allowable-operation.directive.spec.ts +++ b/lib/content-services/src/lib/directives/check-allowable-operation.directive.spec.ts @@ -16,12 +16,11 @@ */ import { ChangeDetectorRef, Component, ElementRef, SimpleChange } from '@angular/core'; -import { ContentService } from '../services/content.service'; -import { CheckAllowableOperationDirective, NodeAllowableOperationSubject } from './check-allowable-operation.directive'; -import { setupTestBed } from '../testing/setup-test-bed'; +import { ContentService, CoreTestingModule, setupTestBed } from '@alfresco/adf-core'; +import { CheckAllowableOperationDirective } from './check-allowable-operation.directive'; import { TestBed } from '@angular/core/testing'; -import { CoreTestingModule } from '../testing/core.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { NodeAllowableOperationSubject } from '../interfaces/node-allowable-operation-subject.interface'; @Component({ selector: 'adf-text-subject', diff --git a/lib/core/src/lib/directives/check-allowable-operation.directive.ts b/lib/content-services/src/lib/directives/check-allowable-operation.directive.ts similarity index 94% rename from lib/core/src/lib/directives/check-allowable-operation.directive.ts rename to lib/content-services/src/lib/directives/check-allowable-operation.directive.ts index 93eaefae0a..9f5dab7efc 100644 --- a/lib/core/src/lib/directives/check-allowable-operation.directive.ts +++ b/lib/content-services/src/lib/directives/check-allowable-operation.directive.ts @@ -19,12 +19,8 @@ import { ChangeDetectorRef, Directive, ElementRef, Host, Inject, Input, OnChanges, Optional, Renderer2, SimpleChanges } from '@angular/core'; import { NodeEntry } from '@alfresco/js-api'; -import { ContentService } from '../services/content.service'; -import { EXTENDIBLE_COMPONENT } from '../interface/injection.tokens'; - -export interface NodeAllowableOperationSubject { - disabled: boolean; -} +import { ContentService, EXTENDIBLE_COMPONENT } from '@alfresco/adf-core'; +import { NodeAllowableOperationSubject } from '../interfaces/node-allowable-operation-subject.interface'; @Directive({ selector: '[adf-check-allowable-operation]' diff --git a/lib/content-services/src/lib/directives/content-directive.module.ts b/lib/content-services/src/lib/directives/content-directive.module.ts index 1e9a54fcc9..d00f291389 100644 --- a/lib/content-services/src/lib/directives/content-directive.module.ts +++ b/lib/content-services/src/lib/directives/content-directive.module.ts @@ -23,6 +23,12 @@ import { TranslateModule } from '@ngx-translate/core'; import { NodeLockDirective } from './node-lock.directive'; import { NodeCounterComponent, NodeCounterDirective } from './node-counter.directive'; import { AutoFocusDirective } from './auto-focus.directive'; +import { CheckAllowableOperationDirective } from './check-allowable-operation.directive'; +import { LibraryFavoriteDirective } from './library-favorite.directive'; +import { LibraryMembershipDirective } from './library-membership.directive'; +import { NodeDeleteDirective } from './node-delete.directive'; +import { NodeFavoriteDirective } from './node-favorite.directive'; +import { NodeRestoreDirective } from './node-restore.directive'; @NgModule({ imports: [ @@ -34,12 +40,24 @@ import { AutoFocusDirective } from './auto-focus.directive'; NodeLockDirective, NodeCounterDirective, NodeCounterComponent, - AutoFocusDirective + AutoFocusDirective, + CheckAllowableOperationDirective, + LibraryFavoriteDirective, + LibraryMembershipDirective, + NodeDeleteDirective, + NodeFavoriteDirective, + NodeRestoreDirective ], exports: [ NodeLockDirective, NodeCounterDirective, - AutoFocusDirective + AutoFocusDirective, + CheckAllowableOperationDirective, + LibraryFavoriteDirective, + LibraryMembershipDirective, + NodeDeleteDirective, + NodeFavoriteDirective, + NodeRestoreDirective ] }) export class ContentDirectiveModule { diff --git a/lib/core/src/lib/directives/library-favorite.directive.spec.ts b/lib/content-services/src/lib/directives/library-favorite.directive.spec.ts similarity index 94% rename from lib/core/src/lib/directives/library-favorite.directive.spec.ts rename to lib/content-services/src/lib/directives/library-favorite.directive.spec.ts index 6b2d917439..6b9f1ad6cb 100644 --- a/lib/core/src/lib/directives/library-favorite.directive.spec.ts +++ b/lib/content-services/src/lib/directives/library-favorite.directive.spec.ts @@ -16,12 +16,11 @@ */ import { Component, ViewChild } from '@angular/core'; -import { LibraryEntity, LibraryFavoriteDirective } from './library-favorite.directive'; +import { LibraryFavoriteDirective } from './library-favorite.directive'; import { TestBed, ComponentFixture } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; -import { AlfrescoApiService } from '../services/alfresco-api.service'; -import { CoreModule } from '../core.module'; -import { AlfrescoApiServiceMock } from '../mock'; +import { AlfrescoApiServiceMock, CoreModule, AlfrescoApiService } from '@alfresco/adf-core'; +import { LibraryEntity } from '../interfaces/library-entity.interface'; @Component({ selector: 'app-test-component', diff --git a/lib/core/src/lib/directives/library-favorite.directive.ts b/lib/content-services/src/lib/directives/library-favorite.directive.ts similarity index 92% rename from lib/core/src/lib/directives/library-favorite.directive.ts rename to lib/content-services/src/lib/directives/library-favorite.directive.ts index 2fa0d8d0e3..410c021e22 100644 --- a/lib/core/src/lib/directives/library-favorite.directive.ts +++ b/lib/content-services/src/lib/directives/library-favorite.directive.ts @@ -16,14 +16,9 @@ */ import { Directive, HostListener, Input, OnChanges, Output, EventEmitter } from '@angular/core'; -import { SiteBody, FavoriteBody, FavoriteEntry, Site, FavoritesApi } from '@alfresco/js-api'; -import { AlfrescoApiService } from '../services/alfresco-api.service'; - -export interface LibraryEntity { - entry: Site; - isLibrary: boolean; - isFavorite: boolean; -} +import { SiteBody, FavoriteBody, FavoriteEntry, FavoritesApi } from '@alfresco/js-api'; +import { AlfrescoApiService } from '@alfresco/adf-core'; +import { LibraryEntity } from '../interfaces/library-entity.interface'; @Directive({ selector: '[adf-favorite-library]', diff --git a/lib/core/src/lib/directives/library-membership.directive.spec.ts b/lib/content-services/src/lib/directives/library-membership.directive.spec.ts similarity index 97% rename from lib/core/src/lib/directives/library-membership.directive.spec.ts rename to lib/content-services/src/lib/directives/library-membership.directive.spec.ts index f8b45c48bc..24d804c1f7 100644 --- a/lib/core/src/lib/directives/library-membership.directive.spec.ts +++ b/lib/content-services/src/lib/directives/library-membership.directive.spec.ts @@ -16,14 +16,12 @@ */ import { fakeAsync, TestBed, tick } from '@angular/core/testing'; -import { AlfrescoApiService, SitesService } from '../services'; import { LibraryMembershipDirective } from './library-membership.directive'; import { NO_ERRORS_SCHEMA, SimpleChange } from '@angular/core'; import { of, throwError, Subject } from 'rxjs'; import { TranslateModule } from '@ngx-translate/core'; -import { DirectiveModule } from './directive.module'; -import { CoreModule } from '../core.module'; -import { CoreTestingModule } from '../testing/core.testing.module'; +import { AlfrescoApiService, CoreModule, CoreTestingModule, SitesService } from '@alfresco/adf-core'; +import { ContentDirectiveModule } from './content-directive.module'; describe('LibraryMembershipDirective', () => { let alfrescoApiService: AlfrescoApiService; @@ -41,7 +39,7 @@ describe('LibraryMembershipDirective', () => { TestBed.configureTestingModule({ imports: [ TranslateModule.forRoot(), - DirectiveModule, + ContentDirectiveModule, CoreModule.forRoot(), CoreTestingModule ], diff --git a/lib/core/src/lib/directives/library-membership.directive.ts b/lib/content-services/src/lib/directives/library-membership.directive.ts similarity index 94% rename from lib/core/src/lib/directives/library-membership.directive.ts rename to lib/content-services/src/lib/directives/library-membership.directive.ts index a68b1192ff..62b0ca2c75 100644 --- a/lib/core/src/lib/directives/library-membership.directive.ts +++ b/lib/content-services/src/lib/directives/library-membership.directive.ts @@ -24,20 +24,9 @@ import { SitesApi } from '@alfresco/js-api'; import { BehaviorSubject, from, Observable } from 'rxjs'; -import { AlfrescoApiService } from '../services/alfresco-api.service'; -import { SitesService } from '../services/sites.service'; -import { VersionCompatibilityService } from '../services/version-compatibility.service'; - -export interface LibraryMembershipToggleEvent { - updatedEntry?: any; - shouldReload: boolean; - i18nKey: string; -} - -export interface LibraryMembershipErrorEvent { - error: any; - i18nKey: string; -} +import { VersionCompatibilityService, SitesService, AlfrescoApiService } from '@alfresco/adf-core'; +import { LibraryMembershipToggleEvent } from '../interfaces/library-membership-toggle-event.interface'; +import { LibraryMembershipErrorEvent} from '../interfaces/library-membership-error-event.interface'; @Directive({ selector: '[adf-library-membership]', diff --git a/lib/core/src/lib/directives/node-delete.directive.spec.ts b/lib/content-services/src/lib/directives/node-delete.directive.spec.ts similarity index 97% rename from lib/core/src/lib/directives/node-delete.directive.spec.ts rename to lib/content-services/src/lib/directives/node-delete.directive.spec.ts index 6da5ecf9f7..bc4b37fc8f 100644 --- a/lib/core/src/lib/directives/node-delete.directive.spec.ts +++ b/lib/content-services/src/lib/directives/node-delete.directive.spec.ts @@ -19,8 +19,9 @@ import { Component, DebugElement, ViewChild } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { NodeDeleteDirective } from './node-delete.directive'; -import { setupTestBed } from '../testing/setup-test-bed'; -import { CoreTestingModule } from '../testing/core.testing.module'; +import { setupTestBed, CoreTestingModule } from '@alfresco/adf-core'; +import { TranslateModule } from '@ngx-translate/core'; +import { ContentDirectiveModule } from './content-directive.module'; @Component({ template: ` @@ -89,7 +90,9 @@ describe('NodeDeleteDirective', () => { setupTestBed({ imports: [ - CoreTestingModule + TranslateModule.forRoot(), + CoreTestingModule, + ContentDirectiveModule ], declarations: [ TestComponent, diff --git a/lib/core/src/lib/directives/node-delete.directive.ts b/lib/content-services/src/lib/directives/node-delete.directive.ts similarity index 98% rename from lib/core/src/lib/directives/node-delete.directive.ts rename to lib/content-services/src/lib/directives/node-delete.directive.ts index 2902765eff..00781a534a 100644 --- a/lib/core/src/lib/directives/node-delete.directive.ts +++ b/lib/content-services/src/lib/directives/node-delete.directive.ts @@ -20,8 +20,7 @@ import { Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output } from '@angular/core'; import { NodeEntry, Node, DeletedNodeEntity, DeletedNode, TrashcanApi, NodesApi } 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 { AlfrescoApiService, TranslationService } from '@alfresco/adf-core'; import { map, catchError, retry } from 'rxjs/operators'; interface ProcessedNodeData { diff --git a/lib/core/src/lib/directives/node-favorite.directive.spec.ts b/lib/content-services/src/lib/directives/node-favorite.directive.spec.ts similarity index 98% rename from lib/core/src/lib/directives/node-favorite.directive.spec.ts rename to lib/content-services/src/lib/directives/node-favorite.directive.spec.ts index 8a7b179133..7d7b423c19 100644 --- a/lib/core/src/lib/directives/node-favorite.directive.spec.ts +++ b/lib/content-services/src/lib/directives/node-favorite.directive.spec.ts @@ -18,10 +18,8 @@ import { SimpleChange } from '@angular/core'; import { fakeAsync, TestBed, tick } from '@angular/core/testing'; import { NodeFavoriteDirective } from './node-favorite.directive'; -import { setupTestBed } from '../testing/setup-test-bed'; -import { CoreTestingModule } from '../testing/core.testing.module'; import { TranslateModule } from '@ngx-translate/core'; -import { AlfrescoApiService } from '../services/alfresco-api.service'; +import { AlfrescoApiService, CoreTestingModule, setupTestBed } from '@alfresco/adf-core'; describe('NodeFavoriteDirective', () => { diff --git a/lib/core/src/lib/directives/node-favorite.directive.ts b/lib/content-services/src/lib/directives/node-favorite.directive.ts similarity index 98% rename from lib/core/src/lib/directives/node-favorite.directive.ts rename to lib/content-services/src/lib/directives/node-favorite.directive.ts index 6b2cbf669b..5e5e614ad6 100644 --- a/lib/core/src/lib/directives/node-favorite.directive.ts +++ b/lib/content-services/src/lib/directives/node-favorite.directive.ts @@ -20,8 +20,8 @@ import { Directive, EventEmitter, HostListener, Input, OnChanges, Output } from '@angular/core'; import { FavoriteBody, NodeEntry, SharedLinkEntry, Node, SharedLink, FavoritesApi } from '@alfresco/js-api'; import { Observable, from, forkJoin, of } from 'rxjs'; -import { AlfrescoApiService } from '../services/alfresco-api.service'; import { catchError, map } from 'rxjs/operators'; +import { AlfrescoApiService } from '@alfresco/adf-core'; @Directive({ selector: '[adf-node-favorite]', diff --git a/lib/core/src/lib/directives/node-restore.directive.spec.ts b/lib/content-services/src/lib/directives/node-restore.directive.spec.ts similarity index 97% rename from lib/core/src/lib/directives/node-restore.directive.spec.ts rename to lib/content-services/src/lib/directives/node-restore.directive.spec.ts index 2a6329726f..f797f553cf 100644 --- a/lib/core/src/lib/directives/node-restore.directive.spec.ts +++ b/lib/content-services/src/lib/directives/node-restore.directive.spec.ts @@ -19,10 +19,9 @@ import { Component, DebugElement } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { NodeRestoreDirective } from './node-restore.directive'; -import { setupTestBed } from '../testing/setup-test-bed'; -import { TranslationService } from '../services/translation.service'; -import { CoreTestingModule } from '../testing/core.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { TranslationService, setupTestBed, CoreTestingModule } from '@alfresco/adf-core'; +import { ContentDirectiveModule } from './content-directive.module'; @Component({ template: ` @@ -48,7 +47,8 @@ describe('NodeRestoreDirective', () => { setupTestBed({ imports: [ TranslateModule.forRoot(), - CoreTestingModule + CoreTestingModule, + ContentDirectiveModule ], declarations: [ TestComponent diff --git a/lib/core/src/lib/directives/node-restore.directive.ts b/lib/content-services/src/lib/directives/node-restore.directive.ts similarity index 95% rename from lib/core/src/lib/directives/node-restore.directive.ts rename to lib/content-services/src/lib/directives/node-restore.directive.ts index 7008b51d62..72a1cf201e 100644 --- a/lib/core/src/lib/directives/node-restore.directive.ts +++ b/lib/content-services/src/lib/directives/node-restore.directive.ts @@ -18,17 +18,12 @@ /* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */ import { Directive, EventEmitter, HostListener, Input, Output } from '@angular/core'; -import { TrashcanApi, DeletedNodeEntry, DeletedNodesPaging, PathInfoEntity } from '@alfresco/js-api'; +import { + TrashcanApi, DeletedNodeEntry, DeletedNodesPaging } 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 { tap, mergeMap, map, catchError } from 'rxjs/operators'; - -export class RestoreMessageModel { - message: string; - path: PathInfoEntity; - action: string; -} +import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core'; +import { RestoreMessageModel } from '../interfaces/restore-message-model.interface'; @Directive({ selector: '[adf-restore]' diff --git a/lib/content-services/src/lib/directives/public-api.ts b/lib/content-services/src/lib/directives/public-api.ts index 2e30ade106..983e584274 100644 --- a/lib/content-services/src/lib/directives/public-api.ts +++ b/lib/content-services/src/lib/directives/public-api.ts @@ -19,3 +19,9 @@ export * from './content-directive.module'; export * from './node-lock.directive'; export * from './node-counter.directive'; export * from './auto-focus.directive'; +export * from './check-allowable-operation.directive'; +export * from './library-favorite.directive'; +export * from './library-membership.directive'; +export * from './node-delete.directive'; +export * from './node-favorite.directive'; +export * from './node-restore.directive'; diff --git a/lib/content-services/src/lib/interfaces/index.ts b/lib/content-services/src/lib/interfaces/index.ts new file mode 100644 index 0000000000..a7e30cc675 --- /dev/null +++ b/lib/content-services/src/lib/interfaces/index.ts @@ -0,0 +1,18 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * 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. + */ + +export * from './public-api'; diff --git a/lib/content-services/src/lib/interfaces/library-entity.interface.ts b/lib/content-services/src/lib/interfaces/library-entity.interface.ts new file mode 100644 index 0000000000..b381194c6a --- /dev/null +++ b/lib/content-services/src/lib/interfaces/library-entity.interface.ts @@ -0,0 +1,24 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * 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 { Site } from '@alfresco/js-api'; + +export interface LibraryEntity { + entry: Site; + isLibrary: boolean; + isFavorite: boolean; +} diff --git a/lib/content-services/src/lib/interfaces/library-membership-error-event.interface.ts b/lib/content-services/src/lib/interfaces/library-membership-error-event.interface.ts new file mode 100644 index 0000000000..ceba71723b --- /dev/null +++ b/lib/content-services/src/lib/interfaces/library-membership-error-event.interface.ts @@ -0,0 +1,21 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * 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. + */ + +export interface LibraryMembershipErrorEvent { + error: any; + i18nKey: string; +} diff --git a/lib/content-services/src/lib/interfaces/library-membership-toggle-event.interface.ts b/lib/content-services/src/lib/interfaces/library-membership-toggle-event.interface.ts new file mode 100644 index 0000000000..810b67be2a --- /dev/null +++ b/lib/content-services/src/lib/interfaces/library-membership-toggle-event.interface.ts @@ -0,0 +1,22 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * 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. + */ + +export interface LibraryMembershipToggleEvent { + updatedEntry?: any; + shouldReload: boolean; + i18nKey: string; +} diff --git a/lib/content-services/src/lib/interfaces/node-allowable-operation-subject.interface.ts b/lib/content-services/src/lib/interfaces/node-allowable-operation-subject.interface.ts new file mode 100644 index 0000000000..5ca34ebef3 --- /dev/null +++ b/lib/content-services/src/lib/interfaces/node-allowable-operation-subject.interface.ts @@ -0,0 +1,20 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * 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. + */ + +export interface NodeAllowableOperationSubject { + disabled: boolean; +} diff --git a/lib/content-services/src/lib/interfaces/public-api.ts b/lib/content-services/src/lib/interfaces/public-api.ts new file mode 100644 index 0000000000..cb8bbd32eb --- /dev/null +++ b/lib/content-services/src/lib/interfaces/public-api.ts @@ -0,0 +1,23 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * 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. + */ + +export * from './node-allowable-operation-subject.interface'; +export * from './library-entity.interface'; +export * from './restore-message-model.interface'; +export * from './library-membership-error-event.interface'; +export * from './library-membership-toggle-event.interface'; + diff --git a/lib/content-services/src/lib/interfaces/restore-message-model.interface.ts b/lib/content-services/src/lib/interfaces/restore-message-model.interface.ts new file mode 100644 index 0000000000..5b18809e3a --- /dev/null +++ b/lib/content-services/src/lib/interfaces/restore-message-model.interface.ts @@ -0,0 +1,24 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * 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 { PathInfoEntity } from '@alfresco/js-api'; + +export class RestoreMessageModel { + message: string; + path: PathInfoEntity; + action: string; +} diff --git a/lib/content-services/src/lib/upload/components/upload-button.component.ts b/lib/content-services/src/lib/upload/components/upload-button.component.ts index 865c2f4d37..19f5689c2d 100644 --- a/lib/content-services/src/lib/upload/components/upload-button.component.ts +++ b/lib/content-services/src/lib/upload/components/upload-button.component.ts @@ -17,7 +17,7 @@ import { ContentService, EXTENDIBLE_COMPONENT, FileUtils, - LogService, NodeAllowableOperationSubject, TranslationService, UploadService, AllowableOperationsEnum + LogService, TranslationService, UploadService, AllowableOperationsEnum } from '@alfresco/adf-core'; import { Component, EventEmitter, forwardRef, Input, @@ -27,6 +27,7 @@ import { Node } from '@alfresco/js-api'; import { Subject } from 'rxjs'; import { PermissionModel } from '../../document-list/models/permissions.model'; import { UploadBase } from './base-upload/upload-base'; +import { NodeAllowableOperationSubject } from '../../interfaces/node-allowable-operation-subject.interface'; @Component({ selector: 'adf-upload-button', diff --git a/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts b/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts index 63d7e488f1..75645f2d05 100644 --- a/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts +++ b/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts @@ -16,10 +16,11 @@ */ import { - EXTENDIBLE_COMPONENT, FileInfo, FileModel, FileUtils, NodeAllowableOperationSubject, + EXTENDIBLE_COMPONENT, FileInfo, FileModel, FileUtils, NotificationService, TranslationService, UploadService, ContentService, AllowableOperationsEnum } from '@alfresco/adf-core'; import { Component, forwardRef, ViewEncapsulation, NgZone } from '@angular/core'; +import { NodeAllowableOperationSubject } from '../../interfaces/node-allowable-operation-subject.interface'; import { UploadBase } from './base-upload/upload-base'; @Component({ diff --git a/lib/content-services/src/public-api.ts b/lib/content-services/src/public-api.ts index a0ddc7abe5..ef98cc7f73 100644 --- a/lib/content-services/src/public-api.ts +++ b/lib/content-services/src/public-api.ts @@ -36,5 +36,6 @@ export * from './lib/group/index'; export * from './lib/aspect-list/index'; export * from './lib/content-type/index'; export * from './lib/new-version-uploader'; +export * from './lib/interfaces/index'; export * from './lib/content.module'; diff --git a/lib/core/src/lib/breaking-changes.md b/lib/core/src/lib/breaking-changes.md new file mode 100644 index 0000000000..af4b9224d3 --- /dev/null +++ b/lib/core/src/lib/breaking-changes.md @@ -0,0 +1,9 @@ +6.0.0-beta.1 +- CheckAllowableOperationDirective: Moved from ADF Core to ADF content services +- LibraryFavoriteDirective: Moved from ADF Core to ADF content services +- LibraryMembershipDirective: Moved from ADF Core to ADF content services +- NodeDeleteDirective: Moved from ADF Core to ADF content services +- NodeFavoriteDirective: Moved from ADF Core to ADF content services +- NodeRestoreDirective: Moved from ADF Core to ADF content services + + diff --git a/lib/core/src/lib/directives/directive.module.ts b/lib/core/src/lib/directives/directive.module.ts index 1f9ce7aee4..e10ede7824 100644 --- a/lib/core/src/lib/directives/directive.module.ts +++ b/lib/core/src/lib/directives/directive.module.ts @@ -21,10 +21,6 @@ import { MaterialModule } from '../material.module'; import { HighlightDirective } from './highlight.directive'; import { LogoutDirective } from './logout.directive'; -import { NodeDeleteDirective } from './node-delete.directive'; -import { NodeFavoriteDirective } from './node-favorite.directive'; -import { CheckAllowableOperationDirective } from './check-allowable-operation.directive'; -import { NodeRestoreDirective } from './node-restore.directive'; import { UploadDirective } from './upload.directive'; import { NodeDownloadDirective } from './node-download.directive'; import { VersionCompatibilityDirective } from './version-compatibility.directive'; @@ -32,8 +28,6 @@ import { TooltipCardDirective } from './tooltip-card/tooltip-card.directive'; import { OverlayModule } from '@angular/cdk/overlay'; import { TooltipCardComponent } from './tooltip-card/tooltip-card.component'; import { InfiniteSelectScrollDirective } from './infinite-select-scroll.directive'; -import { LibraryFavoriteDirective } from './library-favorite.directive'; -import { LibraryMembershipDirective } from './library-membership.directive'; @NgModule({ imports: [ @@ -44,33 +38,21 @@ import { LibraryMembershipDirective } from './library-membership.directive'; declarations: [ HighlightDirective, LogoutDirective, - NodeDeleteDirective, - NodeFavoriteDirective, - CheckAllowableOperationDirective, - NodeRestoreDirective, NodeDownloadDirective, UploadDirective, VersionCompatibilityDirective, TooltipCardDirective, TooltipCardComponent, - InfiniteSelectScrollDirective, - LibraryFavoriteDirective, - LibraryMembershipDirective + InfiniteSelectScrollDirective ], exports: [ HighlightDirective, LogoutDirective, - NodeDeleteDirective, - NodeFavoriteDirective, - CheckAllowableOperationDirective, - NodeRestoreDirective, NodeDownloadDirective, UploadDirective, VersionCompatibilityDirective, TooltipCardDirective, - InfiniteSelectScrollDirective, - LibraryFavoriteDirective, - LibraryMembershipDirective + InfiniteSelectScrollDirective ] }) export class DirectiveModule {} diff --git a/lib/core/src/lib/directives/public-api.ts b/lib/core/src/lib/directives/public-api.ts index cd412ca945..ca2f1de222 100644 --- a/lib/core/src/lib/directives/public-api.ts +++ b/lib/core/src/lib/directives/public-api.ts @@ -17,16 +17,10 @@ export * from './highlight.directive'; export * from './logout.directive'; -export * from './node-delete.directive'; -export * from './node-favorite.directive'; -export * from './check-allowable-operation.directive'; -export * from './node-restore.directive'; export * from './node-download.directive'; export * from './upload.directive'; export * from './version-compatibility.directive'; export * from './tooltip-card/tooltip-card.directive'; export * from './infinite-select-scroll.directive'; -export * from './library-favorite.directive'; -export * from './library-membership.directive'; export * from './directive.module';