Skip to content

Commit

Permalink
[ACS-8960] Review and apply required inputs where possible (#10554)
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikiwanekhyland authored Jan 17, 2025
1 parent 0bc4227 commit ada55ae
Show file tree
Hide file tree
Showing 61 changed files with 119 additions and 195 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
})
export class AspectListComponent implements OnInit {
/** Node Id of the node that we want to update */
@Input()
@Input({ required: true })
nodeId: string = '';

/** List of aspects' ids which should not be displayed. */
Expand Down
15 changes: 2 additions & 13 deletions lib/content-services/src/lib/breadcrumb/breadcrumb.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,7 @@
* limitations under the License.
*/

import {
Component,
DestroyRef,
EventEmitter,
inject,
Input,
OnChanges,
OnInit,
Output,
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { Component, DestroyRef, EventEmitter, inject, Input, OnChanges, OnInit, Output, ViewChild, ViewEncapsulation } from '@angular/core';
import { MatSelect, MatSelectModule } from '@angular/material/select';
import { Node, PathElement } from '@alfresco/js-api';
import { DocumentListComponent } from '../document-list/components/document-list.component';
Expand All @@ -46,7 +35,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
})
export class BreadcrumbComponent implements OnInit, OnChanges {
/** Active node, builds UI based on folderNode.path.elements collection. */
@Input()
@Input({ required: true })
folderNode: Node = null;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy {
* In ASSIGN mode we can only assign/unassign categories from existing list.
* In CRUD mode we can create categories.
*/
@Input()
@Input({ required: true })
managementMode: CategoriesManagementMode;

/** ID of a parent category. New categories will be created under this parent */
Expand Down Expand Up @@ -180,7 +180,9 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy {
)
.subscribe((name: string) => this.onNameControlValueChange(name));

this.categoryNameControl.statusChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.setCategoryNameControlErrorMessageKey());
this.categoryNameControl.statusChanges
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(() => this.setCategoryNameControlErrorMessageKey());

this.setCategoryNameControlErrorMessageKey();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { TranslateModule } from '@ngx-translate/core';
})
export class ContentMetadataCardComponent implements OnChanges {
/** (required) The node entity to fetch metadata about */
@Input()
@Input({ required: true })
node: Node;

/**
Expand Down Expand Up @@ -68,7 +68,7 @@ export class ContentMetadataCardComponent implements OnChanges {
* Name or configuration of the metadata preset, which defines aspects
* and their properties.
*/
@Input()
@Input({ required: true })
preset: string | PresetConfig;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ enum DefaultPanels {
})
export class ContentMetadataComponent implements OnChanges, OnInit {
/** (required) The node entity to fetch metadata about */
@Input()
@Input({ required: true })
node: Node;

/** Toggles whether to display empty values in the card view */
Expand All @@ -105,7 +105,7 @@ export class ContentMetadataComponent implements OnChanges, OnInit {
multi = false;

/** Name or configuration of the metadata preset, which defines aspects and their properties */
@Input()
@Input({ required: true })
preset: string | PresetConfig;

/** Toggles whether the metadata properties should be shown */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit {
restrictRootToCurrentFolderId: boolean = false;

/** Node ID of the folder currently listed. */
@Input()
@Input({ required: true })
currentFolderId: string = null;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,13 @@
* limitations under the License.
*/

import {
Component,
DestroyRef,
EventEmitter,
Inject,
inject,
Input,
OnChanges,
OnInit,
Output,
SimpleChanges
} from '@angular/core';
import { Component, DestroyRef, EventEmitter, Inject, inject, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { DataSorting, HeaderFilterTemplateDirective, PaginationModel } from '@alfresco/adf-core';
import { SearchHeaderQueryBuilderService } from '../../../search/services/search-header-query-builder.service';
import { FilterSearch } from './../../../search/models/filter-search.interface';
import { ADF_DOCUMENT_PARENT_COMPONENT } from '../document-list.token';
import { CommonModule } from '@angular/common';
import {
SearchFilterContainerComponent
} from '../../../search/components/search-filter-container/search-filter-container.component';
import { SearchFilterContainerComponent } from '../../../search/components/search-filter-container/search-filter-container.component';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';

@Component({
Expand All @@ -49,15 +36,15 @@ export class FilterHeaderComponent implements OnInit, OnChanges {
value: any = {};

/** The id of the current folder of the document list. */
@Input()
@Input({ required: true })
currentFolderId: string;

/** Emitted when a filter value is selected */
@Output()
filterSelection: EventEmitter<FilterSearch[]> = new EventEmitter();

isFilterServiceActive: boolean;

private readonly destroyRef = inject(DestroyRef);

constructor(@Inject(ADF_DOCUMENT_PARENT_COMPONENT) private documentList: any, private searchFilterQueryBuilder: SearchHeaderQueryBuilderService) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,7 @@
* limitations under the License.
*/

import {
ChangeDetectionStrategy,
Component,
DestroyRef,
ElementRef,
inject,
Input,
OnInit,
ViewEncapsulation
} from '@angular/core';
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { NodeEntry, Site } from '@alfresco/js-api';
import { ShareDataRow } from '../../data/share-data-row.model';
import { NodesApiService } from '../../../common/services/nodes-api.service';
Expand Down Expand Up @@ -64,7 +55,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
}
})
export class LibraryNameColumnComponent implements OnInit {
@Input()
@Input({ required: true })
context: any;

displayTooltip$ = new BehaviorSubject<string>('');
Expand Down Expand Up @@ -129,5 +120,4 @@ export class LibraryNameColumnComponent implements OnInit {

return isDuplicate ? `${title} (${id})` : `${title}`;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,7 @@
* limitations under the License.
*/

import {
ChangeDetectionStrategy,
Component,
DestroyRef,
inject,
Input,
OnInit,
ViewEncapsulation
} from '@angular/core';
import { ChangeDetectionStrategy, Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { Site, SiteEntry } from '@alfresco/js-api';
import { ShareDataRow } from '../../data/share-data-row.model';
Expand All @@ -46,7 +38,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
host: { class: 'adf-library-role-column adf-datatable-content-cell' }
})
export class LibraryRoleColumnComponent implements OnInit {
@Input()
@Input({ required: true })
context: any;

displayText$ = new BehaviorSubject<string>('');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
host: { class: 'adf-library-status-column adf-datatable-content-cell' }
})
export class LibraryStatusColumnComponent implements OnInit {
@Input()
@Input({ required: true })
context: any;

displayText$ = new BehaviorSubject<string>('');
Expand Down Expand Up @@ -82,5 +82,4 @@ export class LibraryStatusColumnComponent implements OnInit {
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,7 @@
* limitations under the License.
*/

import {
ChangeDetectionStrategy,
Component,
DestroyRef,
ElementRef,
inject,
Input,
OnInit,
ViewEncapsulation
} from '@angular/core';
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { NodeEntry } from '@alfresco/js-api';
import { BehaviorSubject } from 'rxjs';
import { NodesApiService } from '../../../common/services/nodes-api.service';
Expand Down Expand Up @@ -62,7 +53,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
host: { class: 'adf-datatable-content-cell adf-datatable-link adf-name-column' }
})
export class NameColumnComponent implements OnInit {
@Input()
@Input({ required: true })
context: any;

@Input()
Expand Down Expand Up @@ -110,5 +101,4 @@ export class NameColumnComponent implements OnInit {
})
);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { Component, ChangeDetectionStrategy, ViewEncapsulation, OnInit, Input } from '@angular/core';
import { ChangeDetectionStrategy, Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { NodeEntry } from '@alfresco/js-api';
import { ShareDataRow } from '../../data/share-data-row.model';
import { CommonModule } from '@angular/common';
Expand All @@ -38,7 +38,7 @@ import { NodeNameTooltipPipe } from '../../../pipes/node-name-tooltip.pipe';
host: { class: 'adf-datatable-content-cell adf-trashcan-name-column' }
})
export class TrashcanNameColumnComponent implements OnInit {
@Input()
@Input({ required: true })
context: any;

isLibrary = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { NodeCommentsService } from './services/node-comments.service';
})
export class NodeCommentsComponent {
/** nodeId of the document that has comments */
@Input()
@Input({ required: true })
nodeId: string;

/** make the comments component readOnly */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { TranslateModule } from '@ngx-translate/core';
*/
export class AddPermissionComponent implements OnInit {
/** ID of the target node. */
@Input()
@Input({ required: true })
nodeId: string;

/** Emitted when the node is updated successfully. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import { UserRoleColumnComponent } from '../user-role-column/user-role-column.co
encapsulation: ViewEncapsulation.None
})
export class PermissionContainerComponent implements OnChanges {
@Input()
@Input({ required: true })
node: Node;

@Input()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
})
export class PermissionListComponent implements OnInit {
/** ID of the node whose permissions you want to show. */
@Input()
@Input({ required: true })
nodeId: string;

/** Emitted when the permission is updated. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export class SearchFacetFieldComponent implements FacetWidget {
private searchFacetFiltersService = inject(SearchFacetFiltersService);
private translationService = inject(TranslationService);

@Input()
field!: FacetField;
@Input({ required: true })
field: FacetField;

displayValue$: Subject<string> = new Subject<string>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class SearchFacetTabbedContentComponent implements OnInit, OnChanges, Fac
private translationService = inject(TranslationService);
private searchFacetFiltersService = inject(SearchFacetFiltersService);

@Input()
@Input({ required: true })
tabbedFacet: TabbedFacetField;

@Input()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import { MatButtonModule } from '@angular/material/button';
encapsulation: ViewEncapsulation.None
})
export class SearchFacetChipComponent {
@Input()
@Input({ required: true })
field: FacetField;

@ViewChild('menuContainer', { static: false })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import { first } from 'rxjs/operators';
encapsulation: ViewEncapsulation.None
})
export class SearchWidgetChipComponent implements AfterViewInit {
@Input()
@Input({ required: true })
category: SearchCategory;

@ViewChild('menuContainer', { static: false })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,7 @@
* limitations under the License.
*/

import {
Component,
ElementRef,
EventEmitter,
Input,
OnInit,
Output,
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild, ViewEncapsulation } from '@angular/core';
import { ConfigurableFocusTrap, ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';
import { DataColumn, IconComponent, TranslationService } from '@alfresco/adf-core';
import { SearchWidgetContainerComponent } from '../search-widget-container/search-widget-container.component';
Expand Down Expand Up @@ -57,7 +48,7 @@ import { MatDialogModule } from '@angular/material/dialog';
})
export class SearchFilterContainerComponent implements OnInit {
/** The column the filter will be applied on. */
@Input()
@Input({ required: true })
col: DataColumn;

/** The column the filter will be applied on. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { MatButtonModule } from '@angular/material/button';
encapsulation: ViewEncapsulation.None
})
export class SearchFilterCardComponent {
@Input()
@Input({ required: true })
category: SearchCategory;

@ViewChild(SearchWidgetContainerComponent, { static: false })
Expand Down
Loading

0 comments on commit ada55ae

Please sign in to comment.