@rero/ng-core
Version:
RERO angular core library.
88 lines (87 loc) • 3.61 kB
TypeScript
import { ActivatedRoute, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { ConfirmationService, MessageService } from 'primeng/api';
import { Observable } from 'rxjs';
import { ActionStatus } from './action-status';
import { RecordService } from './record.service';
import * as i0 from "@angular/core";
export declare class RecordUiService {
protected translateService: TranslateService;
protected recordService: RecordService;
protected router: Router;
protected confirmationService: ConfirmationService;
protected messageService: MessageService;
/** Configuration for all resources. */
types: any[];
/**
* Delete a record by its PID.
* @param type Type of resource
* @param pid - string, PID to delete
* @returns Observable resolving as a boolean
*/
deleteRecord(type: string, pid: string): Observable<boolean>;
/**
* Show dialog with the reason why record cannot be deleted.
* @param message Message to display
*/
showDeleteMessage(message: string): void;
/**
* Get resource configuration for given type.
*
* @param type Current type to find
* @returns Object configuration for the current type
*/
getResourceConfig(type: string): any;
/**
* Redirects after saving a resource
* @param pid - string, pid of the record
* @param record - object, record to save
* @param recordType - string, Type of resource
* @param action - string, http action: create or update
* @param route - ActivatedRoute: the current route used
*/
redirectAfterSave(pid: string, record: any, recordType: string, action: string, route: ActivatedRoute): void;
/**
* Personalized message for delete a record
* @param pid - record pid string
* @param type - Type of resource
* @returns Observable array of string
*/
deleteMessage(pid: string, type: string): string[];
/**
* Check if a record can be added
* @param type Type of resource
* @returns Observable resolving an object containing the result of a permission check.
*/
canAddRecord$(type: string): Observable<ActionStatus>;
/**
* Check if a record can be updated
* @param record - object, record to check
* @param type Type of resource
* @returns Observable resolving an object containing the result of a permission check.
*/
canUpdateRecord$(record: object, type: string): Observable<ActionStatus>;
/**
* Check if a record can be deleted
* @param record - object, record to check
* @param type Type of resource
* @returns Observable resolving an object containing the result of a permission check.
*/
canDeleteRecord$(record: object, type: string): Observable<ActionStatus>;
/**
* Check if a record can be read
* @param record - object, record to check
* @param type Type of resource
* @returns Observable resolving an object containing the result of a permission check.
*/
canReadRecord$(record: object, type: string): Observable<ActionStatus>;
/**
* Check if a record can be used (mainly used for templates)
* @param record - object, record to check
* @param type Type of resource
* @returns Observable resolving an object containing the result of a permission check.
*/
canUseRecord$(record: object, type: string): Observable<ActionStatus>;
static ɵfac: i0.ɵɵFactoryDeclaration<RecordUiService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<RecordUiService>;
}