mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
ACS-7393: content metadata as standalone
This commit is contained in:
@@ -61,7 +61,8 @@ describe('ContentMetadataCardComponent', () => {
|
||||
MatDialogModule,
|
||||
PipeModule,
|
||||
MatSnackBarModule,
|
||||
MatTooltipModule
|
||||
MatTooltipModule,
|
||||
ContentMetadataCardComponent
|
||||
],
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
@@ -69,7 +70,7 @@ describe('ContentMetadataCardComponent', () => {
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: versionCompatibilityFactory,
|
||||
deps: [ VersionCompatibilityService ],
|
||||
deps: [VersionCompatibilityService],
|
||||
multi: true
|
||||
}
|
||||
]
|
||||
|
@@ -22,9 +22,17 @@ import { ContentMetadataCustomPanel, PresetConfig } from '../../interfaces/conte
|
||||
import { VersionCompatibilityService } from '../../../version-compatibility/version-compatibility.service';
|
||||
import { ContentService } from '../../../common/services/content.service';
|
||||
import { AllowableOperationsEnum } from '../../../common/models/allowable-operations.enum';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { ContentMetadataComponent } from '../content-metadata/content-metadata.component';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-content-metadata-card',
|
||||
standalone: true,
|
||||
imports: [CommonModule, MatCardModule, ContentMetadataComponent, MatButtonModule, MatIconModule, TranslateModule],
|
||||
templateUrl: './content-metadata-card.component.html',
|
||||
styleUrls: ['./content-metadata-card.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
|
@@ -195,7 +195,8 @@ describe('ContentMetadataComponent', () => {
|
||||
MatSnackBarModule,
|
||||
MatProgressBarModule,
|
||||
MatTooltipModule,
|
||||
PipeModule
|
||||
PipeModule,
|
||||
ContentMetadataComponent
|
||||
],
|
||||
providers: [
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
|
@@ -15,21 +15,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
Component,
|
||||
Input,
|
||||
OnChanges,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
SimpleChanges,
|
||||
ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
||||
import { Category, CategoryEntry, CategoryLinkBody, CategoryPaging, Node, TagBody, TagEntry, TagPaging } from '@alfresco/js-api';
|
||||
import { forkJoin, Observable, of, Subject, zip } from 'rxjs';
|
||||
import {
|
||||
AppConfigService,
|
||||
CardViewBaseItemModel,
|
||||
CardViewItem,
|
||||
CardViewModule,
|
||||
NotificationService,
|
||||
TranslationService,
|
||||
UpdateNotification
|
||||
@@ -45,6 +38,17 @@ import { CategoryService } from '../../../category/services/category.service';
|
||||
import { CategoriesManagementMode } from '../../../category/categories-management/categories-management-mode';
|
||||
import { AllowableOperationsEnum } from '../../../common/models/allowable-operations.enum';
|
||||
import { ContentService } from '../../../common/services/content.service';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { MatExpansionModule } from '@angular/material/expansion';
|
||||
import { ContentMetadataHeaderComponent } from './content-metadata-header.component';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatChipsModule } from '@angular/material/chips';
|
||||
import { TagModule } from '../../../tag';
|
||||
import { CategoriesManagementComponent } from '../../../category';
|
||||
import { DynamicExtensionComponent } from '@alfresco/adf-extensions';
|
||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||
|
||||
const DEFAULT_SEPARATOR = ', ';
|
||||
|
||||
@@ -56,6 +60,21 @@ enum DefaultPanels {
|
||||
|
||||
@Component({
|
||||
selector: 'adf-content-metadata',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
MatExpansionModule,
|
||||
ContentMetadataHeaderComponent,
|
||||
MatButtonModule,
|
||||
TranslateModule,
|
||||
MatIconModule,
|
||||
CardViewModule,
|
||||
MatChipsModule,
|
||||
TagModule,
|
||||
CategoriesManagementComponent,
|
||||
DynamicExtensionComponent,
|
||||
MatProgressBarModule
|
||||
],
|
||||
templateUrl: './content-metadata.component.html',
|
||||
styleUrls: ['./content-metadata.component.scss'],
|
||||
host: { class: 'adf-content-metadata' },
|
||||
@@ -173,12 +192,10 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
||||
this.updateChanges(updatedNode.changed);
|
||||
});
|
||||
|
||||
this.cardViewContentUpdateService.updatedAspect$
|
||||
.pipe(debounceTime(500), takeUntil(this.onDestroy$))
|
||||
.subscribe((node) => {
|
||||
this.node.aspectNames = node?.aspectNames;
|
||||
this.loadProperties(node);
|
||||
});
|
||||
this.cardViewContentUpdateService.updatedAspect$.pipe(debounceTime(500), takeUntil(this.onDestroy$)).subscribe((node) => {
|
||||
this.node.aspectNames = node?.aspectNames;
|
||||
this.loadProperties(node);
|
||||
});
|
||||
|
||||
this.loadProperties(this.node);
|
||||
this.verifyAllowableOperations();
|
||||
@@ -210,7 +227,10 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
isPanelEditing(panelTitle: string): boolean {
|
||||
return this.editing && ((this.currentPanel.panelTitle === panelTitle && this.editedPanelTitle === panelTitle) || this.editedPanelTitle === panelTitle);
|
||||
return (
|
||||
this.editing &&
|
||||
((this.currentPanel.panelTitle === panelTitle && this.editedPanelTitle === panelTitle) || this.editedPanelTitle === panelTitle)
|
||||
);
|
||||
}
|
||||
|
||||
protected handleUpdateError(error: Error) {
|
||||
@@ -250,7 +270,6 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
||||
if (changes.displayDefaultProperties?.currentValue) {
|
||||
this.expandPanel(this.DefaultPanels.PROPERTIES);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
@@ -365,7 +384,8 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
keyDown(event: KeyboardEvent) {
|
||||
if (event.keyCode === 37 || event.keyCode === 39) { // ArrowLeft && ArrowRight
|
||||
if (event.keyCode === 37 || event.keyCode === 39) {
|
||||
// ArrowLeft && ArrowRight
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
@@ -15,35 +15,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
import { ContentMetadataComponent } from './components/content-metadata/content-metadata.component';
|
||||
import { ContentMetadataCardComponent } from './components/content-metadata-card/content-metadata-card.component';
|
||||
import { TagModule } from '../tag/tag.module';
|
||||
import { CategoriesModule } from '../category/category.module';
|
||||
import { ExtensionsModule } from '@alfresco/adf-extensions';
|
||||
import { ContentMetadataHeaderComponent } from './components/content-metadata/content-metadata-header.component';
|
||||
|
||||
export const CONTENT_METADATA_DIRECTIVES = [ContentMetadataComponent, ContentMetadataCardComponent, ContentMetadataHeaderComponent] as const;
|
||||
|
||||
/** @deprecated use `...CONTENT_METADATA_DIRECTIVES` instead */
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
MaterialModule,
|
||||
CoreModule,
|
||||
TagModule,
|
||||
CategoriesModule,
|
||||
ExtensionsModule,
|
||||
ContentMetadataHeaderComponent
|
||||
],
|
||||
exports: [
|
||||
ContentMetadataComponent,
|
||||
ContentMetadataCardComponent,
|
||||
ContentMetadataHeaderComponent
|
||||
],
|
||||
declarations: [
|
||||
ContentMetadataComponent,
|
||||
ContentMetadataCardComponent
|
||||
]
|
||||
imports: [...CONTENT_METADATA_DIRECTIVES],
|
||||
exports: [...CONTENT_METADATA_DIRECTIVES]
|
||||
})
|
||||
export class ContentMetadataModule {}
|
||||
|
@@ -30,7 +30,7 @@ import { ContentNodeSelectorModule } from './content-node-selector/content-node-
|
||||
import { ContentNodeShareModule } from './content-node-share/content-node-share.module';
|
||||
import { ContentDirectiveModule } from './directives/content-directive.module';
|
||||
import { CONTENT_DIALOG_DIRECTIVES } from './dialogs/dialog.module';
|
||||
import { ContentMetadataModule } from './content-metadata/content-metadata.module';
|
||||
import { CONTENT_METADATA_DIRECTIVES } from './content-metadata/content-metadata.module';
|
||||
import { PermissionManagerModule } from './permission-manager/permission-manager.module';
|
||||
import { TreeViewModule } from './tree-view/tree-view.module';
|
||||
import { ContentTypeModule } from './content-type/content-type.module';
|
||||
@@ -65,7 +65,7 @@ import { NewVersionUploaderDialogComponent } from './new-version-uploader';
|
||||
...BREADCRUMB_DIRECTIVES,
|
||||
ContentNodeSelectorModule,
|
||||
ContentNodeShareModule,
|
||||
ContentMetadataModule,
|
||||
...CONTENT_METADATA_DIRECTIVES,
|
||||
ContentDirectiveModule,
|
||||
PermissionManagerModule,
|
||||
VersionManagerModule,
|
||||
@@ -91,7 +91,7 @@ import { NewVersionUploaderDialogComponent } from './new-version-uploader';
|
||||
...BREADCRUMB_DIRECTIVES,
|
||||
ContentNodeSelectorModule,
|
||||
ContentNodeShareModule,
|
||||
ContentMetadataModule,
|
||||
...CONTENT_METADATA_DIRECTIVES,
|
||||
...CONTENT_DIALOG_DIRECTIVES,
|
||||
ContentDirectiveModule,
|
||||
PermissionManagerModule,
|
||||
|
Reference in New Issue
Block a user