ACS-8251: migrate Extensions library to Standalone (#9842)

This commit is contained in:
Denys Vuika
2024-06-20 08:52:30 -04:00
committed by GitHub
parent 45e921a382
commit 9a544307d4
32 changed files with 465 additions and 572 deletions

View File

@@ -20,10 +20,28 @@ import { AboutComponent } from './about.component';
import { AboutModule } from './about.module';
import { AuthenticationService } from '../auth/services/authentication.service';
import { AuthenticationMock } from '../auth/mock/authentication.service.mock';
import { AppExtensionService, AppExtensionServiceMock } from '@alfresco/adf-extensions';
import { AppExtensionService, ExtensionRef, ViewerExtensionRef } from '@alfresco/adf-extensions';
import { AppConfigService } from '../app-config/app-config.service';
import { AppConfigServiceMock } from '../common/mock/app-config.service.mock';
import { CoreStoryModule } from '../testing/core.story.module';
import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class AppExtensionServiceMock {
references$: Observable<ExtensionRef[]>;
private _references = new BehaviorSubject<ExtensionRef[]>([]);
constructor() {
this.references$ = this._references.asObservable();
}
getViewerExtensions(): ViewerExtensionRef[] {
return [];
}
}
export default {
component: AboutComponent,
@@ -74,7 +92,10 @@ const template: Story<AboutComponent> = (args: AboutComponent) => ({
export const about = template.bind({});
about.args = {
pkg: {
name: 'My Storybook App', commit: 'my-commit-value', version: '1.0.0', dependencies: {
name: 'My Storybook App',
commit: 'my-commit-value',
version: '1.0.0',
dependencies: {
'@alfresco/adf-content-services': '4.7.0',
'@alfresco/adf-core': '4.7.0',
'@alfresco/adf-extensions': '4.7.0',

View File

@@ -15,7 +15,6 @@
* limitations under the License.
*/
import { ExtensionsModule } from '@alfresco/adf-extensions';
import { A11yModule } from '@angular/cdk/a11y';
import { NgIf, NgTemplateOutlet } from '@angular/common';
import {
@@ -41,7 +40,6 @@ import { TranslateModule } from '@ngx-translate/core';
import { fromEvent, Subject } from 'rxjs';
import { filter, first, skipWhile, takeUntil } from 'rxjs/operators';
import { AppConfigService } from '../../app-config';
import { PipeModule } from '../../pipes';
import { ToolbarComponent, ToolbarDividerComponent, ToolbarTitleComponent } from '../../toolbar';
import { DownloadPromptActions } from '../models/download-prompt.actions';
import { CloseButtonPosition, Track } from '../models/viewer.model';
@@ -52,6 +50,9 @@ import { ViewerOpenWithComponent } from './viewer-open-with.component';
import { ViewerRenderComponent } from './viewer-render/viewer-render.component';
import { ViewerSidebarComponent } from './viewer-sidebar.component';
import { ViewerToolbarComponent } from './viewer-toolbar.component';
import { ViewerToolbarActionsComponent } from './viewer-toolbar-actions.component';
import { ViewerToolbarCustomActionsComponent } from './viewer-toolbar-custom-actions.component';
import { MimeTypeIconPipe } from '../../pipes';
const DEFAULT_NON_PREVIEW_CONFIG = {
enableDownloadPrompt: false,
@@ -75,12 +76,15 @@ const DEFAULT_NON_PREVIEW_CONFIG = {
MatButtonModule,
TranslateModule,
MatIconModule,
PipeModule,
MatMenuModule,
ToolbarDividerComponent,
ViewerRenderComponent,
NgTemplateOutlet,
ExtensionsModule
ViewerToolbarComponent,
ViewerSidebarComponent,
ViewerToolbarActionsComponent,
ViewerToolbarCustomActionsComponent,
MimeTypeIconPipe
],
providers: [ViewUtilService]
})
@@ -137,7 +141,7 @@ export class ViewerComponent<T> implements OnDestroy, OnInit, OnChanges {
/**
* If `true` then show the Viewer as a full page over the current content.
* Otherwise fit inside the parent div.
* Otherwise, fit inside the parent div.
*/
@Input()
overlayMode = false;

View File

@@ -35,45 +35,29 @@ import { ViewerToolbarComponent } from './components/viewer-toolbar.component';
import { ViewerComponent } from './components/viewer.component';
import { ViewerExtensionDirective } from './directives/viewer-extension.directive';
export const VIEWER_DIRECTIVES = [
PdfPasswordDialogComponent,
ViewerRenderComponent,
ImgViewerComponent,
TxtViewerComponent,
MediaPlayerComponent,
PdfViewerComponent,
PdfThumbComponent,
PdfThumbListComponent,
ViewerExtensionDirective,
UnknownFormatComponent,
ViewerToolbarComponent,
ViewerSidebarComponent,
ViewerOpenWithComponent,
ViewerMoreActionsComponent,
ViewerToolbarActionsComponent,
ViewerComponent,
ViewerToolbarCustomActionsComponent,
DownloadPromptDialogComponent
] as const;
@NgModule({
imports: [
PdfPasswordDialogComponent,
ViewerRenderComponent,
ImgViewerComponent,
TxtViewerComponent,
MediaPlayerComponent,
PdfViewerComponent,
PdfThumbComponent,
PdfThumbListComponent,
ViewerExtensionDirective,
UnknownFormatComponent,
ViewerToolbarComponent,
ViewerSidebarComponent,
ViewerOpenWithComponent,
ViewerMoreActionsComponent,
ViewerToolbarActionsComponent,
ViewerComponent,
ViewerToolbarCustomActionsComponent,
DownloadPromptDialogComponent
],
exports: [
ViewerRenderComponent,
ImgViewerComponent,
TxtViewerComponent,
MediaPlayerComponent,
PdfViewerComponent,
PdfPasswordDialogComponent,
PdfThumbComponent,
PdfThumbListComponent,
ViewerExtensionDirective,
UnknownFormatComponent,
ViewerToolbarComponent,
ViewerSidebarComponent,
ViewerOpenWithComponent,
ViewerMoreActionsComponent,
ViewerToolbarActionsComponent,
ViewerComponent,
ViewerToolbarCustomActionsComponent
]
imports: [...VIEWER_DIRECTIVES],
exports: [...VIEWER_DIRECTIVES]
})
export class ViewerModule {}