refactor: remove ContentMetadataModule and clean up imports in ContentModule

- Deleted ContentMetadataModule and its associated exports.
- Removed CONTENT_METADATA_DIRECTIVES from ContentModule imports.
- Updated public API to exclude ContentMetadataModule exports.
- Enhanced template syntax in content-metadata.component.html for improved readability and maintainability.
This commit is contained in:
Denys Vuika
2026-02-27 13:05:52 +00:00
parent 2acc4702cd
commit 24a7e55b68
4 changed files with 112 additions and 131 deletions
@@ -1,8 +1,12 @@
@let isExpandedProperties = (currentPanel.panelTitle === DefaultPanels.PROPERTIES && currentPanel.expanded) ?? false;
@let isExpandedTags = (currentPanel.panelTitle === DefaultPanels.TAGS && currentPanel.expanded) ?? false;
@let isExpandedCategories = (currentPanel.panelTitle === DefaultPanels.CATEGORIES && currentPanel.expanded) ?? false;
<mat-accordion displayMode="flat" [multi]="multi" class="adf-metadata-properties">
<mat-expansion-panel
*ngIf="displayDefaultProperties"
class="adf-content-metadata-panel"
[expanded]="currentPanel.panelTitle === DefaultPanels.PROPERTIES && currentPanel.expanded"
[expanded]="isExpandedProperties"
(opened)="expandPanel(DefaultPanels.PROPERTIES)"
(closed)="closePanel(DefaultPanels.PROPERTIES)"
[attr.data-automation-id]="'adf-metadata-group-properties'"
@@ -10,10 +14,10 @@
<mat-expansion-panel-header
class="adf-metadata-properties-header"
[attr.aria-label]="'CORE.METADATA.ACCESSIBILITY.SECTION' | translate: { sectionName: ('CORE.METADATA.BASIC.HEADER' | translate) }"
[class.adf-metadata-properties-header-expanded]="currentPanel.panelTitle === DefaultPanels.PROPERTIES && currentPanel.expanded">
[class.adf-metadata-properties-header-expanded]="isExpandedProperties">
<adf-content-metadata-header
[title]="'CORE.METADATA.BASIC.HEADER'"
[expanded]="currentPanel.panelTitle === DefaultPanels.PROPERTIES && currentPanel.expanded">
[expanded]="isExpandedProperties">
<button
*ngIf="!readOnly && !isPanelEditing(DefaultPanels.PROPERTIES)"
mat-icon-button
@@ -48,7 +52,7 @@
<adf-card-view
class="adf-metadata-properties-expansion-panel"
(keydown)="keyDown($event)"
[properties]="basicProperties$ | async"
[properties]="(basicProperties$ | async) ?? []"
[editable]="!readOnly && isPanelEditing(DefaultPanels.PROPERTIES)"
[displayEmpty]="displayEmpty"
[copyToClipboardAction]="copyToClipboardAction"
@@ -59,7 +63,7 @@
<ng-container *ngIf="displayTags">
<mat-expansion-panel
hideToggle
[expanded]="currentPanel.panelTitle === DefaultPanels.TAGS && currentPanel.expanded"
[expanded]="isExpandedTags"
(opened)="expandPanel(DefaultPanels.TAGS)"
(closed)="closePanel(DefaultPanels.TAGS)"
class="adf-content-metadata-panel"
@@ -67,8 +71,8 @@
<mat-expansion-panel-header
class="adf-metadata-properties-header"
[attr.aria-label]="'CORE.METADATA.ACCESSIBILITY.SECTION' | translate: { sectionName: ('METADATA.BASIC.TAGS' | translate) }"
[class.adf-metadata-properties-header-expanded]="currentPanel.panelTitle === DefaultPanels.TAGS && currentPanel.expanded">
<adf-content-metadata-header [title]="'METADATA.BASIC.TAGS'" [expanded]="currentPanel.panelTitle === DefaultPanels.TAGS && currentPanel.expanded">
[class.adf-metadata-properties-header-expanded]="isExpandedTags">
<adf-content-metadata-header [title]="'METADATA.BASIC.TAGS'" [expanded]="isExpandedTags">
<button
*ngIf="!readOnly && !isPanelEditing(DefaultPanels.TAGS)"
mat-icon-button
@@ -121,7 +125,7 @@
<ng-container *ngIf="displayCategories">
<mat-expansion-panel
hideToggle
[expanded]="currentPanel.panelTitle === DefaultPanels.CATEGORIES && currentPanel.expanded"
[expanded]="isExpandedCategories"
(opened)="expandPanel(DefaultPanels.CATEGORIES)"
(closed)="closePanel(DefaultPanels.CATEGORIES)"
class="adf-content-metadata-panel"
@@ -129,10 +133,10 @@
<mat-expansion-panel-header
class="adf-metadata-properties-header"
[attr.aria-label]="'CORE.METADATA.ACCESSIBILITY.SECTION' | translate: { sectionName: ('CATEGORIES_MANAGEMENT.CATEGORIES_TITLE' | translate) }"
[class.adf-metadata-properties-header-expanded]="currentPanel.panelTitle === DefaultPanels.CATEGORIES && currentPanel.expanded">
[class.adf-metadata-properties-header-expanded]="isExpandedCategories">
<adf-content-metadata-header
[title]="'CATEGORIES_MANAGEMENT.CATEGORIES_TITLE'"
[expanded]="currentPanel.panelTitle === DefaultPanels.CATEGORIES && currentPanel.expanded">
[expanded]="isExpandedCategories">
<button
*ngIf="!readOnly && !isPanelEditing(DefaultPanels.CATEGORIES)"
mat-icon-button
@@ -164,12 +168,18 @@
</div>
</adf-content-metadata-header>
</mat-expansion-panel-header>
<div *ngIf="currentPanel.panelTitle === DefaultPanels.CATEGORIES && editedPanelTitle !== DefaultPanels.CATEGORIES">
<p *ngFor="let category of categories" class="adf-metadata-categories">{{ category.name }}</p>
</div>
<div *ngIf="showEmptyCategoryMessage" class="adf-metadata-no-item-added">
{{ 'CATEGORIES_MANAGEMENT.NO_CATEGORIES_ADDED' | translate }}
</div>
@if (currentPanel.panelTitle === DefaultPanels.CATEGORIES && editedPanelTitle !== DefaultPanels.CATEGORIES) {
<div>
@for (category of categories; track category.id) {
<p class="adf-metadata-categories">{{ category.name }}</p>
}
</div>
}
@if (showEmptyCategoryMessage) {
<div class="adf-metadata-no-item-added">
{{ 'CATEGORIES_MANAGEMENT.NO_CATEGORIES_ADDED' | translate }}
</div>
}
<adf-categories-management
*ngIf="!readOnly && isPanelEditing(DefaultPanels.CATEGORIES)"
class="adf-metadata-categories-header"
@@ -182,87 +192,93 @@
</mat-expansion-panel>
</ng-container>
<mat-expansion-panel
*ngFor="let customPanel of customPanels"
[expanded]="currentPanel.panelTitle === customPanel.panelTitle && currentPanel.expanded"
(opened)="expandPanel(customPanel.panelTitle)"
(closed)="closePanel(customPanel.panelTitle)"
class="adf-content-metadata-panel"
hideToggle>
<mat-expansion-panel-header
class="adf-metadata-properties-header"
[attr.aria-label]="'CORE.METADATA.ACCESSIBILITY.SECTION' | translate: { sectionName: (customPanel.panelTitle | translate) }"
[class.adf-metadata-properties-header-expanded]="currentPanel.panelTitle === customPanel.panelTitle && currentPanel.expanded">
<adf-content-metadata-header
class="adf-metadata-custom-panel-title"
[title]="customPanel.panelTitle"
[expanded]="currentPanel.panelTitle === customPanel.panelTitle && currentPanel.expanded" />
</mat-expansion-panel-header>
<adf-dynamic-component [id]="customPanel.component" [data]="{ node }" />
</mat-expansion-panel>
@for (customPanel of customPanels; track customPanel.panelTitle) {
@let isExpandedCustomPanel = (currentPanel.panelTitle === customPanel.panelTitle && currentPanel.expanded) ?? false;
<mat-expansion-panel
[expanded]="isExpandedCustomPanel"
(opened)="expandPanel(customPanel.panelTitle)"
(closed)="closePanel(customPanel.panelTitle)"
class="adf-content-metadata-panel"
hideToggle>
<ng-container *ngIf="groupedProperties$ | async; else loading; let groupedProperties">
<div *ngFor="let group of groupedProperties; let first = first" class="adf-metadata-grouped-properties-container">
<mat-expansion-panel
[attr.data-automation-id]="'adf-metadata-group-' + group.title"
[expanded]="multi ? !displayDefaultProperties && first || group.expanded : !displayDefaultProperties && first || currentPanel.panelTitle === group.title && currentPanel.expanded"
(opened)="expandPanel(group.title); group.expanded = true"
(closed)="closePanel(group.title); group.expanded = false"
class="adf-content-metadata-panel"
hideToggle>
<mat-expansion-panel-header
class="adf-metadata-properties-header"
[attr.aria-label]="'CORE.METADATA.ACCESSIBILITY.SECTION' | translate: { sectionName: (group.title | translate) }"
[class.adf-metadata-properties-header-expanded]="currentPanel.panelTitle === group.title && currentPanel.expanded">
<adf-content-metadata-header [title]="group.title" [expanded]="currentPanel.panelTitle === group.title && currentPanel.expanded">
<button
*ngIf="group.editable && !this.readOnly && !isPanelEditing(group.title)"
mat-icon-button
[attr.title]="'CORE.METADATA.ACTIONS.EDIT' | translate"
[attr.aria-label]="'CORE.METADATA.ACCESSIBILITY.EDIT' | translate: { sectionName: (group.title | translate) }"
data-automation-id="meta-data-card-toggle-edit"
class="adf-edit-icon-buttons"
(click)="toggleGroupEditing(group.title, $event)">
<mat-icon adf-icon="mode_edit" />
</button>
<div class="adf-metadata-action-buttons" *ngIf="group.editable && isPanelEditing(group.title)">
<button
mat-icon-button
[attr.title]="'CORE.METADATA.ACTIONS.CANCEL' | translate"
(click)="cancelGroupEditing(group.title, $event)"
data-automation-id="reset-metadata"
class="adf-metadata-action-buttons-clear">
<mat-icon adf-icon="clear" />
</button>
<button
mat-icon-button
[attr.title]="'CORE.METADATA.ACTIONS.SAVE' | translate"
(click)="saveChanges($event)"
color="primary"
data-automation-id="save-metadata"
[disabled]="!hasMetadataChanged || invalidProperties.size > 0">
<mat-icon adf-icon="check" />
</button>
</div>
</adf-content-metadata-header>
</mat-expansion-panel-header>
<div *ngIf="!showGroup(group) && !displayEmpty && group.editable && editedPanelTitle !== group.title" class="adf-metadata-no-item-added">
{{ 'METADATA.BASIC.NO_ITEMS_MESSAGE' | translate : { groupTitle: group.title | translate } }}
</div>
<adf-card-view
class="adf-metadata-properties-expansion-panel"
(keydown)="keyDown($event)"
[properties]="group.properties"
[editable]="!readOnly && group.editable && isPanelEditing(group.title)"
[displayEmpty]="displayEmpty"
[copyToClipboardAction]="copyToClipboardAction"
[useChipsForMultiValueProperty]="useChipsForMultiValueProperty"
[multiValueSeparator]="multiValueSeparator" />
</mat-expansion-panel>
</div>
</ng-container>
<mat-expansion-panel-header
class="adf-metadata-properties-header"
[attr.aria-label]="'CORE.METADATA.ACCESSIBILITY.SECTION' | translate: { sectionName: (customPanel.panelTitle | translate) }"
[class.adf-metadata-properties-header-expanded]="isExpandedCustomPanel">
<adf-content-metadata-header
class="adf-metadata-custom-panel-title"
[title]="customPanel.panelTitle"
[expanded]="isExpandedCustomPanel" />
</mat-expansion-panel-header>
<adf-dynamic-component [id]="customPanel.component" [data]="{ node }" />
</mat-expansion-panel>
}
<ng-template #loading>
@let groupedProperties = groupedProperties$ | async;
@if (groupedProperties) {
@for (group of groupedProperties; track group.title; let first = $first) {
@let isExpandedGroup = (currentPanel.panelTitle === group.title && currentPanel.expanded) ?? false;
<div class="adf-metadata-grouped-properties-container">
<mat-expansion-panel
[attr.data-automation-id]="'adf-metadata-group-' + group.title"
[expanded]="multi ? !displayDefaultProperties && first || group.expanded : !displayDefaultProperties && first || isExpandedGroup"
(opened)="expandPanel(group.title); group.expanded = true"
(closed)="closePanel(group.title); group.expanded = false"
class="adf-content-metadata-panel"
hideToggle>
<mat-expansion-panel-header
class="adf-metadata-properties-header"
[attr.aria-label]="'CORE.METADATA.ACCESSIBILITY.SECTION' | translate: { sectionName: (group.title | translate) }"
[class.adf-metadata-properties-header-expanded]="isExpandedGroup">
<adf-content-metadata-header [title]="group.title" [expanded]="isExpandedGroup">
<button
*ngIf="group.editable && !this.readOnly && !isPanelEditing(group.title)"
mat-icon-button
[attr.title]="'CORE.METADATA.ACTIONS.EDIT' | translate"
[attr.aria-label]="'CORE.METADATA.ACCESSIBILITY.EDIT' | translate: { sectionName: (group.title | translate) }"
data-automation-id="meta-data-card-toggle-edit"
class="adf-edit-icon-buttons"
(click)="toggleGroupEditing(group.title, $event)">
<mat-icon adf-icon="mode_edit" />
</button>
<div class="adf-metadata-action-buttons" *ngIf="group.editable && isPanelEditing(group.title)">
<button
mat-icon-button
[attr.title]="'CORE.METADATA.ACTIONS.CANCEL' | translate"
(click)="cancelGroupEditing(group.title, $event)"
data-automation-id="reset-metadata"
class="adf-metadata-action-buttons-clear">
<mat-icon adf-icon="clear" />
</button>
<button
mat-icon-button
[attr.title]="'CORE.METADATA.ACTIONS.SAVE' | translate"
(click)="saveChanges($event)"
color="primary"
data-automation-id="save-metadata"
[disabled]="!hasMetadataChanged || invalidProperties.size > 0">
<mat-icon adf-icon="check" />
</button>
</div>
</adf-content-metadata-header>
</mat-expansion-panel-header>
<div *ngIf="!showGroup(group) && !displayEmpty && group.editable && editedPanelTitle !== group.title" class="adf-metadata-no-item-added">
{{ 'METADATA.BASIC.NO_ITEMS_MESSAGE' | translate : { groupTitle: group.title | translate } }}
</div>
<adf-card-view
class="adf-metadata-properties-expansion-panel"
(keydown)="keyDown($event)"
[properties]="group.properties"
[editable]="!readOnly && group.editable && isPanelEditing(group.title)"
[displayEmpty]="displayEmpty"
[copyToClipboardAction]="copyToClipboardAction"
[useChipsForMultiValueProperty]="useChipsForMultiValueProperty"
[multiValueSeparator]="multiValueSeparator" />
</mat-expansion-panel>
</div>
}
} @else {
<mat-progress-bar mode="indeterminate" [attr.aria-label]="'DATA_LOADING' | translate" />
</ng-template>
}
</mat-accordion>
@@ -1,30 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { NgModule } from '@angular/core';
import { ContentMetadataComponent } from './components/content-metadata/content-metadata.component';
import { ContentMetadataCardComponent } from './components/content-metadata-card/content-metadata-card.component';
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: [...CONTENT_METADATA_DIRECTIVES],
exports: [...CONTENT_METADATA_DIRECTIVES]
})
export class ContentMetadataModule {}
@@ -30,5 +30,3 @@ export * from './services/config/layout-oriented-config.service';
export * from './services/config/aspect-oriented-config.service';
export * from './interfaces/content-metadata.interfaces';
export * from './content-metadata.module';
@@ -24,7 +24,6 @@ import { CONTENT_SEARCH_DIRECTIVES } from './search/search.module';
import { CONTENT_VERSION_DIRECTIVES } from './version-manager/version-manager.module';
import { CONTENT_NODE_SHARE_DIRECTIVES } from './content-node-share/content-node-share.module';
import { CONTENT_DIRECTIVES } from './directives/content-directive.module';
import { CONTENT_METADATA_DIRECTIVES } from './content-metadata/content-metadata.module';
import { CONTENT_PERMISSION_MANAGER_DIRECTIVES } from './permission-manager/permission-manager.module';
import { versionCompatibilityFactory } from './version-compatibility/version-compatibility-factory';
import { VersionCompatibilityService } from './version-compatibility/version-compatibility.service';
@@ -46,7 +45,6 @@ import { AlfrescoApiLoaderService, createAlfrescoApiInstance } from './api-facto
...DOCUMENT_LIST_DIRECTIVES,
...CONTENT_UPLOAD_DIRECTIVES,
...CONTENT_NODE_SHARE_DIRECTIVES,
...CONTENT_METADATA_DIRECTIVES,
...CONTENT_DIRECTIVES,
...CONTENT_PERMISSION_MANAGER_DIRECTIVES,
...CONTENT_VERSION_DIRECTIVES
@@ -59,7 +57,6 @@ import { AlfrescoApiLoaderService, createAlfrescoApiInstance } from './api-facto
...CONTENT_UPLOAD_DIRECTIVES,
...CONTENT_SEARCH_DIRECTIVES,
...CONTENT_NODE_SHARE_DIRECTIVES,
...CONTENT_METADATA_DIRECTIVES,
...CONTENT_DIRECTIVES,
...CONTENT_PERMISSION_MANAGER_DIRECTIVES,
...CONTENT_VERSION_DIRECTIVES