+
-
-
-
diff --git a/projects/ng-core-tester/src/app/app.component.ts b/projects/ng-core-tester/src/app/app.component.ts
index 35453b7f..057a7d42 100644
--- a/projects/ng-core-tester/src/app/app.component.ts
+++ b/projects/ng-core-tester/src/app/app.component.ts
@@ -14,11 +14,9 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see
.
*/
-import { Component, OnInit } from '@angular/core';
-import { CoreConfigService, MenuItem, RecordEvent, RecordService, TitleMetaService, TranslateService } from '@rero/ng-core';
-import { BsLocaleService } from 'ngx-bootstrap/datepicker';
-import { ToastrService } from 'ngx-toastr';
-import { AppMenuService } from './service/app-menu.service';
+import { Component, OnInit, inject } from '@angular/core';
+import { CoreConfigService, RecordEvent, RecordService, TitleMetaService, TranslateService } from '@rero/ng-core';
+import { MenuItem, MessageService } from 'primeng/api';
/**
* Main component of the application.
@@ -28,6 +26,14 @@ import { AppMenuService } from './service/app-menu.service';
templateUrl: './app.component.html'
})
export class AppComponent implements OnInit {
+
+ /** Service injection */
+ translateService = inject(TranslateService);
+ configService = inject(CoreConfigService);
+ titleMetaService = inject(TitleMetaService);
+ recordService = inject(RecordService);
+ messageService = inject(MessageService);
+
// Current lang of the application
lang: string = document.documentElement.lang;
@@ -42,28 +48,6 @@ export class AppComponent implements OnInit {
// Application language menu
languageMenu: MenuItem;
-
- /**
- * Constructor.
- * @param _translateService Translate service.
- * @param _configService Configuration service.
- * @param _titleMetaService Meta service.
- * @param _recordService Record service.
- * @param _toastrService Toast service.
- * @param _bsLocaleService Locale service for bootstrap.
- * @param _menuService Interface menu
- */
- constructor(
- private _translateService: TranslateService,
- private _configService: CoreConfigService,
- private _titleMetaService: TitleMetaService,
- private _recordService: RecordService,
- private _toastrService: ToastrService,
- private _bsLocaleService: BsLocaleService,
- private _appMenuService: AppMenuService
- ) {
- }
-
/**
* Component initialization.
*
@@ -73,52 +57,30 @@ export class AppComponent implements OnInit {
*/
ngOnInit() {
this.initializeEvents();
- this._translateService.setLanguage(this.lang);
- this.appMenu = this._appMenuService.generateApplicationMenu();
- this.languageMenu = this._appMenuService.generateLanguageMenu(
- this._configService.languages,
- this.lang
- );
+ this.translateService.setLanguage(this.lang);
// Set default title window when application start
- const prefix = this._configService.prefixWindow;
+ const prefix = this.configService.prefixWindow;
if (prefix) {
- this._titleMetaService.setPrefix(prefix);
+ this.titleMetaService.setPrefix(prefix);
}
- this._titleMetaService.setTitle('Welcome');
- }
-
- /**
- * Event change language
- * @param item - MenuItem
- */
- eventChangeLang(item: MenuItem) {
- this.languageMenu.getChildren().forEach((menu: MenuItem) => {
- if (menu.isActive()) {
- menu.deleteLabelAttribute('class');
- menu.setActive(false);
- }
- });
- item.setLabelAttribute('class', 'font-weight-bold')
- .setActive(true);
- this._translateService.setLanguage(item.getName());
- this._bsLocaleService.use(item.getName());
+ this.titleMetaService.setTitle('Welcome');
}
/**
* Initializes listening of events when a record is changed.
*/
private initializeEvents() {
- this._recordService.onCreate$.subscribe((recordEvent: RecordEvent) => {
- const pid = recordEvent.data.record.pid;
- this._toastrService.info(`Call Record Event on create (Record Pid: ${pid})`);
+ this.recordService.onCreate$.subscribe((recordEvent: RecordEvent) => {
+ const {pid} = recordEvent.data.record;
+ this.messageService.add({ severity: 'info', summary: 'Record', detail: `Call Record Event on create (Record Pid: ${pid})`});
});
- this._recordService.onUpdate$.subscribe((recordEvent: RecordEvent) => {
- const pid = recordEvent.data.record.pid;
- this._toastrService.info(`Call Record Event on update (Record Pid: ${pid})`);
+ this.recordService.onUpdate$.subscribe((recordEvent: RecordEvent) => {
+ const {pid} = recordEvent.data.record;
+ this.messageService.add({ severity: 'info', summary: 'Record', detail: `Call Record Event on update (Record Pid: ${pid})`});
});
- this._recordService.onDelete$.subscribe((recordEvent: RecordEvent) => {
- const pid = recordEvent.data.pid;
- this._toastrService.info(`Call Record Event on delete (Record Pid: ${pid})`);
+ this.recordService.onDelete$.subscribe((recordEvent: RecordEvent) => {
+ const {pid} = recordEvent.data.record;
+ this.messageService.add({ severity: 'info', summary: 'Record', detail: `Call Record Event on delete (Record Pid: ${pid})`});
});
}
}
diff --git a/projects/ng-core-tester/src/app/app.module.ts b/projects/ng-core-tester/src/app/app.module.ts
index 8338201f..0f117d10 100644
--- a/projects/ng-core-tester/src/app/app.module.ts
+++ b/projects/ng-core-tester/src/app/app.module.ts
@@ -20,21 +20,25 @@ import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateLoader as BaseTranslateLoader, TranslateModule } from '@ngx-translate/core';
-import { CoreConfigService, RecordModule, RecordService, TranslateLoader } from '@rero/ng-core';
+import { CoreConfigService, RecordModule, RecordService, RemoteAutocompleteService, TranslateLoader } from '@rero/ng-core';
import { defineLocale } from 'ngx-bootstrap/chronos';
import { CollapseModule } from 'ngx-bootstrap/collapse';
-import { BsLocaleService } from 'ngx-bootstrap/datepicker';
import { deLocale, enGbLocale, frLocale, itLocale } from 'ngx-bootstrap/locale';
import { TypeaheadModule } from 'ngx-bootstrap/typeahead';
+import { MenubarModule } from 'primeng/menubar';
import { AppConfigService } from './app-config.service';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
+import { AppDialogComponent } from './home/dialog/app-dialog.component';
import { HomeComponent } from './home/home.component';
+import { ToastComponent } from './home/toast/toast.component';
import { DetailComponent } from './record/document/detail/detail.component';
import { DocumentComponent } from './record/document/document.component';
import { EditorComponent } from './record/editor/editor.component';
-import { SearchBarComponent } from './search-bar/search-bar.component';
import { RecordServiceMock } from './record/editor/record-service-mock';
+import { SearchBarComponent } from './search-bar/search-bar.component';
+import { MenuComponent } from './menu/menu.component';
+import { AppRemoteAutocompleteService } from './service/app-remote-autocomplete.service';
@NgModule({
declarations: [
@@ -43,7 +47,10 @@ import { RecordServiceMock } from './record/editor/record-service-mock';
HomeComponent,
DetailComponent,
SearchBarComponent,
- EditorComponent
+ EditorComponent,
+ ToastComponent,
+ AppDialogComponent,
+ MenuComponent
],
imports: [
BrowserModule,
@@ -60,17 +67,21 @@ import { RecordServiceMock } from './record/editor/record-service-mock';
deps: [CoreConfigService, HttpClient]
}
}),
- RecordModule
+ RecordModule,
+ MenubarModule,
],
providers: [
{
- provide: CoreConfigService,
- useClass: AppConfigService
+ provide: CoreConfigService,
+ useClass: AppConfigService
+ },
+ {
+ provide: RecordService,
+ useClass: RecordServiceMock
},
- BsLocaleService,
{
- provide: RecordService,
- useClass: RecordServiceMock
+ provide: RemoteAutocompleteService,
+ useClass: AppRemoteAutocompleteService
}
],
bootstrap: [AppComponent]
diff --git a/projects/ng-core-tester/src/app/home/dialog/app-dialog.component.html b/projects/ng-core-tester/src/app/home/dialog/app-dialog.component.html
new file mode 100644
index 00000000..a40bb608
--- /dev/null
+++ b/projects/ng-core-tester/src/app/home/dialog/app-dialog.component.html
@@ -0,0 +1,17 @@
+
+
diff --git a/projects/ng-core-tester/src/app/home/dialog/app-dialog.component.ts b/projects/ng-core-tester/src/app/home/dialog/app-dialog.component.ts
new file mode 100644
index 00000000..b0b0cfe6
--- /dev/null
+++ b/projects/ng-core-tester/src/app/home/dialog/app-dialog.component.ts
@@ -0,0 +1,58 @@
+/*
+ * RERO angular core
+ * Copyright (C) 2024 RERO
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see
.
+ */
+import { Component, inject } from '@angular/core';
+import { TranslateService } from '@ngx-translate/core';
+import { ConfirmationService, MessageService } from 'primeng/api';
+
+@Component({
+ selector: 'app-dialog',
+ templateUrl: './app-dialog.component.html'
+})
+export class AppDialogComponent {
+ translate = inject(TranslateService);
+ confirmationService = inject(ConfirmationService);
+ messageService = inject(MessageService);
+
+ confirm(event: Event): void {
+ this.confirmationService.confirm({
+ target: event.target as EventTarget,
+ acceptLabel: this.translate.instant('Yes'),
+ rejectLabel: this.translate.instant('No'),
+ message: this.translate.instant('Are you sure that you want to proceed?'),
+ header: this.translate.instant('Confirmation'),
+ icon: 'pi pi-exclamation-triangle',
+ acceptIcon:"none",
+ rejectIcon:"none",
+ rejectButtonStyleClass:"p-button-text",
+ accept: () => {
+ this.messageService.add({
+ severity: 'info',
+ summary: this.translate.instant('Confirmed'),
+ detail: this.translate.instant('You have accepted')
+ });
+ },
+ reject: () => {
+ this.messageService.add({
+ severity: 'error',
+ summary: this.translate.instant('Rejected'),
+ detail: this.translate.instant('You have rejected'),
+ life: 3000
+ });
+ }
+ });
+ }
+}
diff --git a/projects/ng-core-tester/src/app/home/home.component.html b/projects/ng-core-tester/src/app/home/home.component.html
index 4c3fb7bb..341d9433 100644
--- a/projects/ng-core-tester/src/app/home/home.component.html
+++ b/projects/ng-core-tester/src/app/home/home.component.html
@@ -1,6 +1,6 @@
-
Search component
-
+
+
+
-
Alert component
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
Dialog component
-
-
-
Search input
-
-
-
API Data
-
{{ apiData | json }}
-
-
Language translation
-
Translate "fr" code in french: {{ testLanguageTranslation }}
-
-
Nl2br pipe
-
+
+
-
Translate Language pipe
-
Translate "fr" code in deutsch: {{ 'fr' | translateLanguage: 'de' }}
-
Translate "zzz" code in italian: {{ 'zzz' | translateLanguage: 'it' }} (code not available)
-
Translate "fr" code in not language loaded: {{ 'fr' | translateLanguage: 'pt' }} (return initial
+
+ Translate "fre" code in german: {{ 'fre' | translateLanguage: 'de' }}
+ Translate "zzz" code in italian: {{ 'zzz' | translateLanguage: 'it' }} (code not available)
+ Translate "fre" code in not language loaded: {{ 'fre' | translateLanguage: 'pt' }} (return initial
value)
+
-
Menu
-
-
-
Spinner
-
+
+
+
-
Markdown pipe
-
-
+
+
+
+
diff --git a/projects/ng-core-tester/src/app/home/home.component.ts b/projects/ng-core-tester/src/app/home/home.component.ts
index 297ea323..52a7911b 100644
--- a/projects/ng-core-tester/src/app/home/home.component.ts
+++ b/projects/ng-core-tester/src/app/home/home.component.ts
@@ -1,6 +1,6 @@
/*
* RERO angular core
- * Copyright (C) 2020 RERO
+ * Copyright (C) 2020-2024 RERO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -14,23 +14,16 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see
.
*/
-import { Component, OnInit } from '@angular/core';
-import { ApiService, DialogService, MenuItem, RecordSearchService, TranslateLanguageService } from '@rero/ng-core';
+import { Component } from '@angular/core';
+import { MenuItem, RecordSearchService } from '@rero/ng-core';
import { NgxSpinnerService } from 'ngx-spinner';
-import { ToastrService } from 'ngx-toastr';
import { DocumentComponent } from '../record/document/document.component';
-import { MenuService } from '../service/menu.service';
@Component({
selector: 'app-home',
templateUrl: './home.component.html'
})
-export class HomeComponent implements OnInit {
- // Object containing API paths.
- apiData: any;
-
- // Contains the full translated language of a language code.
- testLanguageTranslation: string;
+export class HomeComponent {
// Configuration for resources.
recordConfig: Array
= [
@@ -62,32 +55,9 @@ export class HomeComponent implements OnInit {
}
];
- // Menu
- menuApplication: MenuItem;
-
- // Menu click
- menuClick: MenuItem;
-
// Markdown text
markdownText = '*Hello* **world**';
- /**
- * Component initialization
- *
- * - Initializes application menu
- */
- ngOnInit() {
- this.menuApplication = this._menuService.generateApplicationMenu();
- }
-
- /**
- * Menu selected by user
- * @param item - Menu Item
- */
- eventMenuClick(item: MenuItem) {
- this._toastrService.success(`menu ${item.getName()} clicked`);
- }
-
/**
* Show spinner for 5 seconds
*/
@@ -96,116 +66,23 @@ export class HomeComponent implements OnInit {
setTimeout(() => {
this._spinner.hide();
- }, 5000);
+ }, 3000);
}
/**
* Constructor.
*
* - Initializes API object paths.
- * - Stores translated language.
* - Empties aggregations filters.
*
- * @param _dialogService Dialog service.
- * @param _apiService API service.
- * @param _translateLanguageService Translate language service.
- * @param _toastrService Toastr service.
* @param _recordSearchService Record search service.
* @param _spinner Spinner service
*/
constructor(
- private _dialogService: DialogService,
- private _apiService: ApiService,
- private _translateLanguageService: TranslateLanguageService,
- private _toastrService: ToastrService,
private _recordSearchService: RecordSearchService,
- private _spinner: NgxSpinnerService,
- private _menuService: MenuService
+ private _spinner: NgxSpinnerService
) {
- this.apiData = {
- relative: this._apiService.getEndpointByType('documents'),
- absolute: this._apiService.getEndpointByType('documents', true),
- };
-
- this.testLanguageTranslation = this._translateLanguageService.translate('fr', 'fr');
-
// Initializes aggregations filters to launch the first search.
this._recordSearchService.setAggregationsFilters([]);
}
-
- /**
- * Show a confirmation dialog box.
- */
- showDialog() {
- const config = {
- ignoreBackdropClick: true,
- initialState: {
- title: 'Confirmation',
- body: 'Exit without saving changes?',
- confirmButton: true,
- cancelTitleButton: 'Abort',
- confirmTitleButton: 'Confirm'
- }
- };
-
- this._dialogService.show(config).subscribe((confirm: boolean) => {
- if (confirm) {
- console.log('Confirmed !');
- }
- });
- }
-
- /**
- * Simulates a search by only log infos.
- *
- * @param searchText String to search.
- */
- doSearch(searchText: string) {
- console.log(`You search for: ${searchText}`);
- }
-
- /**
- * Shows an alert message with toastr.
- */
- addAlert() {
- const type = (document.getElementById('alert-type')) as HTMLSelectElement;
- const message = (document.getElementById('alert-message')) as HTMLInputElement;
- switch (type.value) {
- // Checkbox controls
- case 'success':
- this._toastrService.success(message.value);
- break;
- case 'info':
- this._toastrService.info(message.value);
- break;
- case 'warning':
- this._toastrService.warning(message.value);
- break;
- case 'danger':
- this._toastrService.error(message.value);
- break;
- }
- }
-
- /**
- * Show a message when item menu is clicked.
- *
- * @param item Menu item.
- */
- clickLinkItemMenu(item: any) {
- this._toastrService.success(`menu ${item.name} clicked`);
- }
-
- /**
- * Whether a menu item is visible or not.
- *
- * @param itemMenu Menu item.
- * @return True if the menu is visible.
- */
- isItemMenuVisible(itemMenu: any) {
- if (itemMenu.name === 'Hidden') {
- return false;
- }
- return true;
- }
}
diff --git a/projects/ng-core-tester/src/app/home/toast/toast.component.html b/projects/ng-core-tester/src/app/home/toast/toast.component.html
new file mode 100644
index 00000000..41196516
--- /dev/null
+++ b/projects/ng-core-tester/src/app/home/toast/toast.component.html
@@ -0,0 +1,32 @@
+
+
diff --git a/projects/ng-core-tester/src/app/home/toast/toast.component.ts b/projects/ng-core-tester/src/app/home/toast/toast.component.ts
new file mode 100644
index 00000000..e18be9c3
--- /dev/null
+++ b/projects/ng-core-tester/src/app/home/toast/toast.component.ts
@@ -0,0 +1,71 @@
+/*
+ * RERO angular core
+ * Copyright (C) 2024 RERO
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+import { Component, OnInit, inject } from '@angular/core';
+import { TranslateService } from '@ngx-translate/core';
+import { Message, MessageService } from 'primeng/api';
+
+interface IToastType {
+ name: string;
+ code: string;
+}
+
+@Component({
+ selector: 'app-toast',
+ templateUrl: './toast.component.html'
+})
+export class ToastComponent implements OnInit {
+
+ translateService = inject(TranslateService);
+ messageService = inject(MessageService);
+
+ toastTypes: IToastType[];
+
+ toastType: any;
+
+ toastMessage: string;
+
+ ngOnInit(): void {
+ this.toastMessage = this.translateService.instant('This is the message');
+ this.toastTypes = [
+ { name: this.translateService.instant('Success'), code: 'success' },
+ { name: this.translateService.instant('Info'), code: 'info' },
+ { name: this.translateService.instant('Warn'), code: 'warn' },
+ { name: this.translateService.instant('Error'), code: 'error' },
+ ];
+ this.translateService.onLangChange.subscribe(() => {
+ this.toastMessage = this.translateService.instant('This is the message');
+ this.toastTypes.forEach((type: any) => {
+ type.name = this.translateService.instant(type.code);
+ });
+ this.toastType = undefined;
+ });
+ }
+
+ showToast(): void {
+ const message: Message = {
+ severity: 'error',
+ summary: this.translateService.instant('Error'),
+ detail: this.translateService.instant('Please select a type')
+ };
+ if (this.toastType) {
+ message.severity = this.toastType.code;
+ message.summary = this.toastType.name;
+ message.detail = this.toastMessage;
+ }
+ this.messageService.add(message);
+ }
+}
diff --git a/projects/ng-core-tester/src/app/menu/menu.component.html b/projects/ng-core-tester/src/app/menu/menu.component.html
new file mode 100644
index 00000000..a981f82d
--- /dev/null
+++ b/projects/ng-core-tester/src/app/menu/menu.component.html
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+ @if (item.routerLink && !item.url) {
+
+ }
+ @if (item.url && !item.routerLink) {
+
+ }
+ @if (!item.url && !item.routerLink) {
+
+ }
+
+
+
diff --git a/projects/ng-core-tester/src/app/menu/menu.component.scss b/projects/ng-core-tester/src/app/menu/menu.component.scss
new file mode 100644
index 00000000..af9a8ea5
--- /dev/null
+++ b/projects/ng-core-tester/src/app/menu/menu.component.scss
@@ -0,0 +1,3 @@
+:host ::ng-deep .p-submenu-list {
+ z-index: 1000;
+}
diff --git a/projects/ng-core-tester/src/app/menu/menu.component.ts b/projects/ng-core-tester/src/app/menu/menu.component.ts
new file mode 100644
index 00000000..42fb2b8f
--- /dev/null
+++ b/projects/ng-core-tester/src/app/menu/menu.component.ts
@@ -0,0 +1,191 @@
+/*
+ * RERO angular core
+ * Copyright (C) 2024 RERO
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+import { Component, OnInit, inject } from '@angular/core';
+import { MenuItem, MessageService } from 'primeng/api';
+import { Router } from '@angular/router';
+import { CoreConfigService } from '@rero/ng-core';
+import { LangChangeEvent, TranslateService } from '@ngx-translate/core';
+
+@Component({
+ selector: 'app-menu',
+ templateUrl: './menu.component.html',
+ styleUrl: './menu.component.scss'
+})
+export class MenuComponent implements OnInit {
+
+ messageService = inject(MessageService);
+ translateService = inject(TranslateService);
+ router = inject(Router);
+ config = inject(CoreConfigService);
+
+ menuItems: MenuItem[];
+
+ ngOnInit(): void {
+ this.menuItems = [
+ {
+ label: this.translateService.instant('home'),
+ untranslatedLabel: 'home',
+ icon: 'pi pi-home',
+ command: () => {
+ this.router.navigate(['/']);
+ this.messageService.add({ severity: 'success', detail: 'Home menu selected', life: 2000 });
+ }
+ },
+ {
+ label: this.translateService.instant('Records'),
+ untranslatedLabel: 'Records',
+ id: 'records',
+ items: [
+ {
+ label: this.translateService.instant('Global records'),
+ untranslatedLabel: 'Global records',
+ icon: 'fa fa-book',
+ routerLink: ['/record', 'search', 'documents']
+ },
+ {
+ label: this.translateService.instant('UNISI records'),
+ untranslatedLabel: 'UNISI records',
+ icon: 'fa fa-book',
+ routerLink: ['/unisi', 'record', 'search', 'documents']
+ },
+ {
+ label: this.translateService.instant('Backend records'),
+ untranslatedLabel: 'Backend records',
+ icon: 'fa fa-book',
+ routerLink: ['/admin', 'record', 'search', 'documents']
+ },
+ {
+ label: this.translateService.instant('Documents'),
+ untranslatedLabel: 'Documents',
+ icon: 'fa fa-book',
+ items: [
+ {
+ label: this.translateService.instant('Document records'),
+ untranslatedLabel: 'Document records',
+ icon: 'fa fa-book',
+ routerLink: ['/records', 'documents']
+ },
+ {
+ label: this.translateService.instant('Document records with query params'),
+ untranslatedLabel: 'Document records with query params',
+ icon: 'fa fa-book',
+ routerLink: ['/records', 'documents'],
+ queryParams: { q: 'anatomic', page: 1, size: 10 }
+ }
+ ]
+ },
+ {
+ label: this.translateService.instant('Organisation'),
+ untranslatedLabel: 'Organisation',
+ icon: 'fa fa-industry',
+ routerLink: ['/records', 'organisations']
+ },
+ {
+ separator: true
+ },
+ {
+ label: this.translateService.instant('Editor'),
+ untranslatedLabel: 'Editor',
+ icon: 'fa fa-pencil-square-o',
+ items: [
+ {
+ label: this.translateService.instant('Long mode'),
+ items: [
+ {
+ label: this.translateService.instant('Add mode'),
+ untranslatedLabel: 'Add mode',
+ icon: 'fa fa-pencil-square-o',
+ routerLink: ['/editor', 'demo']
+ },
+ {
+ label: this.translateService.instant('Edit mode'),
+ untranslatedLabel: 'Edit mode',
+ icon: 'fa fa-pencil-square-o',
+ routerLink: ['/editor', 'demo', '1']
+ }
+ ]
+ },
+ {
+ label: this.translateService.instant('Simple mode'),
+ items: [
+ {
+ label: this.translateService.instant('Add mode'),
+ untranslatedLabel: 'Add mode',
+ icon: 'fa fa-pencil-square-o',
+ routerLink: ['/editor', 'normal']
+ },
+ {
+ label: this.translateService.instant('Edit mode'),
+ untranslatedLabel: 'Edit mode',
+ icon: 'fa fa-pencil-square-o',
+ routerLink: ['/editor', 'normal', '1']
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ label: 'Rero website',
+ id: 'rero_website',
+ icon: 'fa fa-external-link',
+ url: 'https://www.rero.ch',
+ target: '_blank'
+ },
+ {
+ label: this.translateService.instant('Language'),
+ untranslatedLabel: 'Language',
+ id: 'language',
+ icon: 'fa fa-language',
+ items: []
+ }
+ ];
+
+ const languageMenu = this.menuItems.find((item: MenuItem) => item.id === 'language');
+ this.config.languages.map((language: string) => {
+ const lang = {
+ label: this.translateService.instant(language),
+ untranslatedLabel: language,
+ id: language,
+ styleClass: undefined,
+ command: () => {
+ this.translateService.use(language);
+ this.messageService.add({ severity: 'info', detail: `Language change to ${language}`, life: 2000 });
+ }
+ }
+ languageMenu.items.push(lang);
+ });
+ this.translateService.onLangChange.subscribe((event: LangChangeEvent) => {
+ this.translateItems(this.menuItems)
+ languageMenu.items.map((item: MenuItem) => {
+ item.styleClass = item.id === event.lang ? 'font-bold': ''
+ });
+ });
+ }
+
+ private translateItems(menuItems: MenuItem[]): void {
+ menuItems.map((item: MenuItem) => {
+ if (item.untranslatedLabel) {
+ item.label = this.translateService.instant(item.untranslatedLabel);
+ }
+ if (item.items) {
+ this.translateItems(item.items);
+ }
+ })
+ }
+}
diff --git a/projects/ng-core-tester/src/app/record/document/document.component.html b/projects/ng-core-tester/src/app/record/document/document.component.html
index cabcfab4..76a18203 100644
--- a/projects/ng-core-tester/src/app/record/document/document.component.html
+++ b/projects/ng-core-tester/src/app/record/document/document.component.html
@@ -34,6 +34,6 @@
{{ author.name }}
}
-@if (record.metadata.abstracts) {
+
diff --git a/projects/ng-core-tester/src/app/record/editor/editor.component.ts b/projects/ng-core-tester/src/app/record/editor/editor.component.ts
index 119361b9..89b19a18 100644
--- a/projects/ng-core-tester/src/app/record/editor/editor.component.ts
+++ b/projects/ng-core-tester/src/app/record/editor/editor.component.ts
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-import { AfterContentChecked, Component, OnChanges, OnInit, SimpleChanges } from '@angular/core';
+import { AfterContentChecked, Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@Component({
diff --git a/projects/ng-core-tester/src/app/record/editor/record-service-mock.ts b/projects/ng-core-tester/src/app/record/editor/record-service-mock.ts
index 8a8f6f44..3e6d62a1 100644
--- a/projects/ng-core-tester/src/app/record/editor/record-service-mock.ts
+++ b/projects/ng-core-tester/src/app/record/editor/record-service-mock.ts
@@ -18,13 +18,19 @@ import { Error, RecordService } from "@rero/ng-core";
import { Observable, of } from "rxjs";
import data from './recordData.json';
import JSONSchema from './schema.json';
+import SimpleJSONSchema from './simple-schema.json';
+import simpleData from './simple-record-data.json';
+import { Injectable } from "@angular/core";
+@Injectable({
+ providedIn: 'root'
+})
export class RecordServiceMock extends RecordService {
getSchemaForm(recordType: string): Observable {
- return of({ schema: JSONSchema });
+ return of({ schema: recordType === 'demo' ? JSONSchema : SimpleJSONSchema });
}
getRecord(type: string, pid: string, resolve = 0, headers: any = {}): Observable {
- return of(data);
+ return of(type === 'demo' ? data : simpleData);
}
}
diff --git a/projects/ng-core-tester/src/app/record/editor/recordData.json b/projects/ng-core-tester/src/app/record/editor/recordData.json
index 27a673e0..0165fbba 100644
--- a/projects/ng-core-tester/src/app/record/editor/recordData.json
+++ b/projects/ng-core-tester/src/app/record/editor/recordData.json
@@ -16,6 +16,7 @@
"hidden_with_default": "Default hidden",
"readonly_changeable": "Value 1",
"hide_with_required_expression_control": "Optional",
+ "treeSelect": "node5",
"selectMultiple": ["value2", "value3"],
"markdown": "Hello **world**.\nGreat day.",
"array_with_multicheckbox": ["checkbox1", "checkbox2"],
@@ -26,7 +27,9 @@
"type": "staff_note",
"content": "test"
}
- ]
+ ],
+ "date_only": "2024-08-06",
+ "date_range": ["2024-08-06", "2024-08-20"]
},
"updated": "2024-03-06T07:47:33.944197+00:00"
}
diff --git a/projects/ng-core-tester/src/app/record/editor/schema.json b/projects/ng-core-tester/src/app/record/editor/schema.json
index 51885b01..8800af78 100644
--- a/projects/ng-core-tester/src/app/record/editor/schema.json
+++ b/projects/ng-core-tester/src/app/record/editor/schema.json
@@ -29,7 +29,7 @@
"hide_with_required_expression",
"hidden_sub_property_hide_expr",
"array_of_objects_with_sub_objects",
- "select",
+ "treeSelect",
"selectGroup",
"selectMultiple",
"selectMultipleWithLabelTranslation",
@@ -38,10 +38,11 @@
"email",
"date_time",
"date_only",
+ "date_range",
"password",
"array_with_multicheckbox",
- "remoteTypeaheadWithoutFilters",
- "remoteTypeaheadWithFilters",
+ "remoteAutoCompleteWithFilters",
+ "remoteAutocompleteWithoutFilters",
"input_with_default_value",
"name_with_definition",
"field_expressions",
@@ -702,14 +703,7 @@
"enum": [
"optional",
"required"
- ],
- "widget": {
- "formlyConfig": {
- "props": {
- "cssClass": "w-md-25"
- }
- }
- }
+ ]
},
"hide_with_required_expression": {
"title": "Hidden Property with required expression.",
@@ -804,7 +798,7 @@
]
}
},
- "select": {
+ "treeSelect": {
"title": "Select with option tree",
"type": "string",
"enum": [
@@ -814,50 +808,48 @@
],
"widget": {
"formlyConfig": {
+ "type": "tree-select",
"props": {
"options": [
{
- "label": "3 Value",
- "value": "value3"
+ "label": "Node 1",
+ "data": "node1"
},
{
- "label": "Group",
+ "label": "Node 2",
+ "selectable": false,
"children": [
{
- "label": "2 Value",
- "value": "value2"
+ "label": "Node 3",
+ "data": "node3"
},
{
- "label": "1 Value",
- "value": "value1",
+ "label": "Node 4",
+ "selectable": false,
"children": [
{
- "label": "3 Value",
- "value": "value3",
- "preferred": true
+ "label": "Node 5",
+ "data": "node5"
},
{
- "label": "2 Value",
- "value": "value2",
- "disabled": true
+ "label": "Node 6",
+ "data": "node6"
}
]
}
]
},
{
- "label": "2 Value",
- "value": "value2",
- "preferred": true
+ "label": "Node 7",
+ "data": "node7"
}
- ],
- "minItemsToDisplaySearch": 3
+ ]
}
}
}
},
"selectGroup": {
- "title": "Select group (compatibility)",
+ "title": "Select with group",
"type": "string",
"enum": [
"value1",
@@ -867,20 +859,29 @@
"widget": {
"formlyConfig": {
"props": {
+ "group": true,
"options": [
{
- "label": "3 Value",
- "value": "value3",
- "group": "test"
- },
- {
- "label": "1 Value",
- "value": "value1"
+ "label": "Default",
+ "items": [
+ {
+ "label": "Value 1",
+ "value": "value1"
+ }
+ ]
},
{
- "label": "2 Value",
- "value": "value2",
- "group": "test"
+ "label": "Test",
+ "items": [
+ {
+ "label": "Value 3",
+ "value": "value3"
+ },
+ {
+ "label": "Value 2",
+ "value": "value2"
+ }
+ ]
}
]
}
@@ -888,7 +889,7 @@
}
},
"selectMultiple": {
- "title": "Multiple select",
+ "title": "Select Multiple",
"type": "array",
"minItems": 1,
"uniqueItems": true,
@@ -906,6 +907,7 @@
},
"widget": {
"formlyConfig": {
+ "type": "multi-select",
"props": {
"options": [
{
@@ -941,6 +943,7 @@
},
"widget": {
"formlyConfig": {
+ "type": "multi-select",
"props": {
"options": [
{
@@ -971,7 +974,10 @@
"default": "Hello **world**",
"widget": {
"formlyConfig": {
- "type": "markdown"
+ "type": "markdown",
+ "props": {
+ "minHeight": "300px"
+ }
}
}
},
@@ -1032,14 +1038,32 @@
"pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$",
"widget": {
"formlyConfig": {
- "type": "datepicker",
+ "type": "datePicker",
"props": {
"placement": "top",
"validation": {
"messages": {
"patternMessage": "Should be in the following format: 2022-12-31 (YYYY-MM-DD)."
}
- }
+ },
+ "disabledDates": [
+ "2024-08-10",
+ "2024-08-12"
+ ]
+ }
+ }
+ }
+ },
+ "date_range": {
+ "title": "Date picker range",
+ "type": "string",
+ "widget": {
+ "formlyConfig": {
+ "type": "datePicker",
+ "props": {
+ "selectionMode": "range",
+ "numberOfMonths": 2,
+ "showButtonBar": true
}
}
}
@@ -1062,8 +1086,8 @@
"type": "multicheckbox",
"minItems": 1,
"default": [
- "checkbox1",
- "checkbox2"
+ "checkbox2",
+ "checkbox3"
],
"items": {
"type": "string",
@@ -1076,8 +1100,9 @@
},
"widget": {
"formlyConfig": {
+ "type": "multi-checkbox",
"props": {
- "type": "array",
+ "style": "inline",
"options": [
{
"label": "Checkbox 1",
@@ -1101,46 +1126,53 @@
}
}
},
- "remoteTypeaheadWithFilters": {
- "title": "Remote typeahead with filters",
+ "remoteAutoCompleteWithFilters": {
+ "title": "Remote Autocomplete with filters",
"type": "string",
"widget": {
"formlyConfig": {
- "type": "remoteTypeahead",
+ "type": "remoteAutoComplete",
"props": {
- "remoteTypeahead": {
- "enableGroupField": true,
- "filters": {
- "default": "value2",
- "options": [
- {
- "label": "Value 1",
- "value": "value1"
- },
- {
- "label": "Value 2",
- "value": "value2"
- },
- {
- "label": "Value 3",
- "value": "value3"
- }
- ]
- }
+ "group": true,
+ "scrollHeight": "300px",
+ "queryOptions": {
+ "type": "documents",
+ "maxOfResult": 10
+ },
+ "filters": {
+ "selected": "value2",
+ "options": [
+ {
+ "label": "Value 1",
+ "value": "value1"
+ },
+ {
+ "label": "Value 2",
+ "value": "value2"
+ },
+ {
+ "label": "Value 3",
+ "value": "value3"
+ }
+ ]
}
}
}
}
},
- "remoteTypeaheadWithoutFilters": {
+
+ "remoteAutocompleteWithoutFilters": {
"title": "Remote typeahead without filters",
"type": "string",
"widget": {
"formlyConfig": {
- "type": "remoteTypeahead",
+ "type": "remoteAutoComplete",
"props": {
- "remoteTypeahead": {
- "enableGroupField": true
+ "group": true,
+ "scrollHeight": "300px",
+ "queryOptions": {
+ "type": "documents",
+ "maxOfResult": 10
}
}
}
diff --git a/projects/ng-core-tester/src/app/record/editor/simple-record-data.json b/projects/ng-core-tester/src/app/record/editor/simple-record-data.json
new file mode 100644
index 00000000..85d2a274
--- /dev/null
+++ b/projects/ng-core-tester/src/app/record/editor/simple-record-data.json
@@ -0,0 +1,13 @@
+{
+ "created": "2024-03-06T07:47:33.944191+00:00",
+ "id": "1",
+ "links": {
+ "self": "https://ilsdev.test.rero.ch/api/demo/1"
+ },
+ "metadata": {
+ "$schema": "https://bib.rero.ch/schemas/demo/demo.json",
+ "pid": "normal",
+ "required": "value required",
+ "textarea": "Le Lorem Ipsum est simplement du faux texte employé dans la composition et la mise en page avant impression. Le Lorem Ipsum est le faux texte standard de l'imprimerie depuis les années 1500, quand un imprimeur anonyme assembla ensemble des morceaux de texte pour réaliser un livre spécimen de polices de texte. Il n'a pas fait que survivre cinq siècles, mais s'est aussi adapté à la bureautique informatique, sans que son contenu n'en soit modifié. Il a été popularisé dans les années 1960 grâce à la vente de feuilles Letraset contenant des passages du Lorem Ipsum, et, plus récemment, par son inclusion dans des applications de mise en page de texte, comme Aldus PageMaker."
+ }
+}
diff --git a/projects/ng-core-tester/src/app/record/editor/simple-schema.json b/projects/ng-core-tester/src/app/record/editor/simple-schema.json
new file mode 100644
index 00000000..ced22e33
--- /dev/null
+++ b/projects/ng-core-tester/src/app/record/editor/simple-schema.json
@@ -0,0 +1,77 @@
+{
+ "schema": "http://json-schema.org/draft-07/schema#",
+ "type": "object",
+ "title": "Test editor",
+ "additionalProperties": false,
+ "required": [
+ "required"
+ ],
+ "propertiesOrder": [
+ "optional",
+ "required",
+ "essential",
+ "textarea"
+ ],
+ "properties": {
+ "$schema": {
+ "title": "Schema",
+ "type": "string",
+ "minLength": 9,
+ "default": "https://bib.rero.ch/schemas/demo/demo.json"
+ },
+ "pid": {
+ "title": "Demo ID",
+ "type": "string",
+ "minLength": 1
+ },
+ "optional": {
+ "title": "Optional",
+ "type": "string",
+ "minLength": 3
+ },
+ "required": {
+ "title": "Required",
+ "type": "string",
+ "minLength": 3,
+ "widget": {
+ "formlyConfig": {
+ "props": {
+ "doNotSubmitOnEnter": true
+ }
+ }
+ }
+ },
+ "essential": {
+ "title": "Essential",
+ "type": "string",
+ "minLength": 3,
+ "widget": {
+ "formlyConfig": {
+ "props": {
+ "hide": true,
+ "navigation": {
+ "essential": true
+ }
+ }
+ }
+ }
+ },
+ "textarea": {
+ "title": "Textarea",
+ "type": "string",
+ "widget": {
+ "formlyConfig": {
+ "type": "textarea",
+ "props": {
+ "placeholder": "Type your text here",
+ "displayChars": true,
+ "displayWords": true,
+ "limitChars": 200,
+ "limitWords": 10,
+ "rows": 5
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/projects/ng-core-tester/src/app/routes/documents-route.ts b/projects/ng-core-tester/src/app/routes/documents-route.ts
index 8d4b61a6..748ee34f 100644
--- a/projects/ng-core-tester/src/app/routes/documents-route.ts
+++ b/projects/ng-core-tester/src/app/routes/documents-route.ts
@@ -127,12 +127,12 @@ export class DocumentsRoute implements RouteInterface {
message: ''
});
},
- deleteMessage: (pid: string): Observable => {
+ deleteMessage: (): string[] => {
// If you want to translate the strings, you have to do it here
- return of([
+ return [
this.translateService.instant('Document: Do you really want to delete this record?'),
this.translateService.instant('Attached items will also be deleted.')
- ]);
+ ];
}
}
]
diff --git a/projects/ng-core-tester/src/app/service/app-menu.service.spec.ts b/projects/ng-core-tester/src/app/service/app-menu.service.spec.ts
deleted file mode 100644
index ff5441ee..00000000
--- a/projects/ng-core-tester/src/app/service/app-menu.service.spec.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * RERO angular core
- * Copyright (C) 2020 RERO
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/* tslint:disable:no-unused-variable */
-
-import { inject, TestBed } from '@angular/core/testing';
-import { TranslateModule } from '@ngx-translate/core';
-import { AppMenuService } from './app-menu.service';
-
-describe('Service: AppMenu', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- providers: [AppMenuService],
- imports: [TranslateModule.forRoot()]
- });
- });
-
- it('should ...', inject([AppMenuService], (service: AppMenuService) => {
- expect(service).toBeTruthy();
- }));
-});
diff --git a/projects/ng-core-tester/src/app/service/app-menu.service.ts b/projects/ng-core-tester/src/app/service/app-menu.service.ts
deleted file mode 100644
index 461ec437..00000000
--- a/projects/ng-core-tester/src/app/service/app-menu.service.ts
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * RERO angular core
- * Copyright (C) 2020 RERO
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-import { Injectable } from '@angular/core';
-import { TranslateService } from '@ngx-translate/core';
-import { MenuFactory, MenuItem } from '@rero/ng-core';
-
-@Injectable({
- providedIn: 'root'
-})
-export class AppMenuService {
-
- /** Menu Factory */
- private _factory: MenuFactory;
-
- /**
- * Constructor
- * @param _translate - TranslateService
- */
- constructor(private _translate: TranslateService) {
- this._factory = new MenuFactory();
- }
-
- /**
- * Application Menu
- * @return MenuItem
- */
- generateApplicationMenu() {
- const menu = this._factory.createItem('Application');
-
- /* Home */
- menu
- .addChild('Home')
- .setAttribute('id', 'home')
- .setExtra('iconClass', 'fa fa-home')
- .setRouterLink(['/']);
-
- const records = menu.addChild('Records');
- this._recordsMenu(records);
-
- return menu;
- }
-
- /**
- * Menu Languages
- * @return MenuItem
- */
- generateLanguageMenu(languages: string[], currentLanguage: string) {
- const languagesMenu = this._factory.createItem('Language');
- languages.forEach(lang => {
- const languageMenu = languagesMenu
- .addChild(this._translate.instant(lang));
- if (lang === currentLanguage) {
- languageMenu
- .setLabelAttribute('class', 'font-weight-bold')
- .setActive(true);
- }
- });
-
- return languagesMenu;
- }
-
- /**
- * Sub Menu Records
- * @param menu - MenuItem
- */
- private _recordsMenu(menu: MenuItem) {
- menu.addChild('Global records')
- .setAttribute('id', 'app-global-records')
- .setExtra('iconClass', 'fa fa-book')
- .setRouterLink(['/record', 'search', 'documents']);
- menu.addChild('UNISI records')
- .setRouterLink(['/unisi', 'record', 'search', 'documents']);
- menu.addChild('Backend records')
- .setRouterLink(['/admin', 'record', 'search', 'documents']);
- menu.addChild('Document records')
- .setRouterLink(['/records', 'documents']);
- menu.addChild('Organisation records')
- .setRouterLink(['/records', 'organisations']);
- menu.addChild('Editor')
- .setRouterLink(['/editor', 'demo'])
- .setExtra('iconClass', 'fa fa-edit');
- menu.addChild('Editor mode edit')
- .setRouterLink(['/editor', 'demo', '1'])
- .setExtra('iconClass', 'fa fa-edit');
- }
-}
diff --git a/projects/ng-core-tester/src/app/service/app-remote-autocomplete.service.spec.ts b/projects/ng-core-tester/src/app/service/app-remote-autocomplete.service.spec.ts
new file mode 100644
index 00000000..ba77dfb2
--- /dev/null
+++ b/projects/ng-core-tester/src/app/service/app-remote-autocomplete.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { AppRemoteAutocompleteService } from './app-remote-autocomplete.service';
+
+describe('AppRemoteAutocompleteService', () => {
+ let service: AppRemoteAutocompleteService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(AppRemoteAutocompleteService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/projects/ng-core-tester/src/app/service/app-remote-autocomplete.service.ts b/projects/ng-core-tester/src/app/service/app-remote-autocomplete.service.ts
new file mode 100644
index 00000000..2fd17dbd
--- /dev/null
+++ b/projects/ng-core-tester/src/app/service/app-remote-autocomplete.service.ts
@@ -0,0 +1,68 @@
+/*
+ * RERO angular core
+ * Copyright (C) 2024 RERO
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+import { Injectable } from "@angular/core";
+import { IQueryOptions, IRemoteAutocomplete, ISuggestionItem } from "@rero/prime/remote-autocomplete";
+import { Observable, of } from "rxjs";
+
+@Injectable({
+ providedIn: 'root'
+})
+export class AppRemoteAutocompleteService implements IRemoteAutocomplete {
+
+ private data: ISuggestionItem[] = [
+ { label: 'House', value: 'house' , summary: 'House description' },
+ { label: 'Mystery', value: 'mystery' },
+ ];
+
+ public getSuggestions(query: string, queryOptions: IQueryOptions = {}, currentPid: string): Observable {
+ if (!query) {
+ return of([]);
+ }
+ if (query.startsWith('*')) {
+ return of(this.processName(queryOptions.filter));
+ }
+
+ return of(this.processName(queryOptions.filter).filter((element: ISuggestionItem) =>
+ element.label.toLowerCase().includes(query.toLowerCase())
+ ));
+ }
+
+ getValueAsHTML(queryOptions: IQueryOptions, item: ISuggestionItem): Observable {
+ if (!item) {
+ return of(undefined);
+ }
+
+ let value = item.label;
+ if (item.summary) {
+ value += '
' + item.summary + '';
+ }
+
+ return of(value);
+ }
+
+ private processName(filter?: string): ISuggestionItem[] {
+ if (filter) {
+ return structuredClone(this.data).map((element: ISuggestionItem) => {
+ element.label = `${filter} - ${element.label}`;
+
+ return element;
+ });
+ } else {
+ return this.data;
+ }
+ }
+}
diff --git a/projects/ng-core-tester/src/app/service/menu.service.ts b/projects/ng-core-tester/src/app/service/menu.service.ts
deleted file mode 100644
index b20c9435..00000000
--- a/projects/ng-core-tester/src/app/service/menu.service.ts
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * RERO angular core
- * Copyright (C) 2020 RERO
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-import { Injectable } from '@angular/core';
-import { MenuFactory, MenuItem } from '@rero/ng-core';
-
-@Injectable({
- providedIn: 'root'
-})
-export class MenuService {
-
- /**
- * Menu Application
- * @return MenuItem
- */
- generateApplicationMenu() {
- const factory = new MenuFactory();
- const menu = factory.createItem('Demo');
- /**
- * Definition with short syntax
- */
- menu.addChild(
- 'Home',
- {
- attributes: { id: 'home' },
- labelAttributes: { hideLabel: true },
- extras: { iconClass: 'fa fa-home'}, routerlink: ['/'],
- }
- );
- /**
- * Same menu with fluid syntax
- * menu.addChild('Home')
- * .setAttribute('id', 'home')
- * .setExtra('iconClass', 'fa fa-home')
- * .setRouterLink(['/']);
- */
- menu.addChild('No link')
- .disable();
-
-
- this._recordsMenu(menu);
-
- /**
- * Menu with multiples attributes definition
- */
- menu.addChild('Sonar')
- .setUri('http://sonar.ch')
- .setAttributes({ id: 'sonar-link', target: '_blank' })
- .setExtra('iconClass', 'fa fa-external-link')
- .setActive(true);
-
- this._externalLinks(menu);
-
- return menu;
- }
-
- /**
- * Generate records menu
- * @param menu - MenuItem
- */
- private _recordsMenu(menu: MenuItem) {
- const records = menu.addChild('Records')
- .setAttribute('class', 'dropdown-menu-right');
- records.addChild('Global records')
- .setAttribute('id', 'global-records')
- .setExtra('iconClass', 'fa fa-book')
- .setRouterLink(['/record', 'search', 'documents']);
- records.addChild('UNISI records')
- .setRouterLink(['/unisi', 'record', 'search', 'documents'])
- .disable();
- records.addChild('Backend records')
- .setPrefix('[admin]', 'mr-2')
- .setSuffix('[search]', 'ml-2 text-warning')
- .setRouterLink(['/admin', 'record', 'search', 'documents'])
- .setExtra('divider', 'dropdown-divider');
- records.addChild('Document records')
- .setRouterLink(['/records', 'documents']);
- records.addChild('Document records')
- .setSuffix('[with query params]', 'ml-2 font-weight-bold')
- .setRouterLink(['/records', 'documents'])
- .setQueryParams({
- q: 'anatomic',
- page: 1,
- size: 10
- })
- .setExtra('divider', 'dropdown-divider');
- records.addChild('Organisation records')
- .setRouterLink(['/records', 'organisations']);
- }
-
- /**
- * Generate external menu links
- * @param menu - MenuItem
- */
- private _externalLinks(menu: MenuItem) {
- const external = menu.addChild('External links');
- external.addChild('RERO')
- .setUri('https://www.rero.ch')
- .setAttributes({ id: 'rero-link', target: '_blank' });
- }
-}
diff --git a/projects/ng-core-tester/src/assets/angular.svg b/projects/ng-core-tester/src/assets/angular.svg
new file mode 100644
index 00000000..79e613f0
--- /dev/null
+++ b/projects/ng-core-tester/src/assets/angular.svg
@@ -0,0 +1,33 @@
+
+
\ No newline at end of file
diff --git a/projects/ng-core-tester/src/assets/i18n/de.json b/projects/ng-core-tester/src/assets/i18n/de.json
index 71a7eb99..f434e3c0 100644
--- a/projects/ng-core-tester/src/assets/i18n/de.json
+++ b/projects/ng-core-tester/src/assets/i18n/de.json
@@ -5,5 +5,24 @@
"library": "Bibliothek",
"German": "Deutsch",
"from": "Von",
- "day(s)": "Tag(e)"
+ "day(s)": "Tag(e)",
+ "Language": "Sprache",
+ "Yes": "Ja",
+ "No": "Nein",
+ "Are you sure that you want to proceed?": "Sind Sie sicher, dass Sie fortfahren wollen?",
+ "Confirmation": "Konfirmation",
+ "Confirmed": "Bestätigt",
+ "You have accepted": "Sie haben akzeptiert",
+ "Rejected": "Abgelehnt",
+ "You have rejected": "Sie haben abgelehnt",
+ "info": "Info",
+ "success": "Erfolg",
+ "error": "Fehler",
+ "warn": "warnen",
+ "This is the message": "Dies ist die Nachricht",
+ "Select a toast type": "Wählen Sie eine Toastart",
+ "Records": "Aufzeichnungen",
+ "Editor": "Herausgeber",
+ "Add mode": "hinzufügenmodus",
+ "Please select a type": "Bitte wählen Sie einen Typ"
}
diff --git a/projects/ng-core-tester/src/assets/i18n/en.json b/projects/ng-core-tester/src/assets/i18n/en.json
index 90273088..c16bb627 100644
--- a/projects/ng-core-tester/src/assets/i18n/en.json
+++ b/projects/ng-core-tester/src/assets/i18n/en.json
@@ -2,5 +2,9 @@
"location": "Location",
"created year": "Creation year",
"library": "Library",
- "German": "German"
+ "German": "German",
+ "info": "Info",
+ "success": "Success",
+ "error": "Error",
+ "warn": "Warn"
}
diff --git a/projects/ng-core-tester/src/assets/i18n/fr.json b/projects/ng-core-tester/src/assets/i18n/fr.json
index 71c13e45..ab57adf1 100644
--- a/projects/ng-core-tester/src/assets/i18n/fr.json
+++ b/projects/ng-core-tester/src/assets/i18n/fr.json
@@ -21,5 +21,24 @@
"Hidden field with a default value.": "Champ caché avec une valeur par défaut.",
"Hidden field with a default value must not be added to the form.": "Les champs cachés avec une valeur par défaut ne doivent pas être ajoutés au formulaire.",
"Readonly values must not be changeable.": "Les valeurs en lecture seule ne doivent pas être modifiables.",
- "Hidden Property with required expression control": "Propriété cachée avec contrôle de l'expression requise."
+ "Hidden Property with required expression control": "Propriété cachée avec contrôle de l'expression requise.",
+ "Language": "Langue",
+ "Yes": "oui",
+ "No": "Non",
+ "Are you sure that you want to proceed?": "Êtes-vous sûr de vouloir continuer?",
+ "Confirmation": "Confirmation",
+ "Confirmed": "Confirmé",
+ "You have accepted": "Vous avez accepté",
+ "Rejected": "Rejeté",
+ "You have rejected": "Vous avez rejeté",
+ "info": "Information",
+ "success": "Succès",
+ "error": "Erreur",
+ "warn": "Avertir",
+ "This is the message": "Ceci est un message",
+ "Select a toast type": "Sélectionner un type de toast",
+ "Records": "Enregistrements",
+ "Editor": "Editeur",
+ "Add mode": "Mode ajout",
+ "Please select a type": "Veuillez sélectionner un type"
}
diff --git a/projects/ng-core-tester/src/assets/i18n/it.json b/projects/ng-core-tester/src/assets/i18n/it.json
index a0b843c9..1bfdcdb4 100644
--- a/projects/ng-core-tester/src/assets/i18n/it.json
+++ b/projects/ng-core-tester/src/assets/i18n/it.json
@@ -5,5 +5,24 @@
"library": "Biblioteca",
"German": "Tedesco",
"from": "Da",
- "day(s)": "giorni"
+ "day(s)": "giorni",
+ "Language": "Lingua",
+ "Yes": "Sì",
+ "No": "No",
+ "Are you sure that you want to proceed?": "È sicuro di voler procedere?",
+ "Confirmation": "Conferma",
+ "Confirmed": "Confermato",
+ "You have accepted": "Avete accettato",
+ "Rejected": "Rifiutato",
+ "You have rejected": "Avete rifiutato",
+ "info": "Info",
+ "success": "Successo",
+ "error": "Errore",
+ "warn": "Avvertire",
+ "This is the message": "Questo è il messaggio",
+ "Select a toast type": "Selezionare un tipo di toast",
+ "Records": "Registrazioni",
+ "Editor": "Editore",
+ "Add mode": "Aggiungi modalità",
+ "Please select a type": "Selezionare un tipo"
}
diff --git a/projects/ng-core-tester/src/styles.scss b/projects/ng-core-tester/src/styles.scss
index 29602a60..e404ce20 100644
--- a/projects/ng-core-tester/src/styles.scss
+++ b/projects/ng-core-tester/src/styles.scss
@@ -1,6 +1,6 @@
/*
* RERO angular core
- * Copyright (C) 2020 RERO
+ * Copyright (C) 2020-2024 RERO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -16,42 +16,59 @@
*/
$fa-font-path: "~font-awesome/fonts";
-@import "bootstrap/scss/bootstrap.scss";
+// @import "bootstrap/scss/bootstrap.scss";
@import "font-awesome/scss/font-awesome.scss";
-@import "ngx-toastr/toastr-bs4-alert";
+// @import "ngx-toastr/toastr-bs4-alert";
-// Styles for markdown editor
+@import "../../rero/ng-core/assets/scss/ng-core.scss";
+@import "node_modules/primeng/resources/themes/lara-light-blue/theme.css";
+@import "node_modules/primeng/resources/primeng.min.css";
+@import "node_modules/primeflex/primeflex.min.css";
+@import "node_modules/primeicons/primeicons.css";
@import "easymde/dist/easymde.min";
-.CodeMirror, .CodeMirror-scroll {
- min-height: 120px;
-}
-ng-core-formly-field-primeng-input > input,
-formly-field > input {
- width: 100%;
+.p-menubar {
+ background-color: white;
+ border: none;
+ margin-bottom: 0;
}
-input {
- padding: 0.5em;
+.container {
+ padding: 1.5rem;
+ border: 1px solid #e5e7eb;
+ border-radius: 6px;
}
-input[type="number"] {
- padding: 0.1em;
-}
+// .CodeMirror, .CodeMirror-scroll {
+// min-height: 120px;
+// }
+// ng-core-formly-field-primeng-input > input,
+// formly-field > input {
+// width: 100%;
+// }
-// ADJUST BOOTSTRAP / PRIMENG -------------------
-.col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
- padding-top: 0;
- padding-bottom: 0;
-}
+// input {
+// padding: 0.5em;
+// }
-dt, dl, dd {
- margin-bottom: 0;
- padding-bottom: 0;
-}
+// input[type="number"] {
+// padding: 0.1em;
+// }
-div.object .row {
- margin-left: 4px !important;
- margin-top: 0.4rem;
-}
+
+// // ADJUST BOOTSTRAP / PRIMENG -------------------
+// .col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
+// padding-top: 0;
+// padding-bottom: 0;
+// }
+
+// dt, dl, dd {
+// margin-bottom: 0;
+// padding-bottom: 0;
+// }
+
+// div.object .row {
+// margin-left: 4px !important;
+// margin-top: 0.4rem;
+// }
diff --git a/projects/rero/ng-core/src/lib/record/search/result/record-search-result.directive.ts b/projects/rero/ng-core/assets/scss/_border.scss
similarity index 54%
rename from projects/rero/ng-core/src/lib/record/search/result/record-search-result.directive.ts
rename to projects/rero/ng-core/assets/scss/_border.scss
index 2aae72d1..8adb9681 100644
--- a/projects/rero/ng-core/src/lib/record/search/result/record-search-result.directive.ts
+++ b/projects/rero/ng-core/assets/scss/_border.scss
@@ -1,6 +1,7 @@
+
/*
* RERO angular core
- * Copyright (C) 2020 RERO
+ * Copyright (C) 2024 RERO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -14,26 +15,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-import { Directive, ViewContainerRef } from '@angular/core';
-
-/**
- * Directive for displaying record search result.
- */
-@Directive({
- selector: '[ngCoreRecordSearchResult]',
-})
-export class RecordSearchResultDirective {
- /**
- * Constructor.
- *
- * @param _viewContainerRef View container reference.
- */
- constructor(private _viewContainerRef: ViewContainerRef) { }
-
- /**
- * Returns view container reference.
- */
- get viewContainerRef(): ViewContainerRef {
- return this._viewContainerRef;
- }
-}
+.border { border: $border-width solid $border-color !important; }
+.border-top { border-top: $border-width solid $border-color !important; }
+.border-right { border-right: $border-width solid $border-color !important; }
+.border-bottom { border-bottom: $border-width solid $border-color !important; }
+.border-left { border-left: $border-width solid $border-color !important; }
diff --git a/projects/rero/ng-core/assets/scss/_style.scss b/projects/rero/ng-core/assets/scss/_style.scss
new file mode 100644
index 00000000..a7f8cfb7
--- /dev/null
+++ b/projects/rero/ng-core/assets/scss/_style.scss
@@ -0,0 +1,98 @@
+/*
+ * RERO angular core
+ * Copyright (C) 2024 RERO
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+ @layer reset, ng-core, primeng;
+
+ @layer ng-core {
+ html, body {
+ line-height: normal;
+ font-size: 14px;
+ }
+
+ .header {
+ margin-top: 0.5em;
+ }
+
+ .invalid-feedback {
+ color: red;
+ }
+
+ formly-field {
+ .p-button {
+ padding: 0px;
+ }
+ .p-button.p-button-icon-only {
+ width: 1.5rem;
+ }
+ }
+
+ ng-core-card-wrapper {
+ p-card > .p-card > .p-card-header {
+ padding-top: 1rem;
+ margin-left: 1rem;
+ font-size: 1.2rem;
+ }
+
+ .p-card {
+ .p-card-body {
+ padding: 1.25rem 1rem;
+ }
+ .p-card-content {
+ padding: 0.25rem 0;
+ }
+ }
+ }
+
+ ng-core-editor-add-field-editor {
+ .p-button-label {
+ font-weight: 500;
+ }
+ }
+
+ ng-core-editor-formly-object-type {
+ margin-top: 1.5rem
+ }
+
+ ng-core-editor-formly-field-textarea,
+ ng-core-formly-field-primeng-input,
+ ng-core-tree-select,
+ ng-core-multi-select,
+ ng-core-primeng-select,
+ ng-core-date-picker {
+ width: 100%;
+ }
+
+ .list-result {
+ padding: 0;
+ margin: 0 10px;
+ }
+
+ .list-unstyled {
+ padding-left: 0;
+ list-style: none;
+ }
+
+ .add-field-info {
+ margin-top: .5rem;
+ }
+ }
+
+ @layer reset {
+ a {
+ text-decoration: none;
+ }
+ }
diff --git a/projects/rero/ng-core/assets/scss/_typography.scss b/projects/rero/ng-core/assets/scss/_typography.scss
new file mode 100644
index 00000000..79bcfd53
--- /dev/null
+++ b/projects/rero/ng-core/assets/scss/_typography.scss
@@ -0,0 +1,73 @@
+/*
+ * RERO angular core
+ * Copyright (C) 2024 RERO
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+h1, h2, h3, h4, h5, h6 {
+ margin-top: 0;
+ margin-bottom: 0.5rem;
+}
+
+h1, h2, h3, h4, h5, h6,
+.h1, .h2, .h3, .h4, .h5, .h6 {
+ margin-bottom: 0.5rem;
+ font-weight: 500;
+ line-height: 1.2;
+}
+
+h1, .h1 {
+ font-size: 2.5rem;
+}
+
+h2, .h2 {
+ font-size: 2rem;
+}
+
+h3, .h3 {
+ font-size: 1.75rem;
+}
+
+h4, .h4 {
+ font-size: 1.5rem;
+}
+
+h5, .h5 {
+ font-size: 1.25rem;
+}
+
+h6, .h6 {
+ font-size: 1rem;
+}
+
+label {
+ display: inline-block;
+ margin-bottom: .5rem;
+}
+
+legend {
+ display: block;
+ width: 100%;
+ max-width: 100%;
+ padding: 0;
+ margin-bottom: .5rem;
+ font-size: 1.5rem;
+ line-height: inherit;
+ color: inherit;
+ white-space: normal;
+}
+
+.border-bottom {
+ border-bottom: 1px solid #dee2e6 !important;
+}
diff --git a/projects/ng-core-tester/src/app/service/menu.service.spec.ts b/projects/rero/ng-core/assets/scss/_variables.scss
similarity index 63%
rename from projects/ng-core-tester/src/app/service/menu.service.spec.ts
rename to projects/rero/ng-core/assets/scss/_variables.scss
index 70956e88..651c7e9f 100644
--- a/projects/ng-core-tester/src/app/service/menu.service.spec.ts
+++ b/projects/rero/ng-core/assets/scss/_variables.scss
@@ -1,6 +1,6 @@
/*
* RERO angular core
- * Copyright (C) 2020 RERO
+ * Copyright (C) 2024 RERO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -14,17 +14,11 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-import { TestBed, inject } from '@angular/core/testing';
-import { MenuService } from './menu.service';
-describe('Service: Menu', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- providers: [MenuService]
- });
- });
+// Color
+$gray-300: #dee2e6 !default;
- it('should ...', inject([MenuService], (service: MenuService) => {
- expect(service).toBeTruthy();
- }));
-});
+
+// Border
+$border-width: 1px !default;
+$border-color: $gray-300 !default;
diff --git a/projects/rero/ng-core/assets/scss/ng-core.scss b/projects/rero/ng-core/assets/scss/ng-core.scss
new file mode 100644
index 00000000..881d7a2b
--- /dev/null
+++ b/projects/rero/ng-core/assets/scss/ng-core.scss
@@ -0,0 +1,21 @@
+/*
+ * RERO angular core
+ * Copyright (C) 2024 RERO
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+@import "./variables";
+@import "./border";
+@import "./style";
+@import "./typography";
diff --git a/projects/rero/ng-core/ng-package.json b/projects/rero/ng-core/ng-package.json
index e11805c6..af14cf8b 100644
--- a/projects/rero/ng-core/ng-package.json
+++ b/projects/rero/ng-core/ng-package.json
@@ -1,6 +1,7 @@
{
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../../dist/rero/ng-core",
+ "assets": ["./assets"],
"lib": {
"entryFile": "src/public-api.ts"
}
diff --git a/projects/rero/ng-core/package.json b/projects/rero/ng-core/package.json
index 334fcbdb..f08653e4 100644
--- a/projects/rero/ng-core/package.json
+++ b/projects/rero/ng-core/package.json
@@ -30,7 +30,10 @@
"ngx-toastr": "^18.0.0",
"easymde": "^2.18.0",
"marked": "^10.0.0",
- "@types/marked": "^4.0.8"
+ "@types/marked": "^4.0.8",
+ "primeflex": "^3.3.1",
+ "primeicons": "^7.0.0",
+ "primeng": "^17.18.0"
},
"publishConfig": {
"access": "public"
diff --git a/projects/rero/ng-core/src/lib/core.module.ts b/projects/rero/ng-core/src/lib/core.module.ts
index 5a373fbf..f7ac4ece 100644
--- a/projects/rero/ng-core/src/lib/core.module.ts
+++ b/projects/rero/ng-core/src/lib/core.module.ts
@@ -1,6 +1,6 @@
/*
* RERO angular core
- * Copyright (C) 2020 RERO
+ * Copyright (C) 2020-2024 RERO
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -23,6 +23,7 @@ import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
import { ModalModule } from 'ngx-bootstrap/modal';
import { NgxSpinnerModule } from 'ngx-spinner';
import { ToastrModule } from 'ngx-toastr';
+import { ConfirmationService, MessageService } from 'primeng/api';
import { CoreConfigService } from './core-config.service';
import { DialogComponent } from './dialog/dialog.component';
import { AutofocusDirective } from './directives/autofocus.directive';
@@ -83,7 +84,7 @@ import { SortListComponent } from './widget/sort-list/sort-list.component';
BsDropdownModule.forRoot(),
ToastrModule.forRoot(),
NgxSpinnerModule,
- PrimeNgCoreModule
+ PrimeNgCoreModule,
],
exports: [
PrimeNgCoreModule,
@@ -112,7 +113,9 @@ import { SortListComponent } from './widget/sort-list/sort-list.component';
AutofocusDirective
],
providers: [
- ComponentCanDeactivateGuard
+ ComponentCanDeactivateGuard,
+ ConfirmationService,
+ MessageService
]
})
export class CoreModule { }
diff --git a/projects/rero/ng-core/src/lib/prime-ng-core-module.ts b/projects/rero/ng-core/src/lib/prime-ng-core-module.ts
index 496baaaf..056eae5d 100644
--- a/projects/rero/ng-core/src/lib/prime-ng-core-module.ts
+++ b/projects/rero/ng-core/src/lib/prime-ng-core-module.ts
@@ -16,16 +16,65 @@
*/
import { ClipboardModule } from "@angular/cdk/clipboard";
import { NgModule } from "@angular/core";
+import { ConfirmationService, MessageService } from "primeng/api";
+import { AutoCompleteModule } from 'primeng/autocomplete';
+import { AutoFocusModule } from 'primeng/autofocus';
+import { BadgeModule } from 'primeng/badge';
+import { ButtonModule } from 'primeng/button';
import { CalendarModule } from "primeng/calendar";
+import { CardModule } from 'primeng/card';
+import { CheckboxModule } from 'primeng/checkbox';
+import { ConfirmDialogModule } from 'primeng/confirmdialog';
+import { DropdownModule } from "primeng/dropdown";
+import { InputGroupModule } from 'primeng/inputgroup';
+import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
+import { InputSwitchModule } from 'primeng/inputswitch';
+import { InputTextModule } from 'primeng/inputtext';
+import { InputTextareaModule } from 'primeng/inputtextarea';
+import { MessagesModule } from 'primeng/messages';
import { PaginatorModule } from 'primeng/paginator';
+import { PanelModule } from 'primeng/panel';
import { RadioButtonModule } from "primeng/radiobutton";
+import { SplitButtonModule } from 'primeng/splitbutton';
+import { TabViewModule } from 'primeng/tabview';
+import { TagModule } from 'primeng/tag';
+import { TieredMenuModule } from 'primeng/tieredmenu';
+import { ToastModule } from 'primeng/toast';
+import { TooltipModule } from 'primeng/tooltip';
+import { TriStateCheckboxModule } from 'primeng/tristatecheckbox';
@NgModule({
+ providers: [
+ MessageService,
+ ConfirmationService
+ ],
exports: [
+ AutoCompleteModule,
+ AutoFocusModule,
+ BadgeModule,
+ ButtonModule,
CalendarModule,
+ CardModule,
+ CheckboxModule,
ClipboardModule,
+ ConfirmDialogModule,
+ DropdownModule,
+ InputGroupModule,
+ InputGroupAddonModule,
+ InputSwitchModule,
+ InputTextModule,
+ InputTextareaModule,
+ MessagesModule,
PaginatorModule,
+ PanelModule,
RadioButtonModule,
+ SplitButtonModule,
+ TabViewModule,
+ TagModule,
+ TieredMenuModule,
+ ToastModule,
+ TooltipModule,
+ TriStateCheckboxModule,
]
})
export class PrimeNgCoreModule { }
diff --git a/projects/rero/ng-core/src/lib/record/autocomplete/autocomplete.component.spec.ts b/projects/rero/ng-core/src/lib/record/autocomplete/autocomplete.component.spec.ts
index 113f7ebf..0fe63790 100644
--- a/projects/rero/ng-core/src/lib/record/autocomplete/autocomplete.component.spec.ts
+++ b/projects/rero/ng-core/src/lib/record/autocomplete/autocomplete.component.spec.ts
@@ -17,7 +17,7 @@
import { HttpClientModule } from '@angular/common/http';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { FormsModule } from '@angular/forms';
-import { RouterTestingModule } from '@angular/router/testing';
+import { RouterModule } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
import { TypeaheadModule } from 'ngx-bootstrap/typeahead';
import { CoreModule } from '../../core.module';
@@ -33,7 +33,7 @@ describe('AutocompleteComponent', () => {
HttpClientModule,
FormsModule,
TypeaheadModule.forRoot(),
- RouterTestingModule,
+ RouterModule.forRoot([]),
TranslateModule.forRoot(),
CoreModule
],
diff --git a/projects/rero/ng-core/src/lib/record/detail/detail-button/detail-button.component.ts b/projects/rero/ng-core/src/lib/record/detail/detail-button/detail-button.component.ts
index 21902884..646ef7d8 100644
--- a/projects/rero/ng-core/src/lib/record/detail/detail-button/detail-button.component.ts
+++ b/projects/rero/ng-core/src/lib/record/detail/detail-button/detail-button.component.ts
@@ -98,7 +98,7 @@ export class DetailButtonComponent {
* @param message - message to display into modal
*/
showDeleteMessage(message: string) {
- this.deleteMessageEvent.emit(message);
+ this.deleteMessageEvent.emit(message.replace(new RegExp('\n', 'g'), '
'));
}
/** Go back to previous page */
diff --git a/projects/rero/ng-core/src/lib/record/editor/editor.component.html b/projects/rero/ng-core/src/lib/record/editor/editor.component.html
index 834d1a82..c8b6fc77 100644
--- a/projects/rero/ng-core/src/lib/record/editor/editor.component.html
+++ b/projects/rero/ng-core/src/lib/record/editor/editor.component.html
@@ -15,72 +15,59 @@
along with this program. If not, see .
-->