mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
add missing typing information (#5227)
* add missing typing information * typing fixes * revert return type * typing fixes
This commit is contained in:
committed by
Eugenio Romano
parent
2138ce600e
commit
0c13f3d879
@@ -56,7 +56,7 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn
|
||||
* (eg, following a network error).
|
||||
*/
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
error = new EventEmitter<any>();
|
||||
|
||||
hasCustomTemplate: boolean = false;
|
||||
|
||||
@@ -91,7 +91,7 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn
|
||||
});
|
||||
}
|
||||
|
||||
hasCustomEmptyTemplate() {
|
||||
hasCustomEmptyTemplate(): boolean {
|
||||
return !!this.emptyTemplate;
|
||||
}
|
||||
|
||||
|
@@ -64,7 +64,7 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit
|
||||
|
||||
/** Emitted when an error occurs while fetching the attachments. */
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
error = new EventEmitter<any>();
|
||||
|
||||
hasCustomTemplate: boolean = false;
|
||||
|
||||
|
@@ -15,9 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DataTableComponent } from '@alfresco/adf-core';
|
||||
import { DataTableComponent, DataCellEvent } from '@alfresco/adf-core';
|
||||
import { DataColumnListComponent, UserProcessModel } from '@alfresco/adf-core';
|
||||
import { AfterContentInit, AfterViewInit, Component, ContentChild, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
||||
import { AfterContentInit, Component, ContentChild, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
||||
import { UserEventModel } from '../../../task-list/models/user-event.model';
|
||||
|
||||
@Component({
|
||||
@@ -26,9 +26,10 @@ import { UserEventModel } from '../../../task-list/models/user-event.model';
|
||||
styleUrls: ['./people-list.component.scss']
|
||||
})
|
||||
|
||||
export class PeopleListComponent implements AfterViewInit, AfterContentInit {
|
||||
export class PeopleListComponent implements AfterContentInit {
|
||||
|
||||
@ContentChild(DataColumnListComponent) columnList: DataColumnListComponent;
|
||||
@ContentChild(DataColumnListComponent)
|
||||
columnList: DataColumnListComponent;
|
||||
|
||||
@ViewChild('dataTable')
|
||||
peopleDataTable: DataTableComponent;
|
||||
@@ -43,11 +44,11 @@ export class PeopleListComponent implements AfterViewInit, AfterContentInit {
|
||||
|
||||
/** Emitted when the user clicks a row in the people list. */
|
||||
@Output()
|
||||
clickRow: EventEmitter<UserProcessModel> = new EventEmitter<UserProcessModel>();
|
||||
clickRow = new EventEmitter<UserProcessModel>();
|
||||
|
||||
/** Emitted when the user clicks in the 'Three Dots' drop down menu for a row. */
|
||||
@Output()
|
||||
clickAction: EventEmitter<UserEventModel> = new EventEmitter<UserEventModel>();
|
||||
clickAction = new EventEmitter<UserEventModel>();
|
||||
|
||||
user: UserProcessModel;
|
||||
|
||||
@@ -55,9 +56,6 @@ export class PeopleListComponent implements AfterViewInit, AfterContentInit {
|
||||
this.peopleDataTable.columnList = this.columnList;
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
}
|
||||
|
||||
selectUser(event: any) {
|
||||
this.user = event.value.obj;
|
||||
this.clickRow.emit(this.user);
|
||||
@@ -67,7 +65,7 @@ export class PeopleListComponent implements AfterViewInit, AfterContentInit {
|
||||
return this.actions;
|
||||
}
|
||||
|
||||
onShowRowActionsMenu(event: any) {
|
||||
onShowRowActionsMenu(event: DataCellEvent) {
|
||||
|
||||
const removeAction = {
|
||||
title: 'Remove',
|
||||
@@ -82,6 +80,6 @@ export class PeopleListComponent implements AfterViewInit, AfterContentInit {
|
||||
onExecuteRowAction(event: any) {
|
||||
const args = event.value;
|
||||
const action = args.action;
|
||||
this.clickAction.emit(new UserEventModel({type: action.name, value: args.row.obj}));
|
||||
this.clickAction.emit({type: action.name, value: args.row.obj});
|
||||
}
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ export class PeopleSearchFieldComponent {
|
||||
placeholder: string;
|
||||
|
||||
@Output()
|
||||
rowClick: EventEmitter<UserProcessModel> = new EventEmitter<UserProcessModel>();
|
||||
rowClick = new EventEmitter<UserProcessModel>();
|
||||
|
||||
users$: Observable<UserProcessModel[]>;
|
||||
searchUser: FormControl = new FormControl();
|
||||
@@ -64,23 +64,23 @@ export class PeopleSearchFieldComponent {
|
||||
this.defaultPlaceholder = this.translationService.instant(this.defaultPlaceholder);
|
||||
}
|
||||
|
||||
public reset() {
|
||||
reset() {
|
||||
this.searchUser.reset();
|
||||
}
|
||||
|
||||
get searchPlaceholder() {
|
||||
get searchPlaceholder(): string {
|
||||
return this.placeholder || this.defaultPlaceholder;
|
||||
}
|
||||
|
||||
onRowClick(event) {
|
||||
this.rowClick.emit(event);
|
||||
onRowClick(model: UserProcessModel) {
|
||||
this.rowClick.emit(model);
|
||||
}
|
||||
|
||||
getDisplayUser(firstName: string, lastName: string, delimiter: string = '-'): string {
|
||||
return getDisplayUser(firstName, lastName, delimiter);
|
||||
}
|
||||
|
||||
getInitialUserName(firstName: string, lastName: string) {
|
||||
getInitialUserName(firstName: string, lastName: string): string {
|
||||
firstName = (firstName !== null && firstName !== '' ? firstName[0] : '');
|
||||
lastName = (lastName !== null && lastName !== '' ? lastName[0] : '');
|
||||
return this.getDisplayUser(firstName, lastName, '');
|
||||
|
@@ -39,11 +39,11 @@ export class PeopleSearchComponent implements OnInit {
|
||||
|
||||
/** Emitted when a search is performed with a new keyword. */
|
||||
@Output()
|
||||
searchPeople: EventEmitter<any> = new EventEmitter();
|
||||
searchPeople = new EventEmitter<any>();
|
||||
|
||||
/** Emitted when a user is selected and the action button is clicked. */
|
||||
@Output()
|
||||
success: EventEmitter<UserProcessModel> = new EventEmitter<UserProcessModel>();
|
||||
success = new EventEmitter<UserProcessModel>();
|
||||
|
||||
/** Emitted when the "close" button is clicked. */
|
||||
@Output()
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { LogService, UserProcessModel } from '@alfresco/adf-core';
|
||||
import { PeopleProcessService } from '@alfresco/adf-core';
|
||||
import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core';
|
||||
import { Component, Input, ViewChild } from '@angular/core';
|
||||
import { Observable, Observer } from 'rxjs';
|
||||
import { UserEventModel } from '../../../task-list/models/user-event.model';
|
||||
import { PeopleSearchComponent } from '../people-search/people-search.component';
|
||||
@@ -28,7 +28,7 @@ import { share } from 'rxjs/operators';
|
||||
templateUrl: './people.component.html',
|
||||
styleUrls: ['./people.component.scss']
|
||||
})
|
||||
export class PeopleComponent implements OnInit, AfterViewInit {
|
||||
export class PeopleComponent {
|
||||
|
||||
/** The array of User objects to display. */
|
||||
@Input()
|
||||
@@ -57,12 +57,6 @@ export class PeopleComponent implements OnInit, AfterViewInit {
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
}
|
||||
|
||||
involveUserAndCloseSearch() {
|
||||
if (this.peopleSearch) {
|
||||
this.peopleSearch.involveUserAndClose();
|
||||
@@ -98,9 +92,7 @@ export class PeopleComponent implements OnInit, AfterViewInit {
|
||||
.removeInvolvedUser(this.taskId, user.id.toString())
|
||||
.subscribe(
|
||||
() => {
|
||||
this.people = this.people.filter((involvedUser) => {
|
||||
return involvedUser.id !== user.id;
|
||||
});
|
||||
this.people = this.people.filter(involvedUser => involvedUser.id !== user.id);
|
||||
},
|
||||
() => this.logService.error('Impossible to remove involved user from task'));
|
||||
}
|
||||
@@ -122,16 +114,16 @@ export class PeopleComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
onClickAction(event: UserEventModel) {
|
||||
if (event.type === 'remove') {
|
||||
if (event && event.value && event.type === 'remove') {
|
||||
this.removeInvolvedUser(event.value);
|
||||
}
|
||||
}
|
||||
|
||||
hasPeople() {
|
||||
hasPeople(): boolean {
|
||||
return this.people && this.people.length > 0;
|
||||
}
|
||||
|
||||
isEditMode() {
|
||||
isEditMode(): boolean {
|
||||
return !this.readOnly;
|
||||
}
|
||||
|
||||
|
@@ -18,12 +18,7 @@
|
||||
/**
|
||||
* This object represent the User Event.
|
||||
*/
|
||||
export class UserEventModel {
|
||||
type: string = '';
|
||||
value: any = {};
|
||||
|
||||
constructor(obj?: any) {
|
||||
this.type = obj && obj.type;
|
||||
this.value = obj && obj.value || {};
|
||||
}
|
||||
export interface UserEventModel {
|
||||
type: string;
|
||||
value: any;
|
||||
}
|
||||
|
@@ -19,18 +19,10 @@
|
||||
* This object represent the process service user group.*
|
||||
*/
|
||||
|
||||
export class UserGroupModel {
|
||||
export interface UserGroupModel {
|
||||
id?: number;
|
||||
name?: string;
|
||||
externalId?: string;
|
||||
status?: string;
|
||||
groups?: any = {};
|
||||
|
||||
constructor(obj?: any) {
|
||||
this.id = obj && obj.id;
|
||||
this.name = obj && obj.name;
|
||||
this.externalId = obj && obj.externalId;
|
||||
this.status = obj && obj.status;
|
||||
this.groups = obj && obj.groups;
|
||||
}
|
||||
groups?: any;
|
||||
}
|
||||
|
@@ -77,7 +77,7 @@ export class TaskListService {
|
||||
const requestNodeForFilter = this.generateTaskRequestNodeFromFilter(filterModel);
|
||||
return from(this.callApiTasksFiltered(requestNodeForFilter))
|
||||
.pipe(
|
||||
map((res: any) => {
|
||||
map(res => {
|
||||
return res.data.find((element) => element.id === taskId) ? filterModel : null;
|
||||
}),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -155,7 +155,7 @@ export class TaskListService {
|
||||
getTaskDetails(taskId: string): Observable<TaskDetailsModel> {
|
||||
return from(this.callApiTaskDetails(taskId))
|
||||
.pipe(
|
||||
map((details: any) => {
|
||||
map(details => {
|
||||
return new TaskDetailsModel(details);
|
||||
}),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -170,7 +170,7 @@ export class TaskListService {
|
||||
getTaskChecklist(id: string): Observable<TaskDetailsModel[]> {
|
||||
return from(this.callApiTaskChecklist(id))
|
||||
.pipe(
|
||||
map((response: any) => {
|
||||
map(response => {
|
||||
const checklists: TaskDetailsModel[] = [];
|
||||
response.data.forEach((checklist) => {
|
||||
checklists.push(new TaskDetailsModel(checklist));
|
||||
@@ -194,7 +194,7 @@ export class TaskListService {
|
||||
|
||||
return from(this.apiService.getInstance().activiti.modelsApi.getModels(opts))
|
||||
.pipe(
|
||||
map((response: any) => {
|
||||
map(response => {
|
||||
const forms: Form[] = [];
|
||||
response.data.forEach((form) => {
|
||||
forms.push(new Form(form.id, form.name));
|
||||
@@ -278,9 +278,6 @@ export class TaskListService {
|
||||
requestNode.size = 0;
|
||||
return from(this.callApiTasksFiltered(requestNode))
|
||||
.pipe(
|
||||
map((res: any) => {
|
||||
return res;
|
||||
}),
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
}
|
||||
@@ -364,7 +361,7 @@ export class TaskListService {
|
||||
* @param updated Data to update the task (as a `TaskUpdateRepresentation` instance).
|
||||
* @returns Updated task details
|
||||
*/
|
||||
updateTask(taskId: any, updated: TaskUpdateRepresentation): Observable<TaskDetailsModel> {
|
||||
updateTask(taskId: string, updated: TaskUpdateRepresentation): Observable<TaskDetailsModel> {
|
||||
return from(this.apiService.taskApi.updateTask(taskId, updated))
|
||||
.pipe(
|
||||
map((result) => <TaskDetailsModel> result),
|
||||
|
@@ -21,7 +21,7 @@ export class TaskDescriptionValidator implements CardViewItemValidator {
|
||||
|
||||
message: string = 'ADF_CLOUD_TASK_HEADER.FORM_VALIDATION.INVALID_FIELD';
|
||||
|
||||
isValid(value: any): boolean {
|
||||
isValid(value: string): boolean {
|
||||
const isWhitespace = (value || '').trim().length === 0;
|
||||
return value.length === 0 || !isWhitespace;
|
||||
}
|
||||
|
Reference in New Issue
Block a user